A++ » INCLUDE » TMPClient

class TMPClient

 Send a message with a different object to each server.
 Sockets can either be in an "active" or "non-active" state. This method
 activates all the sockets through which the client is connected to the
 workers, and deactivates them when a message is sent to the corresponding
 worker. This way the sockets pertaining to workers who have been left
 idle will be the only ones in the active list
 (TSocket::GetMonitor()->GetListOfActives()) after execution.
 \param code the code of the message to send (e.g. EMPCode)
 \param args
 \parblock
 a vector containing the different messages to be sent. If the size of
 the vector is smaller than the number of workers, a message will be
 sent only to the first args.size() workers. If the size of the args vector
 is bigger than the number of workers, only the first fNWorkers arguments
 will be sent.
 \endparblock
 \return the number of messages successfully sent

Function Members (Methods)

public:
~TMPClient()
unsigned intBroadcast(unsigned int code, unsigned int nMessages = 0)
unsigned intBroadcast<std::vector<unsigned int, std::allocator<unsigned int> > >(unsigned int code, vector<unsigned int> obj, unsigned int nMessages = 0)
unsigned intBroadcast<unsigned int>(unsigned int code, const vector<unsigned int>& args)
unsigned intBroadcast<unsigned int>(unsigned int code, unsigned int obj, unsigned int nMessages = 0)
voidDeActivate(TSocket* s)
boolFork(TMPWorker& server)
boolGetIsParent() const
TMonitor&GetMonitor()
unsigned intGetNWorkers() const
voidHandleMPCode(MPCodeBufPair& msg, TSocket* sender)
TMPClient&operator=(const TMPClient&)
voidReapWorkers()
voidRemove(TSocket* s)
voidSetNWorkers(unsigned int n)
TMPClient(unsigned int nWorkers = 0)
TMPClient(const TMPClient&)

Data Members

private:
boolfIsParentThis is true if this is the parent/client process, false if this is a child/worker process
TMonitorfMonThis object manages the sockets and detect socket events via TMonitor::Select
unsigned intfNWorkersThe number of workers that should be spawned upon forking
vector<pid_t>fWorkerPidsA vector containing the PIDs of children processes/workers

Class Charts

Inheritance Chart:
TMPClient
ROOT::TProcessExecutor

Function documentation

unsigned Broadcast(unsigned int code, unsigned int nMessages = 0)
explicit TMPClient(unsigned nWorkers = 0)
~TMPClient()
it doesn't make sense to copy a TMPClient
TMPClient(const TMPClient& )
TMPClient & operator=(const TMPClient& )
bool Fork(TMPWorker& server)
TMonitor & GetMonitor()
{ return fMon; }
bool GetIsParent() const
 Set the number of workers that will be spawned by the next call to Fork()
{ return fIsParent; }
void SetNWorkers(unsigned int n)
{ fNWorkers = n; }
unsigned GetNWorkers() const
{ return fNWorkers; }
void DeActivate(TSocket* s)
void Remove(TSocket* s)
void ReapWorkers()
void HandleMPCode(MPCodeBufPair& msg, TSocket* sender)