diff options
author | alex <alex@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-10-09 05:58:32 +0000 |
---|---|---|
committer | alex <alex@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-10-09 05:58:32 +0000 |
commit | b8179862e57f81b772d2268e1a300c32ab74ba8e (patch) | |
tree | c5d6fc2ed44558ec21d47159c18e5122b335ad68 | |
parent | b1852588075b499bce70a44f07226f5e2fe391fc (diff) | |
download | ATCD-b8179862e57f81b772d2268e1a300c32ab74ba8e.tar.gz |
Defined Linear_Search_OpTable. Zapped the old Linear_Table interface
and the code. GPERF has an option to generate Linear Search code. So
we dont need any code here.
-rw-r--r-- | TAO/tao/Operation_Table.cpp | 75 | ||||
-rw-r--r-- | TAO/tao/Operation_Table.h | 44 |
2 files changed, 27 insertions, 92 deletions
diff --git a/TAO/tao/Operation_Table.cpp b/TAO/tao/Operation_Table.cpp index 698a480b110..1c05f79b323 100644 --- a/TAO/tao/Operation_Table.cpp +++ b/TAO/tao/Operation_Table.cpp @@ -80,75 +80,37 @@ TAO_Dynamic_Hash_OpTable::find (const char *opname, // Linear search strategy -TAO_Linear_OpTable::TAO_Linear_OpTable (const TAO_operation_db_entry *db, - CORBA::ULong dbsize) - : next_ (0), - tablesize_ (dbsize), - tbl_ (new TAO_Linear_OpTable_Entry[dbsize]) +TAO_Linear_Search_OpTable::TAO_Linear_Search_OpTable (void) { - // The job of the constructor is to go thru each entry of the - // database and bind the operation name to its corresponding - // skeleton. - - for (CORBA::ULong i=0; i < dbsize; i++) - // @@ (ASG): what happens if bind fails ??? - (void)this->bind (db[i].opname_, db[i].skel_ptr_); } -TAO_Linear_OpTable::~TAO_Linear_OpTable (void) +TAO_Linear_Search_OpTable::~TAO_Linear_Search_OpTable (void) { - delete [] this->tbl_; } int -TAO_Linear_OpTable::bind (const char *opname, - const TAO_Skeleton skel_ptr) +TAO_Linear_Search_OpTable::bind (const char *opname, + const TAO_Skeleton skel_ptr) { - CORBA::ULong i = this->next_; - - if (i < this->tablesize_) - { - this->tbl_[i].opname_ = CORBA::string_dup (opname); - this->tbl_[i].skel_ptr_ = skel_ptr; - this->next_++; - return 0; // success - } - - return -1; // error + ACE_UNUSED_ARG (opname); + ACE_UNUSED_ARG (skel_ptr); + return 0; } int -TAO_Linear_OpTable::find (const char *opname, - TAO_Skeleton& skel_ptr) +TAO_Linear_Search_OpTable::find (const char *opname, + TAO_Skeleton& skelfunc) { - ACE_ASSERT (this->next_ <= this->tablesize_); - - for (CORBA::ULong i = 0; i < this->next_; i++) - - if (ACE_OS::strncmp (this->tbl_[i].opname_, - opname, - ACE_OS::strlen (opname)) == 0) - { - skel_ptr = this->tbl_[i].skel_ptr_; - return 0; // success - } - - return -1; // not found -} + const TAO_operation_db_entry *entry = lookup (opname); + if (entry == 0) + ACE_ERROR_RETURN ((LM_ERROR, + "TAO_Linear_Search_Table:find failed\n"), + -1); -// constructor -TAO_Linear_OpTable_Entry::TAO_Linear_OpTable_Entry (void) -{ - opname_ = 0; - skel_ptr_ = 0; -} + // Valid entry. Figure out the skel_ptr. + skelfunc = entry->skel_ptr_; -// destructor -TAO_Linear_OpTable_Entry::~TAO_Linear_OpTable_Entry (void) -{ - CORBA::string_free (this->opname_); - this->opname_ = 0; - this->skel_ptr_ = 0; // cannot delete this as we do not own it + return 0; } // Active Demux search strategy @@ -271,8 +233,7 @@ int TAO_Binary_Search_OpTable::find (const char *opname, TAO_Skeleton &skelfunc) { - const TAO_operation_db_entry *entry = lookup (opname, - ACE_OS::strlen (opname)); + const TAO_operation_db_entry *entry = lookup (opname); if (entry == 0) ACE_ERROR_RETURN ((LM_ERROR, "TAO_Binary_Search_Table:find failed\n"), diff --git a/TAO/tao/Operation_Table.h b/TAO/tao/Operation_Table.h index 5a81bef912e..a817789d6b9 100644 --- a/TAO/tao/Operation_Table.h +++ b/TAO/tao/Operation_Table.h @@ -154,39 +154,18 @@ private: // The hash table data structure. }; -class TAO_Export TAO_Linear_OpTable_Entry -{ - // = TITLE - // Table entry for linear search lookup strategy. -public: - CORBA::String opname_; - // holds the operation name - - TAO_Skeleton skel_ptr_; - // Holds a pointer to the skeleton corresponding to the operation - // name. - - TAO_Linear_OpTable_Entry (void); - // constructor. - - ~TAO_Linear_OpTable_Entry (void); - // destructor -}; - -class TAO_Export TAO_Linear_OpTable : public TAO_Operation_Table +class TAO_Export TAO_Linear_Search_OpTable : public TAO_Operation_Table { // = TITLE // Operation table lookup strategy based on // linear search. Not efficient, but it works. public: // = Initialization and termination methods. - TAO_Linear_OpTable (const TAO_operation_db_entry *db, - CORBA::ULong dbsize); - // Initialize the linear search operation table with a database of - // operation names + TAO_Linear_Search_OpTable (void); + // Default constructor. - ~TAO_Linear_OpTable (void); - // destructor. + ~TAO_Linear_Search_OpTable (void); + // Destructor. virtual int find (const char *opname, TAO_Skeleton &skel_ptr); @@ -200,14 +179,9 @@ public: // <{opname}>. Returns -1 on failure, 0 on success, 1 on duplicate. private: - CORBA::ULong next_; - // Keeps track of the next available slot to be filled. - - CORBA::ULong tablesize_; - // Size of the internal table. - - TAO_Linear_OpTable_Entry *tbl_; - // The table itself. + // = Method that should defined by the subclasses. GPERF program + // will generate this routine routines. + virtual const TAO_operation_db_entry* lookup (const char *str) = 0; }; class TAO_Export TAO_Active_Demux_OpTable_Entry @@ -332,7 +306,7 @@ public: private: // = Method that should defined by the subclasses. GPERF program // will generate this routine routines. - virtual const TAO_operation_db_entry* lookup (const char *str, unsigned int len) = 0; + virtual const TAO_operation_db_entry* lookup (const char *str) = 0; }; |