Main Page | Class List | Directories | File List | Class Members

RNReplicaNet::DebugHandler Class Reference

#include <DebugHandler.h>

List of all members.

Public Member Functions

virtual void DebugPrint (const char *)
virtual bool OutputToSocket (const char *text)
virtual bool EnableVisualDebuggerSocket (const int port=8000)
virtual void DisableVisualDebuggerSocket (void)
virtual void Printf (const char *format,...)
virtual void Poll (void)
virtual bool GotConnection (void) const
virtual void CallbackConnectionError (const int error)


Detailed Description

DebugHandler is a base class for handling debug messages output by RNXPURL, RNXPSession and RNReplicaNet. The implementation of DebugHandler::DebugPrint() can be extended by the application. The default implementation of DebugPrint() is to call OutputToSocket() with the debug text.
// Define the class
class ApplicationDebugHandler : public RNReplicaNet::DebugHandler
{
public:
	ApplicationDebugHandler() {};
	virtual ~ApplicationDebugHandler() {};

	void DebugPrint(const char *text)
	{
		// TODO: Add applications specific code here

		// And optionally call the base class function
		RNReplicaNet::DebugHandler::DebugPrint(text);
	}
};

#ifdef REPLICANET_VISUALDEBUGGER
// In the application code, to enable the debug output
RNReplicaNet::XPURL::RegisterDebugHandler(new ApplicationDebugHandler());
RNReplicaNet::XPURL::GetDebugHandler()->ConnectToVisualDebugger();
#endif

The class also contains a simple mechanism for starting a listen socket for a single connection from the ReplicaNet Visual Debugger application.


Member Function Documentation

virtual void RNReplicaNet::DebugHandler::CallbackConnectionError const int  error  )  [virtual]
 

This virtual function is called when there is a connection error.

Parameters:
error This contains a transport specific error. Typically negative values indicate a fatal error while positive errors indicate non-fatal errors.

virtual void RNReplicaNet::DebugHandler::DebugPrint const char *   )  [virtual]
 

A virtual function that an application can implement to enable debug output. The default implementation calls OutputToSocket()

virtual void RNReplicaNet::DebugHandler::DisableVisualDebuggerSocket void   )  [virtual]
 

This frees the socket used for the Visual Debugger connection. If connected to the Visual Debugger, this terminates the connection. If there is no socket allocated or connected this function does nothing. A PlatformHeap::ForceFree() will also disconnect any active Visual Debugger connection.

virtual bool RNReplicaNet::DebugHandler::EnableVisualDebuggerSocket const int  port = 8000  )  [virtual]
 

This enables a TCP listen socket that can be used for connections from the Visual Debugger to this debug session. This function always calls DisableVisualDebuggerSocket() first.

Parameters:
port The port number to listen on. The default is 8000.
Returns:
Indicates an error occurred if true, false means no error.

virtual bool RNReplicaNet::DebugHandler::GotConnection void   )  const [virtual]
 

Returns the state of the socket connection.

Returns:
Returns true if there is an accepted connection, false if not.

virtual bool RNReplicaNet::DebugHandler::OutputToSocket const char *  text  )  [virtual]
 

Outputs some text to the debug socket.

Parameters:
text The text
Returns:
Indicates an error occurred if true while sending the text, false indicates no error.

virtual void RNReplicaNet::DebugHandler::Poll void   )  [virtual]
 

Called regularly by the library hosting the debug connection. Can also be called by the user.

virtual void RNReplicaNet::DebugHandler::Printf const char *  format,
  ...
[virtual]
 

A variable argument printf style function that uses DebugPrint() to output the result

Parameters:
format The format, like printf.


The documentation for this class was generated from the following file:
Generated on Sun Oct 30 01:12:16 2005 for XPURL by  doxygen 1.4.1