23 #ifndef __ccxx_Service_hxx 24 #define __ccxx_Service_hxx 93 const String& compileDate =
"",
const String& compileTime =
"");
118 { _workingDir = dir; }
122 virtual bool processOption(
char opt,
const String& longOpt,
144 virtual void run() = 0;
162 virtual void shutdown() = 0;
170 #ifdef CCXX_OS_WINDOWS 171 static void _serviceMain(
int argc,
char** argv);
173 static void _controlHandler(DWORD code);
174 void _serviceStart();
176 void _serviceInstall();
177 void _serviceUninstall();
178 bool _waitForStatus(SC_HANDLE handle, DWORD pending, DWORD
final);
180 SERVICE_STATUS_HANDLE _handle;
181 SERVICE_STATUS _status;
186 static void _sighandler(
int sig);
196 #ifdef CCXX_OS_WINDOWS 197 enum Action { None, Start, Stop, Install, Uninstall } _action;
206 #endif // __ccxx_Service_hxx
void setDescription(const String &desc)
Set the service description.
Definition: Service.h++:107
void setWorkingDir(const String &dir)
On POSIX systems, set the working directory for the service daemon process.
Definition: Service.h++:117
bool isDebug() const
Test if debug (foreground) mode is enabled.
Definition: Service.h++:165
Basic functionality for a system service, such as a daemon on UNIX or an "NT Service" on Windows...
Definition: Service.h++:77
#define COMMONCPP_API
Definition: Common.h++:126
A flexible, reference counted, copy-on-write, thread-safe, nullable string.
Definition: String.h++:50
Base functionality for an application, including command-line argument parsing and a shutdown handler...
Definition: Application.h++:42
static const String null
The null string.
Definition: String.h++:1128
Definition: AllocationMap.c++:25