Service.h

00001 /* START_LICENSE_HEADER
00002 
00003 Copyright (C) 2000 Martin Piper, original design and program code
00004 Copyright (C) 2001 Replica Software
00005 
00006 This program file is copyright (C) Replica Software and can only be used under license.
00007 For more information visit: http://www.replicanet.com/
00008 Or email: info@replicanet.com
00009 
00010 END_LICENSE_HEADER */
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 } // namespace RNLobby
00079 
00080 } // namespace RNReplicaNet
00081 
00082 #endif

Generated on Sat Jun 28 22:02:16 2008 for ReplicaNet and RNLobby by  doxygen 1.5.3