ReplicaNet and RNLobby  1
Public Member Functions | List of all members
MyService Class Reference
Inheritance diagram for MyService:
Inheritance graph
[legend]
Collaboration diagram for MyService:
Collaboration graph
[legend]

Public Member Functions

int Main (int argc=0, char **argv=0)
 
std::string GetDebugStatusLine (RNReplicaNet::SysTime &theTime)
 
- Public Member Functions inherited from Service
 Service (const char *internalServiceName, const char *displayServiceName)
 
bool Create (const char *userName=0, const char *password=0, const bool autoStart=true, const bool restartOnError=true, const char *longDescription=0, const char *dependencies=0)
 
bool Start (void)
 Starts the service.
 
bool Stop (void)
 Stops the service.
 
bool Delete (void)
 Deletes the service.
 
bool Execute (const bool setCurrentDirectory=true, const bool storeLastDebugPrint=false)
 

Additional Inherited Members

- Static Public Member Functions inherited from Service
static void SetDebugNames (const char *internalServiceName, const char *displayServiceName)
 Sets the debug printing names without instantiating this class.
 
static bool SetDebugOutput (const char *verboseDebugFile, const char *profileDebugFile, const char *errorDebugFile, const int fileSize)
 
static void SetRegistry (const char *name, const char *value, const bool userModifiableKey=false)
 
static void SetRegistry (const char *name, const int value, const bool userModifiableKey=false)
 
static bool GetRegistry (const char *name, std::string &value, const bool userModifiableKey=false)
 
static bool GetRegistry (const char *name, int &value, const bool userModifiableKey=false)
 
static bool SetArgs (int argc=0, char **argv=0)
 Sets the arguments to use for this service. On Windows platforms these are stored in the registry.
 
static bool GetArgs (int &argc, char **&argv)
 Gets the arguments to use for this service. On Windows platforms these are stored in the registry.
 
static void DebugPrint (const char *,...)
 A utility function that allows the user to output debug information as the service is running. This debug information is stored for display by RLSrvMonitor so do not use this to display confidential information.
 
static void DebugPrintNoParams (const char *)
 Same as DebugPrint except that the input text has no parameter parsing so it uses slightly less CPU time and memory.
 
static void SetDebugLine (const char *buffer)
 A utility function that allows the user to output debug information as the service is running. This gets set into the RLSrvMonitor/RLServerMonitor accessible debug line and should not be used for confidential information.
 
static bool GetDebugLine (std::string &buffer)
 Retrieves the last line from DebugPrint for the current service.
 
static bool GetDebugLine (const char *serviceName, std::string &buffer)
 
static bool GetServiceList (std::list< std::string > &services)
 
static void DebugOut (const char *,...)
 A utility function that allows the user to output debug information as the service is running. This does not get set into the RLSrvMonitor/RLServerMonitor accessible debug line and can be used for more confidential information.
 
static void DebugPrintFile (const char *text)
 A utility function that allows the user to output debug information to a file.
 
static void GetSystemCPUMetrics (float &userPercent, float &kernelPercent)
 
static const char * GetInternalServiceName (void)
 
static const char * GetDisplayServiceName (void)
 
static std::string GetFileVersion (void)
 
static std::string GetUserInfo (void)
 
- Protected Member Functions inherited from Service
bool NeedToExitMain (void)
 Returns true if the Main function needs to exit. This must be tested fairly regularly by the Main function.
 
- Static Protected Member Functions inherited from Service
static void CreateRegistry (void)
 
static void DebugPrintCommon (char *buffer)
 
static void DebugPrintCommonStore (char *buffer)
 

Member Function Documentation

int Main ( int  argc = 0,
char **  argv = 0 
)
virtual

The main work function which must be implemented. Any unhandled exception (such as accessing an invalid memory address) will be caught by this Service class and will usually cause the service to restart if configured.

Implements Service.

References Service::DebugOut(), Service::DebugPrintNoParams(), XPAddress::Export(), PlatformHeap::ForceFree(), Service::NeedToExitMain(), CurrentThread::Sleep(), XPSock_Init(), and XPSock_UrgentCreate().