11 #include "RNPlatform/Inc/MemoryTracking.h"
17 namespace RNReplicaNet
31 Service(
const char *internalServiceName,
const char *displayServiceName);
36 static void SetDebugNames(
const char *internalServiceName,
const char *displayServiceName);
37 static bool SetDebugOutput(
const char *verboseDebugFile ,
const char *profileDebugFile ,
const char *errorDebugFile ,
const int fileSize );
40 static void SetRegistry(
const char *name ,
const char *value ,
const bool userModifiableKey =
false );
41 static void SetRegistry(
const char *name ,
const int value ,
const bool userModifiableKey =
false );
44 static bool GetRegistry(
const char *name , std::string &value ,
const bool userModifiableKey =
false);
45 static bool GetRegistry(
const char *name ,
int &value ,
const bool userModifiableKey =
false);
53 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);
56 static bool SetArgs(
int argc = 0,
char **argv = 0);
59 static bool GetArgs(
int &argc,
char ** &argv);
73 bool Execute(
const bool setCurrentDirectory =
true,
const bool storeLastDebugPrint =
false);
77 virtual int Main(
int argc = 0,
char **argv = 0) = 0;
92 static bool GetDebugLine(
const char *serviceName,std::string &buffer);
99 static void DebugOut(
const char *, ...);
105 static void GetSystemCPUMetrics(
float &userPercent,
float &kernelPercent);
108 static const char *GetInternalServiceName(
void);
111 static const char *GetDisplayServiceName(
void);
113 static std::string GetFileVersion(
void);
114 static std::string GetUserInfo(
void);
120 static void CreateRegistry(
void);
122 static void DebugPrintCommon(
char *buffer );
123 static void DebugPrintCommonStore(
char *buffer );
bool Stop(void)
Stops the service.
static void SetRegistry(const char *name, const char *value, const bool userModifiableKey=false)
virtual int Main(int argc=0, char **argv=0)=0
static void DebugOut(const char *,...)
A utility function that allows the user to output debug information as the service is running...
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)
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 void SetDebugNames(const char *internalServiceName, const char *displayServiceName)
Sets the debug printing names without instantiating this class.
static bool GetRegistry(const char *name, std::string &value, const bool userModifiableKey=false)
bool Execute(const bool setCurrentDirectory=true, const bool storeLastDebugPrint=false)
static void DebugPrintFile(const char *text)
A utility function that allows the user to output debug information to a file.
bool Start(void)
Starts the service.
static void DebugPrintNoParams(const char *)
Same as DebugPrint except that the input text has no parameter parsing so it uses slightly less CPU t...
static bool GetDebugLine(std::string &buffer)
Retrieves the last line from DebugPrint for the current service.
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...
Service(const char *internalServiceName, const char *displayServiceName)
static void SetDebugLine(const char *buffer)
A utility function that allows the user to output debug information as the service is running...
static bool GetServiceList(std::list< std::string > &services)
bool NeedToExitMain(void)
Returns true if the Main function needs to exit. This must be tested fairly regularly by the Main fun...
bool Delete(void)
Deletes the service.