All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
HSEP::Service Class Reference

Creates an operating system Service. More...

#include <Service.h>

+ Collaboration diagram for HSEP::Service:

Public Member Functions

 Service (string pName, ServiceThreadFactory &pServiceThreadFactory)
 Creates a service named "pName", and uses the provided ThreadFactory to create the internal working thread.
 
virtual ~Service ()
 
int body ()
 The body will be executed until a signal is received by the operating system.
 
void finish ()
 Indicate to the Service that must be finished.
 

Protected Member Functions

bool _continue ()
 

Protected Attributes

int aPid
 Process ID.
 
int aSid
 Session ID.
 
string aName
 

Friends

void TerminateHandler (int pSignal)
 

Detailed Description

Creates an operating system Service.

In the case of POSIX implementation, the process is declared orphan and automatically adopted by the main operating system structures.

All internal processing is controlled automatically by this class.

The service will declare two threads: (1) the main one that will receive signals from the operating system, and (2) the service one, that will provide useful functionality.

Definition at line 88 of file Service.h.

Constructor & Destructor Documentation

HSEP::Service::Service ( string  pName,
ServiceThreadFactory pServiceThreadFactory 
)

Creates a service named "pName", and uses the provided ThreadFactory to create the internal working thread.

Parameters
pName
pServiceThreadFactory

Definition at line 88 of file Service.cpp.

References aName, aPid, aSid, HSEP::ServiceThreadFactory::createPtr(), HSEP::Thread::dispatch(), HSEP::LT_SYSTEMERROR, HSEP::LT_SYSTEMINFO, and HSEP::LoggerTool::send().

+ Here is the call graph for this function:

HSEP::Service::~Service ( )
virtual

Definition at line 149 of file Service.cpp.

References aName, HSEP::LT_SYSTEMINFO, and HSEP::LoggerTool::send().

+ Here is the call graph for this function:

Member Function Documentation

bool HSEP::Service::_continue ( )
protected

Definition at line 177 of file Service.cpp.

Referenced by body().

+ Here is the caller graph for this function:

int HSEP::Service::body ( )

The body will be executed until a signal is received by the operating system.

Returns

Definition at line 182 of file Service.cpp.

References _continue(), aName, HSEP::LT_SYSTEMERROR, HSEP::LoggerTool::send(), and TerminateHandler.

+ Here is the call graph for this function:

void HSEP::Service::finish ( )

Indicate to the Service that must be finished.

Definition at line 214 of file Service.cpp.

Friends And Related Function Documentation

void TerminateHandler ( int  pSignal)
friend

Definition at line 156 of file Service.cpp.

Referenced by body().

Member Data Documentation

string HSEP::Service::aName
protected

Definition at line 98 of file Service.h.

Referenced by body(), Service(), and ~Service().

int HSEP::Service::aPid
protected

Process ID.

Definition at line 96 of file Service.h.

Referenced by Service().

int HSEP::Service::aSid
protected

Session ID.

Definition at line 97 of file Service.h.

Referenced by Service().


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