Main Page   Modules   Namespace List   Class Hierarchy   Compound List   Namespace Members   Compound Members   Related Pages  

GNE::ObjectBroker Class Reference
[High-Level API]

#include <ObjectBroker.h>

Inheritance diagram for GNE::ObjectBroker:

GNE::ObjectBrokerClient GNE::ObjectBrokerServer List of all members.

Public Member Functions

int numObjects () const
 Returns the number of objects currently being managed by this ObjectBroker.

NetworkObjectgetObjectById (int objId)
 Returns the NetworkObject currently registered with the given object ID.

void deregisterObject (NetworkObject &obj)
 Deregisters the given object entirely from the ObjectBroker.


Protected Types

typedef std::map< int, NetworkObject * > ObjectsMap
typedef std::map< int, NetworkObject
* >::iterator 
ObjectsIter

Protected Member Functions

bool exists (int objId)
 Returns true if the object ID given exists.

void assignId (NetworkObject &o, int newId)
 Assigns the given ID to the object.


Protected Attributes

Mutex sync
ObjectsMap objects
 Associates an integer object ID to a NetworkObject.


Detailed Description

Serves as a base class for ObjectBrokerServer and ObjectBrokerClient and contains common functionality. This class is abstract, so you cannot instantiate it.


Member Function Documentation

void GNE::ObjectBroker::deregisterObject NetworkObject obj  ) 
 

Deregisters the given object entirely from the ObjectBroker.

The ID of the object is set to an invalid ID, and the onDeregistration event is called. Once deregistered, an object must be reregistered before it can be used with the ObjectBroker again.

Note that in ObjectBrokerClient, processing an ObjectDeathPacket automatically deregisteres an object, so this method is most useful with ObjectBrokerServer.

Parameters:
obj a valid NetworkObject (one that has been assigned a valid ID).
See also:
NetworkObject::onDeregistration

bool GNE::ObjectBroker::exists int  objId  )  [protected]
 

Returns true if the object ID given exists.

The mutex sync must be locked when this method is called.

NetworkObject * GNE::ObjectBroker::getObjectById int  objId  ) 
 

Returns the NetworkObject currently registered with the given object ID.

Returns NULL if there is no object with that ID.


The documentation for this class was generated from the following files:
Generated on Fri Aug 22 13:40:06 2003 for GNE by doxygen1.3