Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

DALT_Client::AgentWatcher Class Reference

This class provides the means of waiting for all agents to finish their processing cycles. More...

#include <agent_watcher.h>

Inheritance diagram for DALT_Client::AgentWatcher:

Inheritance graph
[legend]
Collaboration diagram for DALT_Client::AgentWatcher:

Collaboration graph
[legend]
List of all members.

Public Methods

 AgentWatcher (AgentWatcher *&ref)
 constructor, initializes the semaphore. More...

 ~AgentWatcher ()
 destructor - releases all resources. More...

void agentFinished ()
 marks another agent as finished; this function is called by the agents themselves when they finish a cycle. More...

void addAgentsToWatch (int n)
 instructs the watcher to wait for some more agents. More...

void newCycle ()
 instructs the watcher to start the accounting for a new cycle. More...

unsigned long int getLastCycleTime ()
unsigned long int getAverageCycleTime ()
virtual void run () throw ()
 main loop. More...


Private Attributes

int agents
 how many agents we have to wait for. More...

Semaphore* loop_locker
 semaphore regulating the loop. More...

Mutex rti_mutex
 mutex for accessing rti. More...

Mutex agents_mutex
 mutex for manipulating the number of agents. More...

Mutex l_mon
 sss. More...

bool locker_idle
 bool. More...

CountingSemaphore* agent_sem
 semaphore controlling the main cycle of the watcher. More...

RunTimeInfo rti
 the agent watcher will have to stop this timer when all agents will have finished. More...

AgentWatcher* self_reference
 pointer to be set to NULL upon completion. More...

bool is_new_cycle
 true if this is the first run in a new cycle. More...

bool first_run
 true if this is the first run. More...


Detailed Description

This class provides the means of waiting for all agents to finish their processing cycles.

This is acomplished by running an instance (as a thread) and waiting for it to finish by using join(). The AgentWatcher will wait for all agents to call their finishCycle methods before finishing

Author:
Vlad Mereuta

Definition at line 42 of file agent_watcher.h.


Constructor & Destructor Documentation

DALT_Client::AgentWatcher::AgentWatcher ( AgentWatcher *& ref )
 

constructor, initializes the semaphore.

Parameters:
ref  

DALT_Client::AgentWatcher::~AgentWatcher ( )
 

destructor - releases all resources.


Member Function Documentation

void DALT_Client::AgentWatcher::addAgentsToWatch ( int n )
 

instructs the watcher to wait for some more agents.

Parameters:
n   the number of agents to wait for
Parameters:
n  

void DALT_Client::AgentWatcher::agentFinished ( )
 

marks another agent as finished; this function is called by the agents themselves when they finish a cycle.

unsigned long int DALT_Client::AgentWatcher::getAverageCycleTime ( )
 

unsigned long int DALT_Client::AgentWatcher::getLastCycleTime ( )
 

void DALT_Client::AgentWatcher::newCycle ( )
 

instructs the watcher to start the accounting for a new cycle.

void DALT_Client::AgentWatcher::run ( ) throw () [virtual]
 

main loop.


Member Data Documentation

CountingSemaphore * DALT_Client::AgentWatcher::agent_sem [private]
 

semaphore controlling the main cycle of the watcher.

Definition at line 58 of file agent_watcher.h.

int DALT_Client::AgentWatcher::agents [private]
 

how many agents we have to wait for.

Definition at line 46 of file agent_watcher.h.

Mutex DALT_Client::AgentWatcher::agents_mutex [private]
 

mutex for manipulating the number of agents.

Definition at line 52 of file agent_watcher.h.

bool DALT_Client::AgentWatcher::first_run [private]
 

true if this is the first run.

Definition at line 66 of file agent_watcher.h.

bool DALT_Client::AgentWatcher::is_new_cycle [private]
 

true if this is the first run in a new cycle.

Definition at line 64 of file agent_watcher.h.

Mutex DALT_Client::AgentWatcher::l_mon [private]
 

sss.

Definition at line 54 of file agent_watcher.h.

bool DALT_Client::AgentWatcher::locker_idle [private]
 

bool.

Definition at line 56 of file agent_watcher.h.

Semaphore * DALT_Client::AgentWatcher::loop_locker [private]
 

semaphore regulating the loop.

Definition at line 48 of file agent_watcher.h.

RunTimeInfo DALT_Client::AgentWatcher::rti [private]
 

the agent watcher will have to stop this timer when all agents will have finished.

Definition at line 60 of file agent_watcher.h.

Mutex DALT_Client::AgentWatcher::rti_mutex [private]
 

mutex for accessing rti.

Definition at line 50 of file agent_watcher.h.

AgentWatcher * DALT_Client::AgentWatcher::self_reference [private]
 

pointer to be set to NULL upon completion.

Definition at line 62 of file agent_watcher.h.


The documentation for this class was generated from the following file:
Generated at Thu Jan 31 15:20:18 2002 for DALT Client by doxygen1.2.8 written by Dimitri van Heesch, © 1997-2001