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

DALT_Server::ClientManager Class Reference

This class maintains a complete list of all the registred clients. More...

#include <client_manager.h>

Collaboration diagram for DALT_Server::ClientManager:

Collaboration graph
[legend]
List of all members.

Public Methods

 ClientManager (allocationMethod alloc_method=weighted_random)
 ~ClientManager ()
int addClient (Client *client)
ClientfindClientForEntity (Entity &e) throw (runtime_error)
ClientfindClientForEntity (Entity &e, set< Client *> &excluded) throw (runtime_error)
void setAllocationMethod (allocationMethod method)
void print ()

Public Attributes

map<string,int> agent_cost
vector<Client*> clients

Protected Methods

ClientbestClient (Entity &e, vector< Client *> &to_search)
ClientfindClientForEntity (Entity &e, vector< Client *> &to_search) throw (runtime_error)

Protected Attributes

allocationMethod alloc_method
float total_power

Private Types

enum  allocationMethod { random, weighted_random, best_client }

Detailed Description

This class maintains a complete list of all the registred clients.

It allocates them in groups and tries to redistribute the workload to minimise the number of groups

Author:
Vlad Mereuta


Member Enumeration Documentation

enum DALT_Server::ClientManager::allocationMethod [private]
 

possible client allocation methods.

  • random will return a random client.
  • weighted_random will still be random, but the probability of a client being chosen is proportional to its speed. This should give more agent to the clients with more processing power
  • best_client use a (partially) deterministic algorithm to find the best client for an Entity.
Enumeration values:
random  
weighted_random  
best_client  


Constructor & Destructor Documentation

DALT_Server::ClientManager::ClientManager ( allocationMethod alloc_method = weighted_random )
 

constructor.

Parameters:
alloc_method   the allocationMethod to be used when calling findClientForEntity().
Parameters:
alloc_method  

DALT_Server::ClientManager::~ClientManager ( )
 

destructor - does nothing.


Member Function Documentation

int DALT_Server::ClientManager::addClient ( Client * client )
 

adds a client to the list of available clients.

Parameters:
client   pointer to the client instance to be added
Parameters:
client  

Client * DALT_Server::ClientManager::bestClient ( Entity & e,
vector< Client *> & to_search ) [protected]
 

finds the most suitable client for a given entity.

This assumes that both the entity processing time is fairly constant and that the processing conditions on each client are similar. If this is not the case in the simulation then use one of the other (random) allocation methods provided, as they might yield better results

Parameters:
e  
to_search  

Client * DALT_Server::ClientManager::findClientForEntity ( Entity & e,
set< Client *> & excluded ) throw (runtime_error)
 

finds the most suitable client for an Entity.

Parameters:
e   the Entity which needs a client
excluded   a set containing Clients which are to be excluded from the allocation
Returns:
pointer to the most suitable Client
Parameters:
e  
excluded  

Client * DALT_Server::ClientManager::findClientForEntity ( Entity & e ) throw (runtime_error)
 

finds the most suitable client for an Entity (searching through all available clients).

Parameters:
e   the Entity which needs a client
Returns:
pointer to the most suitable Client
Parameters:
e  

Client * DALT_Server::ClientManager::findClientForEntity ( Entity & e,
vector< Client *> & to_search ) throw (runtime_error) [protected]
 

finds the most suitable client for an Entity.

Parameters:
e   the Entity which needs a client
to_search   vector of clients to search through
Returns:
pointer to the most suitable Client
Parameters:
e  
to_search  

void DALT_Server::ClientManager::print ( )
 

prints on stdout the current client allocation.

void DALT_Server::ClientManager::setAllocationMethod ( allocationMethod method )
 

sets the allocation method used by findClientForEntity.

Parameters:
method   the method to be used
Parameters:
method  


Member Data Documentation

map< string, int > DALT_Server::ClientManager::agent_cost
 

the time taken by an agent on the reference machine for benchmarks; the agents are specified by their types.

The time is obtained by averaging the times reported by clients for each type of agent.

allocationMethod DALT_Server::ClientManager::alloc_method [protected]
 

possible client allocation methods - see ClientManager::ClientManager for details.

vector< Client *> DALT_Server::ClientManager::clients
 

list of all clients.

float DALT_Server::ClientManager::total_power [protected]
 

total processing power of all clients.


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