CLI  2.9
OutputDevice Class Referenceabstract

Generic output device. More...

#include <io_device.h>

Inheritance diagram for OutputDevice:

Classes

class  ScreenInfo
 Screen information. More...
 

Public Member Functions

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 void PutString (const char *const STR_Out) const =0
 Output handler. More...
 
virtual void Beep (void) const
 Beep handler. More...
 
virtual void CleanScreen (void) const
 Clean screen. More...
 
virtual const ScreenInfo GetScreenInfo (void) const
 Screen info accessor. More...
 
virtual const bool WouldOutput (const OutputDevice &CLI_Device) const
 Stack overflow protection. More...
 
- Public Member Functions inherited from Object
virtual ~Object (void)=0
 Pure virtual destructor. More...
 

Static Public Member Functions

static OutputDeviceGetNullDevice (void)
 Null device singleton. More...
 
static OutputDeviceGetStdOut (void)
 Standard output device singleton. More...
 
static OutputDeviceGetStdErr (void)
 Standard error device singleton. More...
 

Protected Member Functions

 OutputDevice (const char *const STR_DbgName, const bool B_AutoDelete)
 Constructor. More...
 
virtual ~OutputDevice (void)
 Destructor. More...
 
virtual const bool OpenDevice (void)=0
 Device opening handler. More...
 
virtual const bool CloseDevice (void)=0
 Device closure handler. More...
 
- Protected Member Functions inherited from Object
 Object (void)
 Default constructor only available to sub-classes. More...
 

Protected Attributes

ResourceString m_cliLastError
 

Detailed Description

Generic output device.

See also
endl

Definition at line 256 of file io_device.h.

Constructor & Destructor Documentation

◆ OutputDevice()

OutputDevice::OutputDevice ( const char *const  STR_DbgName,
const bool  B_AutoDelete 
)
explicitprotected

Constructor.

Parameters
STR_DbgNameDebug name. Useful for traces only.
B_AutoDeleteAuto-deletion flag.

◆ ~OutputDevice()

virtual OutputDevice::~OutputDevice ( void  )
protectedvirtual

Destructor.

Member Function Documentation

◆ Beep()

virtual void OutputDevice::Beep ( void  ) const
virtual

◆ CleanScreen()

virtual void OutputDevice::CleanScreen ( void  ) const
virtual

Clean screen.

Reimplemented in TelnetConnection, InputFileDevice, IOMux, SingleCommand, Console, Text, and StringDevice.

◆ CloseDevice()

virtual const bool OutputDevice::CloseDevice ( void  )
protectedpure virtual

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.

Implemented in TelnetConnection, OutputFileDevice, InputFileDevice, IOMux, SingleCommand, StringDevice, Text, and Console.

◆ CloseDown()

const bool OutputDevice::CloseDown ( const CallInfo CLI_CallInfo)

Indicates the device the client does not need the device to opened anymore.

Returns
true for success, false otherwise.

Releases the lock on the open state. When no more user need the device to be opened, it is closed straight forward.

Parameters
CLI_CallInfoCall information.

◆ FreeInstance()

const int OutputDevice::FreeInstance ( const CallInfo CLI_CallInfo)

Releases the instance.

Returns
Total number of instance users after this call.

If the auto-deletion flag has been set during construction, the object is auto-deleted when the number of users reaches 0 on this call.

Parameters
CLI_CallInfoCall information.

◆ GetDebugName()

const tk::String OutputDevice::GetDebugName ( void  ) const

Debug name accessor.

Returns
Debug name.

◆ GetInstanceUsers()

const int OutputDevice::GetInstanceUsers ( void  ) const

Instance user count accessor.

Returns
Number of instance users.

◆ GetLastError()

const ResourceString OutputDevice::GetLastError ( void  ) const

Last error accessor.

Returns
Last error resource string.

◆ GetNullDevice()

static OutputDevice& OutputDevice::GetNullDevice ( void  )
static

Null device singleton.

Returns
Null device reference.

Referenced by Text::LineDown(), and Password::OnKey().

◆ GetOpenUsers()

const int OutputDevice::GetOpenUsers ( void  ) const

Open state user count accessor.

Returns
Number of users that have opened the device.

◆ GetScreenInfo()

virtual const ScreenInfo OutputDevice::GetScreenInfo ( void  ) const
virtual

Screen info accessor.

Returns
Screen info with possible ScreenInfo::UNKNOWN values.

Reimplemented in Console.

Referenced by More::OnKey(), Less::ResetToDefault(), and More::ResetToDefault().

◆ GetStdErr()

static OutputDevice& OutputDevice::GetStdErr ( void  )
static

Standard error device singleton.

Returns
Standard error device reference.

◆ GetStdOut()

static OutputDevice& OutputDevice::GetStdOut ( void  )
static

Standard output device singleton.

Returns
Standard output device reference.

◆ OpenDevice()

virtual const bool OutputDevice::OpenDevice ( void  )
protectedpure virtual

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.

Implemented in TelnetConnection, OutputFileDevice, InputFileDevice, IOMux, SingleCommand, Text, StringDevice, and Console.

◆ OpenUp()

const bool OutputDevice::OpenUp ( const CallInfo CLI_CallInfo)

Checks the device is opened.

Returns
true for success, false otherwise.

Opens the device if not already opened. Acquire a lock on the open state in any case.

Parameters
CLI_CallInfoCall information.

◆ operator<<() [1/16]

const OutputDevice& OutputDevice::operator<< ( const std::string &  STR_Out) const

Output operator.

Returns
The output device itself.
Author
[contrib: Oleg Smolsky, 2010, based on CLI 2.5]
Parameters
STR_OutOutput string object.

◆ operator<<() [2/16]

const OutputDevice& OutputDevice::operator<< ( const tk::String &  STR_Out) const

Output operator.

Returns
The output device itself.
Parameters
STR_OutOutput string object.

◆ operator<<() [3/16]

const OutputDevice& OutputDevice::operator<< ( const char *const  STR_Out) const

Output operator.

Returns
The output device itself.
Parameters
STR_OutOutput null terminated string.

◆ operator<<() [4/16]

const OutputDevice& OutputDevice::operator<< ( const char  C_Out) const

Output operator.

Returns
The output device itself.
Parameters
C_OutSingle character.

◆ operator<<() [5/16]

const OutputDevice& OutputDevice::operator<< ( const KEY  E_Key) const

Output operator.

Returns
The output device itself.
Parameters
E_KeySingle character as a KEY.

◆ operator<<() [6/16]

const OutputDevice& OutputDevice::operator<< ( const uint8_t  UI8_Out) const

Output operator.

Returns
The output device itself.
Parameters
UI8_Out8 bits unsigned integer number.

◆ operator<<() [7/16]

const OutputDevice& OutputDevice::operator<< ( const int16_t  I16_Out) const

Output operator.

Returns
The output device itself.
Parameters
I16_Out16 bits integer number.

◆ operator<<() [8/16]

const OutputDevice& OutputDevice::operator<< ( const uint16_t  UI16_Out) const

Output operator.

Returns
The output device itself.
Parameters
UI16_Out16 bits unsigned integer number.

◆ operator<<() [9/16]

const OutputDevice& OutputDevice::operator<< ( const int32_t  I32_Out) const

Output operator.

Returns
The output device itself.
Parameters
I32_Out32 bits integer number.

◆ operator<<() [10/16]

const OutputDevice& OutputDevice::operator<< ( const uint32_t  UI32_Out) const

Output operator.

Returns
The output device itself.
Parameters
UI32_Out32 bits unsigned integer number.

◆ operator<<() [11/16]

const OutputDevice& OutputDevice::operator<< ( const int64_t  I64_Out) const

Output operator.

Returns
The output device itself.
Parameters
I64_Out64 bits integer number.

◆ operator<<() [12/16]

const OutputDevice& OutputDevice::operator<< ( const uint64_t  UI64_Out) const

Output operator.

Returns
The output device itself.
Parameters
UI64_Out64 bits unsigned integer number.

◆ operator<<() [13/16]

const OutputDevice& OutputDevice::operator<< ( const float  F_Out) const

Output operator.

Returns
The output device itself.
Parameters
F_OutFloat number.

◆ operator<<() [14/16]

const OutputDevice& OutputDevice::operator<< ( const double  D_Out) const

Output operator.

Returns
The output device itself.
Parameters
D_OutDouble number.

◆ operator<<() [15/16]

const OutputDevice& OutputDevice::operator<< ( const void *const  PV_Out) const

Output operator.

Returns
The output device itself.
Parameters
PV_OutVoid address.

◆ operator<<() [16/16]

const OutputDevice& OutputDevice::operator<< ( const IOEndl CLI_IOEndl) const

Output operator.

Returns
The output device itself.
Parameters
CLI_IOEndlCarriage return.

◆ PutString()

virtual void OutputDevice::PutString ( const char *const  STR_Out) const
pure virtual

Output handler.

Parameters
STR_OutOutput string.

Implemented in TelnetConnection, OutputFileDevice, InputFileDevice, IOMux, SingleCommand, Console, Text, and StringDevice.

◆ UseInstance()

const int OutputDevice::UseInstance ( const CallInfo CLI_CallInfo)

Ensures instance validity.

Returns
Total number of instance users after this call.
Parameters
CLI_CallInfoCall information.

◆ WouldOutput()

virtual const bool OutputDevice::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 in InputFileDevice, IOMux, SingleCommand, and Text.

Referenced by Text::WouldOutput().

Member Data Documentation

◆ m_cliLastError

ResourceString OutputDevice::m_cliLastError
mutableprotected

Last error.

Returns
N/A (doxygen warning)

Definition at line 575 of file io_device.h.


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