OSB_CORBA::Locators Class Reference

Inheritance diagram for OSB_CORBA::Locators:

Inheritance graph
[legend]
Collaboration diagram for OSB_CORBA::Locators:

Collaboration graph
[legend]
List of all members.

Detailed Description

Servant locator with evictor queue.

Definition at line 58 of file servantlocators.h.

Public Types

Public Member Functions

Static Public Member Functions

Static Public Attributes

Private Types

Private Member Functions

Private Attributes


Member Typedef Documentation

typedef std::map<Key, PortableServer::Servant> OSB_CORBA::Locators::ActiveObjectMap [private]

STL container to store a servant for each servant key.

Definition at line 395 of file servantlocators.h.

typedef std::list<Key> OSB_CORBA::Locators::EvictorQueue [private]

STL container to store list of servant keys in the queue.

Definition at line 392 of file servantlocators.h.

typedef std::pair<unsigned long, unsigned long> OSB_CORBA::Locators::Key

Object id of a servant will consist of two parts.

Definition at line 62 of file servantlocators.h.

typedef OSB_LIB::RwGuard OSB_CORBA::Locators::RwGuard [private]

Just a handy short-cut.

Definition at line 384 of file servantlocators.h.


Constructor & Destructor Documentation

OSB_CORBA::Locators::Locators ( unsigned long  maxSize = 10000  )  [explicit]

OSB_CORBA::Locators::~Locators (  ) 

OSB_CORBA::Locators::Locators ( const Locators  )  [private]

Prevent copying: not implemented.


Member Function Documentation

template<typename T>
PortableServer::Servant OSB_CORBA::Locators::find ( const OSB_LIB::Id2< T > &  id  )  [inline]

Search a servant by OSB_LIB Id2.

Definition at line 292 of file servantlocators.h.

References find(), and makeKey().

template<typename T>
PortableServer::Servant OSB_CORBA::Locators::find ( const OSB_LIB::Id< T > &  id  )  [inline]

Search a servant by OSB_LIB Id.

Definition at line 283 of file servantlocators.h.

References find(), and makeKey().

PortableServer::Servant OSB_CORBA::Locators::find ( const Key key  ) 

Search a servant in the STL map by the servant key.

PortableServer::Servant OSB_CORBA::Locators::find ( const Key key,
unsigned long  oid 
)

Search a servant in the STL map.

The function will first check if oid is the part of the servantId, if it is, it will look for the servant in the STL map, else it would throw.

Parameters:
key Key of the servant to be searched for.
oid Unique id of OSB_LIB object.
Returns:
Pointer to servant if servant is found in the map; else return 0.

Referenced by find().

unsigned long OSB_CORBA::Locators::increaseCounter (  )  [private]

Increase counter for servants.

Referenced by regServantInc().

CORBA::Boolean OSB_CORBA::Locators::isEqual ( const Key key,
unsigned long  oid 
) [private]

Check if oid is part of servant id.

An object id of a servant consists of an object id of the object and a sequence number. This function checks if the parameter oid is the same as the object id part of the servant id.

Parameters:
key Object id of the servant.
oid Object id of object in the library.
Returns:
true if object id is the same as the object id part of the servant else return false.

static PortableServer::ObjectId_var OSB_CORBA::Locators::keyToOid ( const Key key  )  [static]

Convert a servant key to CORBA object id.

Parameters:
key The servant key.
Returns:
The corba object id.

template<typename T>
static Key OSB_CORBA::Locators::makeKey ( const OSB_LIB::Id2< T > &  id  )  [inline, static]

Create a servant key from an OSB_LIB Id2.

The servant key consists of 2 parts. The id1 of Id2 becomes the first part, the id2 of Id2 becomes the second part.

Parameters:
id The OSB_LIB Id2.
Returns:
The servant key.

Definition at line 115 of file servantlocators.h.

References makeKey().

template<typename T>
static Key OSB_CORBA::Locators::makeKey ( const OSB_LIB::Id< T > &  id  )  [inline, static]

Create a servant key from an OSB_LIB Id.

The servant key consists of 2 parts. The value of the Id becomes the first part, the send part is filled as 0.

Parameters:
id The OSB_LIB Id.
Returns:
The servant key.

Definition at line 100 of file servantlocators.h.

References makeKey().

static Key OSB_CORBA::Locators::makeKey ( long  k1,
long  k2 = 0 
) [static]

Create a servant key from two integer values.

The servant key consists of 2 parts. If the k2 is omitted, the second part is filled as 0.

Parameters:
k1 The integer value for 1st part of servant key.
k2 The integer value for 2nd part of servant key.
Returns:
The converted servant key.

Referenced by find(), makeKey(), regServant(), and regServantInc().

Key OSB_CORBA::Locators::oidToKey ( const PortableServer::ObjectId &  oid  )  throw (OsbCorbaException) [private]

Convert an PortableServer::ObjectId to a servant locator key.

Parameters:
oid Object id to be converted.
Returns:
String after successful conversion.
Exceptions:
OsbCorbaException internal error -1 if conversion fails.

Locators& OSB_CORBA::Locators::operator= ( const Locators  )  [private]

Prevent assignment: not implemented.

virtual void OSB_CORBA::Locators::postinvoke ( const PortableServer::ObjectId &  oid,
PortableServer::POA_ptr  poa,
const char *  operation,
void *  cookie,
PortableServer::Servant  servant 
) throw (CORBA::SystemException) [virtual]

This function is not used at all.

virtual PortableServer::Servant OSB_CORBA::Locators::preinvoke ( const PortableServer::ObjectId &  oid,
PortableServer::POA_ptr  poa,
const char *  operation,
void *&  cookie 
) throw ( CORBA::SystemException, PortableServer::ForwardRequest ) [virtual]

This function maintains the position of the servants in the queue.

Each time the servant is used, it is moved to the front of the queue.

Parameters:
oid Object id of the servant.
poa Not used.
operation Only used for debug messages.
cookie Not used.
Exceptions:
SystemException if the servant is not found in queue.

RwGuard OSB_CORBA::Locators::readlock (  )  [private]

Read lock the locator.

Key OSB_CORBA::Locators::registerServant ( Key  key,
PortableServer::Servant  servant 
) [private]

Register a read-only servant with the locator.

This function is the only way a new servant can be inserted into the locator queue. The servant at the end of the queue is deleted if the queue is full.

Parameters:
key The servant key used for registering servant.
servant Pointer to the newly created servant.
Exceptions:
OsbCorbaException 
  • in case the servant with the same key generated for this new servant already exists.

Referenced by regServant(), and regServantInc().

Key OSB_CORBA::Locators::regServant ( PortableServer::Servant  servant  ) 

Register a servant with the locator.

Only the internal sequence number is used while creating servant key.

Parameters:
servant Pointer to the newly created servant.
Returns:
The unique key created for this servant.
Exceptions:
OsbCorbaException 
  • in case the servant with the same key generated for this new servant already exists.

template<typename T>
Key OSB_CORBA::Locators::regServant ( const OSB_LIB::Id< T > &  id,
PortableServer::Servant  servant 
) [inline]

Register a read-only servant with the locator.

Parameters:
id The OSB object id used for creating servant key.
servant Pointer to the newly created servant.
Returns:
The unique key created for this servant.
Exceptions:
OsbCorbaException 
  • in case the servant with the same key generated for this new servant already exists.

Definition at line 167 of file servantlocators.h.

References makeKey(), and registerServant().

template<typename T>
Key OSB_CORBA::Locators::regServant ( const OSB_LIB::Id2< T > &  id,
PortableServer::Servant  servant 
) [inline]

Register a read-only servant with the locator.

Parameters:
id Consist of id1 and id2 which will make up the servant key.
servant Pointer to the newly created servant.
Returns:
The unique key created for this servant.
Exceptions:
OsbCorbaException 
  • in case the servant with the same key generated for this new servant already exists.

Definition at line 146 of file servantlocators.h.

References makeKey(), and registerServant().

Key OSB_CORBA::Locators::regServantInc ( PortableServer::Servant  servant  ) 

Register a servant with the locator, increasing the internal counter.

Only the internal sequence number is used while creating servant key.

Parameters:
servant Pointer to the newly created servant.
Returns:
The unique key created for this servant.
Exceptions:
OsbCorbaException if the key as generated for this new servant already exists.

template<typename T>
Key OSB_CORBA::Locators::regServantInc ( const OSB_LIB::Id< T > &  id,
PortableServer::Servant  servant 
) [inline]

Register a servant with the locator, increasing the internal counter.

In OSB, all writer servants own a local copy of the respective object. To ensure no duplicated servant keys are created for them, the internal sequence number is used as part of the servant key.

The object id, passed here, is used to construct the first part of the servant key; while the second part is filled by internal sequence number.

This function should also be used to register multiple servants with the same object id. This is, e.g., the case if each client works against its own servants.

Parameters:
id The integer value used for creating the servant key.
servant Pointer to the newly created servant.
Returns:
The unique key created for this servant.
Exceptions:
OsbCorbaException if the key as generated for this new servant already exists.

Definition at line 217 of file servantlocators.h.

References increaseCounter(), makeKey(), and registerServant().

void OSB_CORBA::Locators::unregServant ( const Key key,
bool  destroy 
)

Unregister a servant with the locator.

Parameters:
key Key of the servant to remove.
destroy Flag to delete the servant, see below.
If destroy is true, the destructor of the servant is called provided that key is found in the servantMap_.

If destroy is false, the caller is responsible to call the destructor of the servant. This is typically the case if the function is called from the servant's destructor.

RwGuard OSB_CORBA::Locators::writelock (  )  [private]

Write lock the locator.


Member Data Documentation

unsigned long OSB_CORBA::Locators::count_ [private]

Count created servants without object ids.

Definition at line 403 of file servantlocators.h.

EvictorQueue OSB_CORBA::Locators::evictorQ_ [private]

Servant queue.

Definition at line 407 of file servantlocators.h.

const std::string OSB_CORBA::Locators::IFC [static]

The string representation of Locators class.

Definition at line 66 of file servantlocators.h.

bool OSB_CORBA::Locators::inDtor_ [private]

Definition at line 405 of file servantlocators.h.

unsigned long OSB_CORBA::Locators::maxSize_ [private]

Maximum size of the servant queue.

Definition at line 401 of file servantlocators.h.

OSB_LIB::RwMutex OSB_CORBA::Locators::mutex_ [private]

Mutex for multi-user handling.

Definition at line 398 of file servantlocators.h.

ActiveObjectMap OSB_CORBA::Locators::servantMap_ [private]

Map key -> servant.

Definition at line 409 of file servantlocators.h.


The documentation for this class was generated from the following file:
Generated on Sat Sep 2 14:27:13 2006 for OSB Library by  doxygen 1.4.7