diff options
author | fields_t <fields_t@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2004-02-26 17:12:20 +0000 |
---|---|---|
committer | fields_t <fields_t@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2004-02-26 17:12:20 +0000 |
commit | 0697a969e89ed9686242abe8e9de8aacb75fe473 (patch) | |
tree | 924164f6133bccb233d8b0ef69b5946eb9cd12eb /TAO/tao/ORB_Table.cpp | |
parent | 949adae660ede25bec09ab511443d0100eeecf13 (diff) | |
download | ATCD-0697a969e89ed9686242abe8e9de8aacb75fe473.tar.gz |
Thu Feb 26 10:10:40 MST 2004 Trevor Fields <fields_t@ociweb.com>
Diffstat (limited to 'TAO/tao/ORB_Table.cpp')
-rw-r--r-- | TAO/tao/ORB_Table.cpp | 68 |
1 files changed, 64 insertions, 4 deletions
diff --git a/TAO/tao/ORB_Table.cpp b/TAO/tao/ORB_Table.cpp index e1c8d820d8b..a39e2f2bd2c 100644 --- a/TAO/tao/ORB_Table.cpp +++ b/TAO/tao/ORB_Table.cpp @@ -15,8 +15,11 @@ ACE_RCSID (tao, // **************************************************************** TAO_ORB_Table::TAO_ORB_Table (void) - : table_ (TAO_DEFAULT_ORB_TABLE_SIZE), - first_orb_ (0) + : first_orb_not_default_ (0), + table_ (TAO_DEFAULT_ORB_TABLE_SIZE), + first_orb_ (0), + orbs_( 0 ), + num_orbs_( 0 ) { } @@ -48,6 +51,13 @@ TAO_ORB_Table::end (void) return this->table_.end (); } +TAO_ORB_Core* const * +TAO_ORB_Table::get_orbs( size_t& num_orbs ) +{ + num_orbs = this->num_orbs_; + return this->orbs_; +} + int TAO_ORB_Table::bind (const char *orb_id, TAO_ORB_Core *orb_core) @@ -69,8 +79,18 @@ TAO_ORB_Table::bind (const char *orb_id, // reference count on it. (void) orb_core->_incr_refcnt (); - // Only set the "first_orb_" member if the given ORB Core was - // successfully added to the ORB table. + // This is not the first ORB .. but if the current default + // ORB decided not to be the default and there is more than + // one orb then set this orb to be the default ORB. + if ((this->first_orb_ != 0) + && (this->first_orb_not_default_)) + { + this->first_orb_ = orb_core; + this->first_orb_not_default_ = 0; + } + + // Set the "first_orb_" member for the first given ORB Core + // that was successfully added to the ORB table. if (this->first_orb_ == 0) { this->first_orb_ = orb_core; @@ -132,6 +152,46 @@ TAO_ORB_Table::unbind (const char *orb_id) return result; } +void +TAO_ORB_Table::set_default (const char *orb_id) +{ + this->table_.find (orb_id, this->first_orb_); +} + +void +TAO_ORB_Table::not_default (const char *orb_id) +{ + // @@ This method now works for restricted cases. Should work on + // generalizing it. It works if the first ORB that is registered + // decides to not want be the default ORB. Should generalize it to + // handle all cases. + + //check if there is a default ORB already and if + // it is *not* the same as the orb_id thats passed in.. we dont have + // to do anything. + if (this->first_orb_ != 0) + { + if (ACE_OS::strcmp (this->first_orb_->orbid (), orb_id) != 0) + { + // There is another default ORB. No need to change anything + return; + } + else + { + // The ORB with orbid 'orb_id' is the default now. We need + // to change it. + this->first_orb_not_default_ = 1; + } + } +} + +/// Accessor to the underlying table_ +ACE_Hash_Map_Manager_Ex<const char *,TAO_ORB_Core *,ACE_Hash<const char *>,ACE_Equal_To<const char *>,ACE_Null_Mutex> * +TAO_ORB_Table::table (void) +{ + return &this->table_; +} + TAO_ORB_Table * TAO_ORB_Table::instance (void) { |