Dynamic Hashing scheme for CORBA IDL operation name lookup. More...
#include <Operation_Table_Dynamic_Hash.h>
Public Member Functions | |
TAO_Dynamic_Hash_OpTable (const TAO_operation_db_entry *db, CORBA::ULong dbsize, CORBA::ULong hashtblsize, ACE_Allocator *alloc) | |
~TAO_Dynamic_Hash_OpTable (void) | |
Destructor. | |
virtual int | bind (const char *opname, const TAO::Operation_Skeletons skel_ptr) |
See the documentation in the base class for details. | |
virtual int | find (const char *opname, TAO_Skeleton &skelfunc, const unsigned int length=0) |
virtual int | find (const char *opname, TAO_Collocated_Skeleton &skelfunc, TAO::Collocation_Strategy s, const unsigned int length=0) |
Private Types | |
typedef ACE_Hash_Map_Manager_Ex< const char *, TAO::Operation_Skeletons, ACE_Hash< const char * > , ACE_Equal_To< const char * > , ACE_Null_Mutex > | OP_MAP_MANAGER |
Private Attributes | |
OP_MAP_MANAGER | hash_ |
The hash table data structure. |
Dynamic Hashing scheme for CORBA IDL operation name lookup.
Definition at line 36 of file Operation_Table_Dynamic_Hash.h.
typedef ACE_Hash_Map_Manager_Ex<const char *, TAO::Operation_Skeletons, ACE_Hash<const char *>, ACE_Equal_To<const char *>, ACE_Null_Mutex> TAO_Dynamic_Hash_OpTable::OP_MAP_MANAGER [private] |
Definition at line 75 of file Operation_Table_Dynamic_Hash.h.
TAO_Dynamic_Hash_OpTable::TAO_Dynamic_Hash_OpTable | ( | const TAO_operation_db_entry * | db, | |
CORBA::ULong | dbsize, | |||
CORBA::ULong | hashtblsize, | |||
ACE_Allocator * | alloc | |||
) |
Initialize the dynamic hash operation table with a database of operation names. The hash table size may be different from the size of the database. Hence we use the third argument to specify the size of the internal hash table. The <alloc> argument is used to determine where the memory comes from (usually from <ACE_Static_Allocator_Base>).
Definition at line 35 of file Operation_Table_Dynamic_Hash.cpp.
: hash_ (hashtblsize, alloc) { // Iterate thru each entry in the database and bind the operation // name to its corresponding skeleton. for (CORBA::ULong i = 0; i < dbsize; ++i) { TAO::Operation_Skeletons s; s.skel_ptr = db[i].skel_ptr; s.thruPOA_skel_ptr = db[i].skel_ptr; s.direct_skel_ptr = db[i].direct_skel_ptr; // @@ (ASG): what happens if bind fails ??? if (this->bind (db[i].opname, s) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n"), ACE_TEXT ("bind failed"))); } }
TAO_Dynamic_Hash_OpTable::~TAO_Dynamic_Hash_OpTable | ( | void | ) |
Destructor.
Definition at line 59 of file Operation_Table_Dynamic_Hash.cpp.
{ // Initialize an iterator. We need to go thru each entry and free // up storage allocated to hold the external ids. In this case, // these are strings. OP_MAP_MANAGER::ITERATOR iterator (this->hash_); for (OP_MAP_MANAGER::ENTRY *entry = 0; iterator.next (entry) != 0; iterator.advance ()) { // We had allocated memory and stored the string. So we free the // memory. CORBA::string_free ((char *) entry->ext_id_); entry->ext_id_ = 0; } }
int TAO_Dynamic_Hash_OpTable::bind | ( | const char * | opname, | |
const TAO::Operation_Skeletons | skel_ptr | |||
) | [virtual] |
See the documentation in the base class for details.
Implements TAO_Operation_Table.
Definition at line 78 of file Operation_Table_Dynamic_Hash.cpp.
{ return this->hash_.bind (CORBA::string_dup (opname), skel_ptr); }
int TAO_Dynamic_Hash_OpTable::find | ( | const char * | opname, | |
TAO_Collocated_Skeleton & | skelfunc, | |||
TAO::Collocation_Strategy | s, | |||
const unsigned int | length = 0 | |||
) | [virtual] |
Uses opname to look up the collocated skeleton function and pass it back in skelfunc. Returns non-negative integer on success, or -1 on failure.
Implements TAO_Operation_Table.
Definition at line 106 of file Operation_Table_Dynamic_Hash.cpp.
{ ACE_FUNCTION_TIMEPROBE (TAO_DYNAMIC_HASH_OPTABLE_FIND_START); TAO::Operation_Skeletons skel; int retval = this->hash_.find ((const char *)opname, skel); if (retval != -1) { switch (s) { case TAO::TAO_CS_DIRECT_STRATEGY: skel_ptr = skel.direct_skel_ptr; break; default: return -1; } } return retval; }
int TAO_Dynamic_Hash_OpTable::find | ( | const char * | opname, | |
TAO_Skeleton & | skelfunc, | |||
const unsigned int | length = 0 | |||
) | [virtual] |
Uses opname to look up the skeleton function and pass it back in skelfunc. Returns non-negative integer on success, or -1 on failure.
Implements TAO_Operation_Table.
Definition at line 86 of file Operation_Table_Dynamic_Hash.cpp.
{ ACE_FUNCTION_TIMEPROBE (TAO_DYNAMIC_HASH_OPTABLE_FIND_START); TAO::Operation_Skeletons s; int retval = this->hash_.find ((const char *)opname, s); if (retval != -1) { skel_ptr = s.skel_ptr; } return retval; }
The hash table data structure.
Definition at line 78 of file Operation_Table_Dynamic_Hash.h.