00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef _SERVICE_H_
00012 #define _SERVICE_H_
00013 #include "RNPlatform/Inc/DLLExportAPI.h"
00014 #include <string>
00015 #include <list>
00016
00017 namespace RNReplicaNet
00018 {
00019
00020 namespace RNLobby
00021 {
00022
00026 class Service
00027 {
00028 public:
00029 Service(const char *internalServiceName,const char *displayServiceName);
00030 virtual ~Service();
00031
00034 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);
00035
00037 bool SetArgs(int argc = 0,char **argv = 0);
00038
00040 bool GetArgs(int &argc,char ** &argv);
00041
00043 bool Start(void);
00044
00046 bool Stop(void);
00047
00049 bool Delete(void);
00050
00054 bool Execute(const bool setCurrentDirectory = true,const bool storeLastDebugPrint = false);
00055
00058 virtual int Main(int argc = 0,char **argv = 0) = 0;
00059
00061 void DebugPrint(const char *, ...);
00062
00064 static bool GetDebugLine(const char *serviceName,std::string &buffer);
00065
00067 static bool GetServiceList(std::list<std::string> &services);
00068
00069 protected:
00071 bool NeedToExitMain(void);
00072 bool mToStdOut;
00073
00074 void SetDebugLine(const char *buffer);
00075 private:
00076 };
00077
00078 }
00079
00080 }
00081
00082 #endif