Ice 3.8
C++ API Reference
Loading...
Searching...
No Matches
Ice::Service Class Referenceabstract

A singleton class that helps you write Windows services and Unix daemons using Ice. More...

#include <Ice/Ice.h>

Public Member Functions

 Service ()
 Default constructor.
Ice::CommunicatorPtr communicator () const
 Gets the communicator created by the service.
virtual void handleInterrupt (int sig)
 Handles a signal.
virtual void interrupt ()
 Notifies the service that the program received a signal.
int main (const StringSeq &args, InitializationData initData={})
 The primary entry point for services.
int main (int argc, const char *const argv[], InitializationData initData={})
 The primary entry point for services.
int main (int argc, const wchar_t *const argv[], InitializationData initData={})
 The primary entry point for services.
std::string name () const
 Gets the program name.
bool service () const
 Indicates whether the program is running as a Win32 service or Unix daemon.
virtual bool shutdown ()
 Shuts down the service. The default implementation calls Communicator::shutdown.

Static Public Member Functions

static Serviceinstance ()
 Gets the Service singleton.

Protected Types

using ServiceError = LoggerOutput<Service, Service*, &Service::error>
 Logger utility class for an error.
using ServicePrint = LoggerOutput<Service, Service*, &Service::print>
 Logger utility class for a literal message.
using ServiceSysError = LoggerOutput<Service, Service*, &Service::syserror>
 Logger utility class for a system error.
using ServiceTrace = LoggerOutput<Service, Service*, &Service::trace>
 Logger utility class for a trace message.
using ServiceWarning = LoggerOutput<Service, Service*, &Service::warning>
 Logger utility class for a warning.

Protected Member Functions

void disableInterrupt ()
 Ignores signals.
void enableInterrupt ()
 Makes this service call handleInterrupt when it receives a signal.
virtual void error (const std::string &msg)
 Logs an error.
virtual Ice::CommunicatorPtr initializeCommunicator (int &argc, char *argv[], InitializationData initData)
 Initializes a communicator.
virtual void print (const std::string &msg)
 Logs a literal message.
virtual bool start (int argc, char *argv[], int &status)=0
 Prepares a service for execution, including the creation and activation of object adapters and servants.
virtual bool stop ()
 Cleans up resources after shutting down.
virtual void syserror (const std::string &msg)
 Logs a system error, which includes a description of the current system error code.
virtual void trace (const std::string &msg)
 Logs trace information.
virtual void waitForShutdown ()
 Blocks until the service shuts down. The default implementation calls Communicator::waitForShutdown.
virtual void warning (const std::string &msg)
 Logs a warning.

Detailed Description

A singleton class that helps you write Windows services and Unix daemons using Ice.

Definition at line 20 of file Service.h.


The documentation for this class was generated from the following file: