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

Base thread that must be inherited to provide useful functionality to a service. More...

#include <Service.h>

+ Inheritance diagram for HSEP::ServiceThread:
+ Collaboration diagram for HSEP::ServiceThread:

Public Member Functions

 ServiceThread (string pName)
 
virtual ~ServiceThread ()
 
const string & statusRef () const
 
void log (string pData)
 
- Public Member Functions inherited from HSEP::Thread
 Thread (const char *pType)
 
virtual ~Thread ()
 
const char * namePtr () const
 
bool dispatch ()
 Lets the thread to start working.
 
int join ()
 Wait until the internal thread's memory structures are finished.
 
void finish ()
 Advise the thread for not continuing executing the perform method.
 
bool finishRequested () const
 Indicates if a finish was executed on this thread.
 
void relocate (string pDestination)
 Moves the thread to the specified destination.
 
- Public Member Functions inherited from HSEP::HSEPObject
string & lastErrorRef ()
 Returns a reference to the last stored error message.
 
ErrorCode lastCode ()
 Returns the last stored code.
 
bool valid ()
 Permits to know if the object has a valid internal state.
 
string & typeRef ()
 Permits to know the type of this particular object.
 

Protected Member Functions

virtual bool prepare ()
 Provides a placeholder for the class to initialize internal data.
 
virtual void dispose ()
 If the prepare and perform method where successful, the dispose must deinitialize everything was initialized during the prepare method.
 
- Protected Member Functions inherited from HSEP::Thread
 Thread (const char *pType, string &pReceivedState)
 This is the protected constructor will be used by the distributed rebuilder.
 
virtual int perform ()=0
 Performs the internal processing cycle for the thread.
 
virtual void d_packState (string &pStateData)
 Permits to package the thread contents to be send to another process or computer to continue working.
 
virtual bool d_sendToDestination (string &pStateData)
 Sends the thread state to the destination.
 
virtual void d_restoreState (string &pSource)
 Rebuilds the internal state for the thread.
 
- Protected Member Functions inherited from HSEP::HSEPObject
 HSEPObject (const char *pType)
 Constructor, providing the base for the state controlling instance.
 
virtual ~HSEPObject ()
 
void setLastError (string &pErrorMsgRef)
 Assigns an error message text to the last executed operation.
 
void setLastError (const string &pErrorMsgRef)
 Assigns an error message text to the last executed operation.
 
void setLastError (const char *pErrorMsg)
 Assigns an error message text to the last executed operation.
 
void setValid ()
 Defines that the object has a valid state.
 
void setInvalid ()
 Defines that the object has an invalid state.
 
void setLastCode (const ErrorCode pErrorCode)
 Defines the internal result code for the object.
 

Additional Inherited Members

- Protected Attributes inherited from HSEP::Thread
Mutex aMutex
 

Detailed Description

Base thread that must be inherited to provide useful functionality to a service.

The corresponding derived thread must be provided by the ServiceThreadFactory class.

Definition at line 40 of file Service.h.

Constructor & Destructor Documentation

HSEP::ServiceThread::ServiceThread ( string  pName)

Definition at line 76 of file Service.cpp.

HSEP::ServiceThread::~ServiceThread ( )
virtual

Definition at line 83 of file Service.cpp.

Member Function Documentation

void HSEP::ServiceThread::dispose ( )
protectedvirtual

If the prepare and perform method where successful, the dispose must deinitialize everything was initialized during the prepare method.

Implements HSEP::Thread.

Definition at line 57 of file Service.cpp.

References HSEP::LT_SYSTEMERROR, and HSEP::LoggerTool::send().

+ Here is the call graph for this function:

void HSEP::ServiceThread::log ( string  pData)

Definition at line 69 of file Service.cpp.

References HSEP::Thread::aMutex.

bool HSEP::ServiceThread::prepare ( )
protectedvirtual

Provides a placeholder for the class to initialize internal data.

Returns
true when the initialization was successful.
false when an error that must avoid the thread to run happened.

Implements HSEP::Thread.

Definition at line 32 of file Service.cpp.

References HSEP::LT_SYSTEMERROR, and HSEP::LoggerTool::send().

+ Here is the call graph for this function:

const string& HSEP::ServiceThread::statusRef ( ) const
inline

Definition at line 54 of file Service.h.


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