#include <mcs.hh>
An object of this class will be automatically istantiated from the Server object. If this class is not derived its run() method (running in its own thread) will forward any Data object in the "send" Record to the corresponding UserThread object. You can also derive this class to do all the necessary "local" (which means server-side work such as database insertion or mainteinance, software updates, or everything is necessary to your information service.
This class can also be used to monitor clients activities using the hk_log() method, which is a virtual method called each time the BaseThread.Log() is executed. Since all clients activities are logged you can overload this method to perform monitoring.
Definition at line 6758 of file mcs.hh.
Public Member Functions | |
virtual void | hk_log (UserThread *p, Event e) |
Virtual method called each time the BaseThread.Log() method is executed. | |
LocalThread (Thread *parent) | |
Constructor. | |
LocalThread (const LocalThread &) | |
Declared to avoid using of default copy constructor. | |
LocalThread & | operator= (const LocalThread &) |
Declared to avoid using of default assignment operator. | |
~LocalThread () | |
Destructor. | |
Public Attributes | |
Record | recv |
Record of Data objects received from other threads. | |
Protected Member Functions | |
void | dataDispatcher () |
Dispatch Data objects in the "send" vector to UserThread object's "send" vectors. | |
UserThread ** | serverClients () |
Returns the Server.pClient variable. | |
bool | userID2clientID (int userid, int *cid) |
Search for a client ID (CID) associated with a destination ID. | |
Protected Attributes | |
UserThread ** | client |
Private Member Functions | |
virtual void | run () |
Thread body. | |
Private Attributes | |
MCS_DEBUG_ALLOC |
mcs::LocalThread::LocalThread | ( | const LocalThread & | ) |
Declared to avoid using of default copy constructor.
mcs::LocalThread::LocalThread | ( | Thread * | parent | ) |
Constructor.
This method simply pass the parameter to its parent class constructor (BaseThread).
Definition at line 28 of file LocalThread.cc.
mcs::LocalThread::~LocalThread | ( | ) |
void mcs::LocalThread::dataDispatcher | ( | ) | [protected] |
Dispatch Data objects in the "send" vector to UserThread object's "send" vectors.
This method will extract objects from the "send" vector and put them in the "send" vector of the corresponding UserThread object (see mcsid() method).
Definition at line 65 of file LocalThread.cc.
void mcs::LocalThread::hk_log | ( | UserThread * | p, | |
Event | e | |||
) | [virtual] |
Virtual method called each time the BaseThread.Log() method is executed.
This method calls the cb_log() and cbwa_log() callback functions if defined. If you overload this method the callback functions won't be called anymore.
This method can be overloadd to monitor client activities, since each command and server reply are logged.
p | Address of the UserThread object whose logging; | |
e | Event object describing what has been logged. |
Definition at line 110 of file LocalThread.cc.
LocalThread& mcs::LocalThread::operator= | ( | const LocalThread & | ) |
Declared to avoid using of default assignment operator.
void mcs::LocalThread::run | ( | ) | [private, virtual] |
Thread body.
This method can be overloadd to customize the "local" behaviour of the server. In this class then run() method wait until there are some Data object in the "send" vector. When an object appear it will call the dataDispatcher() method.
Reimplemented from mcs::Thread.
Definition at line 90 of file LocalThread.cc.
UserThread ** mcs::LocalThread::serverClients | ( | ) | [protected] |
bool mcs::LocalThread::userID2clientID | ( | int | userid, | |
int * | cid | |||
) | [protected] |
Search for a client ID (CID) associated with a destination ID.
Client ID (CID) are the positions in the Server.pClient array that holds the address of UserThread objects associated with the client. Each Data object has a destination ID (Data.getDest() method) and each UserThread object has a destination ID (UserThread.getDestinationId() method). This method search the client ID (CID) associated with the UserThread object whose destination ID is equal to the destination ID of the Data object passed as parameter.
d | Data object; | |
id | Address of an object where the client ID (CID) will be stored. |
Definition at line 45 of file LocalThread.cc.
![]() |
MCS (My Customizable Server) ver. 0.3.3-alpha3
|