CLI  2.9
IOMux Class Reference

Input / output device multiplexer. More...

#include <io_mux.h>

Inheritance diagram for IOMux:

Public Member Functions

 IOMux (const bool AutoDelete)
 Main constructor. More...
 
virtual ~IOMux (void)
 Destructor. More...
 
virtual void PutString (const char *const STR_Out) const
 Output handler. More...
 
virtual void Beep (void) const
 Beep handler. More...
 
virtual void CleanScreen (void) const
 Clean screen. More...
 
virtual const bool WouldOutput (const OutputDevice &CLI_Device) const
 Stack overflow protection. More...
 
virtual const KEY GetKey (void) const
 Input key capture handler. More...
 
virtual const ResourceString GetLocation (void) const
 Input location accessor. More...
 
virtual const bool WouldInput (const IODevice &CLI_Device) const
 Stack overflow protection. More...
 
const bool AddDevice (IODevice *const PCLI_Device)
 Device addition in the list. More...
 
const IODevice *const GetCurrentDevice (void) const
 Current device accessor. More...
 
const IODevice *const SwitchNextDevice (void)
 Switch to next device. More...
 
const bool ResetDeviceList (void)
 Reset device list. More...
 
- Public Member Functions inherited from IODevice
 IODevice (const char *const STR_DbgName, const bool B_AutoDelete)
 Constructor. More...
 
virtual ~IODevice (void)
 Destructor. More...
 
- Public Member Functions inherited from OutputDevice
const tk::String GetDebugName (void) const
 Debug name accessor. More...
 
const int UseInstance (const CallInfo &CLI_CallInfo)
 Ensures instance validity. More...
 
const int FreeInstance (const CallInfo &CLI_CallInfo)
 Releases the instance. More...
 
const int GetInstanceUsers (void) const
 Instance user count accessor. More...
 
const bool OpenUp (const CallInfo &CLI_CallInfo)
 Checks the device is opened. More...
 
const bool CloseDown (const CallInfo &CLI_CallInfo)
 Indicates the device the client does not need the device to opened anymore. More...
 
const int GetOpenUsers (void) const
 Open state user count accessor. More...
 
const OutputDeviceoperator<< (const std::string &STR_Out) const
 Output operator. More...
 
const OutputDeviceoperator<< (const tk::String &STR_Out) const
 Output operator. More...
 
const OutputDeviceoperator<< (const char *const STR_Out) const
 Output operator. More...
 
const OutputDeviceoperator<< (const char C_Out) const
 Output operator. More...
 
const OutputDeviceoperator<< (const KEY E_Key) const
 Output operator. More...
 
const OutputDeviceoperator<< (const uint8_t UI8_Out) const
 Output operator. More...
 
const OutputDeviceoperator<< (const int16_t I16_Out) const
 Output operator. More...
 
const OutputDeviceoperator<< (const uint16_t UI16_Out) const
 Output operator. More...
 
const OutputDeviceoperator<< (const int32_t I32_Out) const
 Output operator. More...
 
const OutputDeviceoperator<< (const uint32_t UI32_Out) const
 Output operator. More...
 
const OutputDeviceoperator<< (const int64_t I64_Out) const
 Output operator. More...
 
const OutputDeviceoperator<< (const uint64_t UI64_Out) const
 Output operator. More...
 
const OutputDeviceoperator<< (const float F_Out) const
 Output operator. More...
 
const OutputDeviceoperator<< (const double D_Out) const
 Output operator. More...
 
const OutputDeviceoperator<< (const void *const PV_Out) const
 Output operator. More...
 
const OutputDeviceoperator<< (const IOEndl &CLI_IOEndl) const
 Output operator. More...
 
const ResourceString GetLastError (void) const
 Last error accessor. More...
 
virtual const ScreenInfo GetScreenInfo (void) const
 Screen info accessor. More...
 
- Public Member Functions inherited from Object
virtual ~Object (void)=0
 Pure virtual destructor. More...
 

Protected Member Functions

virtual const bool OpenDevice (void)
 Device opening handler. More...
 
virtual const bool CloseDevice (void)
 Device closure handler. More...
 
virtual IODevice *const CreateDevice (void)
 Method called when an input / output device is needed. More...
 
- Protected Member Functions inherited from IODevice
const KEY Char2Key (const int I_Char) const
 Common char translation. More...
 
- Protected Member Functions inherited from OutputDevice
 OutputDevice (const char *const STR_DbgName, const bool B_AutoDelete)
 Constructor. More...
 
virtual ~OutputDevice (void)
 Destructor. More...
 
- Protected Member Functions inherited from Object
 Object (void)
 Default constructor only available to sub-classes. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from IODevice
static IODeviceGetNullDevice (void)
 Null device singleton. More...
 
static IODeviceGetStdIn (void)
 Standard input device singleton. More...
 
- Static Public Member Functions inherited from OutputDevice
static OutputDeviceGetNullDevice (void)
 Null device singleton. More...
 
static OutputDeviceGetStdOut (void)
 Standard output device singleton. More...
 
static OutputDeviceGetStdErr (void)
 Standard error device singleton. More...
 
- Protected Attributes inherited from OutputDevice
ResourceString m_cliLastError
 

Detailed Description

Input / output device multiplexer.

Warning
Please ensure one of the following conditions for each device passed to instances of this class:
  • Either the device is an auto-deleted device,
  • or it will be destroyed after this input / output multiplexer,
  • or it will be dereferenced on termination. Otherwise you could experience consistency troubles. The null device and standard devices are not subject to this remark.

Definition at line 52 of file io_mux.h.

Constructor & Destructor Documentation

◆ IOMux()

IOMux::IOMux ( const bool  AutoDelete)
explicit

Main constructor.

Parameters
AutoDeleteAuto-deletion flag.

◆ ~IOMux()

virtual IOMux::~IOMux ( void  )
virtual

Destructor.

Member Function Documentation

◆ AddDevice()

const bool IOMux::AddDevice ( IODevice *const  PCLI_Device)

Device addition in the list.

Returns
true if the device has been added, false otherwise.
Parameters
PCLI_DeviceInput / output device.

◆ Beep()

virtual void IOMux::Beep ( void  ) const
virtual

Beep handler.

Reimplemented from OutputDevice.

◆ CleanScreen()

virtual void IOMux::CleanScreen ( void  ) const
virtual

Clean screen.

Reimplemented from OutputDevice.

◆ CloseDevice()

virtual const bool IOMux::CloseDevice ( void  )
protectedvirtual

Device closure handler.

Returns
true for success, false otherwise.
Note
Devices have to be prepared to be called several times through this method. They should do the closure once only (unless they have been opened between CloseDevice() calls), and indicate no failure thereafter.

Implements OutputDevice.

◆ CreateDevice()

virtual IODevice* const IOMux::CreateDevice ( void  )
protectedvirtual

Method called when an input / output device is needed.

Returns
New input device.
NULL means no more input unless new input devices have been pushed through AddInput().

◆ GetCurrentDevice()

const IODevice* const IOMux::GetCurrentDevice ( void  ) const

Current device accessor.

Returns
Current device.

◆ GetKey()

virtual const KEY IOMux::GetKey ( void  ) const
virtual

Input key capture handler.

Warning
Blocking call.
Returns
KEY code captured.

Implements IODevice.

◆ GetLocation()

virtual const ResourceString IOMux::GetLocation ( void  ) const
virtual

Input location accessor.

Returns
Input location resource string.

Reimplemented from IODevice.

◆ OpenDevice()

virtual const bool IOMux::OpenDevice ( void  )
protectedvirtual

Device opening handler.

Returns
true for success, false otherwise.
Note
Devices have to be prepared to be called several times through this method. They should do the opening once only (unless they have been closed between OpendDevice() calls), and indicate no failure thereafter.

Implements OutputDevice.

◆ PutString()

virtual void IOMux::PutString ( const char *const  STR_Out) const
virtual

Output handler.

Parameters
STR_OutOutput string.

Implements OutputDevice.

◆ ResetDeviceList()

const bool IOMux::ResetDeviceList ( void  )

Reset device list.

Returns
true for success, false otherwise.

◆ SwitchNextDevice()

const IODevice* const IOMux::SwitchNextDevice ( void  )

Switch to next device.

Returns
Next device if success, NULL otherwise.

◆ WouldInput()

virtual const bool IOMux::WouldInput ( const IODevice CLI_Device) const
virtual

Stack overflow protection.

Parameters
CLI_DeviceOther device that the callee device should check it would input characters from.
Returns
true if the callee device would redirect input to the given device for reading.

Determines whether the current device would input the given device in any ways. Default implementation checks whether CLI_Device is the self device.

Reimplemented from IODevice.

◆ WouldOutput()

virtual const bool IOMux::WouldOutput ( const OutputDevice CLI_Device) const
virtual

Stack overflow protection.

Parameters
CLI_DeviceOther device that the callee device should check it would output characters to.
Returns
true if the callee device would redirect characters to the given device for output.

Determines whether the current device would output the given device in any way. Default implementation checks whether CLI_Device is the self device.

Reimplemented from OutputDevice.


The documentation for this class was generated from the following file: