Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
DebugIOInterface Interface Referenceabstract

Debug I/O interface. More...

#include <rts/debug.h>

Inherited by DebugIOCon, DebugIOFlat, DebugIONet, and DebugIOOds.

Public Types

enum  StringType {
  Assert = 0 , Check , Log , Crash ,
  Exception , CmdReply , StructuredCmdReply , Other ,
  MAX
}
 List of possible log string types. More...
 

Public Member Functions

 DebugIOInterface (void)
 
virtual int Read (char *buf, int maxchar)=0
 Retrieves up to the given number of characters from a command input source.
 
virtual void Write (StringType type, const char *src, const char *str)=0
 Write out some characters differentiated by the log string type.
 
virtual void EmergencyFlush (void)=0
 Emergency shutdown function.
 
virtual void Execute (class Debug &dbg, const char *cmd, bool structuredCmd, unsigned argn, const char *const *argv)=0
 I/O class specific command.
 
virtual void Delete (void)=0
 Destroys the current I/O class instance.
 

Protected Member Functions

virtual ~DebugIOInterface ()
 I/O class destructor.
 

Detailed Description

Debug I/O interface.

A Debug I/O interface implementation must register itself using Debug::AddIOFactory. Typically this is done by using the DEBUG_DECLARE_IO_INTERFACE and DEBUG_IMPLEMENT_IO_INTERFACE macros (recommended, but not mandatory.)

Definition at line 46 of file debug_io.h.

Member Enumeration Documentation

◆ StringType

List of possible log string types.

Enumerator
Assert 

DASSERT etc.

Check 

DCHECK etc.

Log 

DLOG etc.

Crash 

DCRASH etc.

Exception 

Exception.

CmdReply 

Regular command reply.

StructuredCmdReply 

Structured command reply, see Structured command reply.

Other 

some other message

MAX 

Definition at line 66 of file debug_io.h.

Constructor & Destructor Documentation

◆ ~DebugIOInterface()

virtual DebugIOInterface::~DebugIOInterface ( )
inlineprotectedvirtual

I/O class destructor.

The destructor must always be protected. Destruction is done by calling the Delete member function.

Definition at line 59 of file debug_io.h.

◆ DebugIOInterface()

DebugIOInterface::DebugIOInterface ( void )
inlineexplicit

Definition at line 63 of file debug_io.h.

Member Function Documentation

◆ Delete()

virtual void DebugIOInterface::Delete ( void )
pure virtual

Destroys the current I/O class instance.

Use this function instead of just delete'ing the instance.

Implemented in DebugIOCon, DebugIOFlat, DebugIONet, and DebugIOOds.

◆ EmergencyFlush()

virtual void DebugIOInterface::EmergencyFlush ( void )
pure virtual

Emergency shutdown function.

This function gets called during an exception and should perform the absolute bare minimum (e.g. just flushing and closing the output file).

Implemented in DebugIOCon, DebugIOFlat, DebugIONet, and DebugIOOds.

◆ Execute()

virtual void DebugIOInterface::Execute ( class Debug & dbg,
const char * cmd,
bool structuredCmd,
unsigned argn,
const char *const * argv )
pure virtual

I/O class specific command.

All io <class> commands are passed into this function, with the exception of remove which results in simply calling the class destructor.

Parameters
dbgdebug instance
cmdcommand issued
structuredCmdtrue if structured command reply, false if not
argnnumber of additional arguments passed in
argvargument list

Implemented in DebugIOCon, DebugIOFlat, DebugIONet, and DebugIOOds.

◆ Read()

virtual int DebugIOInterface::Read ( char * buf,
int maxchar )
pure virtual

Retrieves up to the given number of characters from a command input source.

This source can be e.g. keyboard or a network pipe. This function must not block.

Parameters
bufbuffer to place read characters in
maxcharmaximum number of characters to return
Returns
numbers of characters written to buffer
Note
There is no terminating NUL char written to the buffer

Implemented in DebugIOCon, DebugIOFlat, DebugIONet, and DebugIOOds.

◆ Write()

virtual void DebugIOInterface::Write ( StringType type,
const char * src,
const char * str )
pure virtual

Write out some characters differentiated by the log string type.

Parameters
typepossible string type
srcstring source, may be NULL, content depends on type:
typesrc
Assertfile(line)
Checkfile(line)
Loglog group
Crashfile(line)
ExceptionNULL
CmdReplygroup.command
StructuredCmdReplygroup.command
OtherNULL
strstring to output, NUL delimited, if NULL then simply flush output (if applicable)

Implemented in DebugIOCon, DebugIOFlat, DebugIONet, and DebugIOOds.


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