#include <ORB_Table.h>
Collaboration diagram for TAO::ORB_Table:
Public Types | |
typedef ACE_Array_Map< CORBA::String_var, ORB_Core_Ref_Counter, TAO::String_Var_Equal_To > | Table |
typedef Table::key_type | key_type |
typedef Table::data_type | data_type |
typedef Table::value_type | value_type |
typedef Table::size_type | size_type |
typedef Table::iterator | iterator |
Public Member Functions | |
ORB_Table (void) | |
Constructor. | |
::TAO_ORB_Core * | first_orb (void) |
void | set_default (char const *orb_id) |
void | not_default (char const *orb_id) |
Table * | table (void) |
Accessor to the underlying table_. | |
TAO_SYNCH_MUTEX & | lock (void) |
Return reference to underlying lock. | |
The canonical ACE_Map methods. | |
iterator | begin (void) |
iterator | end (void) |
int | bind (const char *orb_id,::TAO_ORB_Core *orb_core) |
::TAO_ORB_Core * | find (const char *orb_id) |
int | unbind (const char *orb_id) |
Static Public Member Functions | |
static ORB_Table * | instance (void) |
Return a unique instance. | |
Private Member Functions | |
ORB_Table (const ORB_Table &) | |
void | operator= (const ORB_Table &) |
::TAO_ORB_Core * | find_i (char const *orb_id) |
Private Attributes | |
::TAO_SYNCH_MUTEX | lock_ |
Lock used to synchronize access to the internal state. | |
bool | first_orb_not_default_ |
Table | table_ |
The underlying table. | |
::TAO_ORB_Core * | first_orb_ |
The first ORB created by the user. |
CORBA::ORB_init() is supposed to return the same ORB if the user specifies the same ORBid, either in the ORB_init() parameter or in the -ORBid option. This class is used to implement that feature. It is also useful when trying to determine if an object reference is collocated or not.
Definition at line 63 of file ORB_Table.h.
typedef Table::data_type TAO::ORB_Table::data_type |
Definition at line 78 of file ORB_Table.h.
typedef Table::iterator TAO::ORB_Table::iterator |
Definition at line 81 of file ORB_Table.h.
typedef Table::key_type TAO::ORB_Table::key_type |
Definition at line 77 of file ORB_Table.h.
typedef Table::size_type TAO::ORB_Table::size_type |
Definition at line 80 of file ORB_Table.h.
typedef ACE_Array_Map<CORBA::String_var, ORB_Core_Ref_Counter, TAO::String_Var_Equal_To> TAO::ORB_Table::Table |
Definition at line 76 of file ORB_Table.h.
typedef Table::value_type TAO::ORB_Table::value_type |
Definition at line 79 of file ORB_Table.h.
TAO_BEGIN_VERSIONED_NAMESPACE_DECL TAO::ORB_Table::ORB_Table | ( | void | ) |
Constructor.
Definition at line 22 of file ORB_Table.cpp.
00023 : lock_ (), 00024 first_orb_not_default_ (false), 00025 table_ (TAO_DEFAULT_ORB_TABLE_SIZE), 00026 first_orb_ (0) 00027 { 00028 }
TAO::ORB_Table::ORB_Table | ( | const ORB_Table & | ) | [private] |
ACE_INLINE TAO::ORB_Table::iterator TAO::ORB_Table::begin | ( | void | ) |
Definition at line 18 of file ORB_Table.inl.
References ACE_Array_Map< Key, Value, EqualTo >::begin(), begin(), and table_.
Referenced by begin().
00019 { 00020 return this->table_.begin (); 00021 }
int TAO::ORB_Table::bind | ( | const char * | orb_id, | |
::TAO_ORB_Core * | orb_core | |||
) |
ACE_INLINE TAO::ORB_Table::iterator TAO::ORB_Table::end | ( | void | ) |
Definition at line 24 of file ORB_Table.inl.
References ACE_Array_Map< Key, Value, EqualTo >::end(), end(), and table_.
Referenced by end().
00025 { 00026 return this->table_.end (); 00027 }
TAO_ORB_Core * TAO::ORB_Table::find | ( | const char * | orb_id | ) |
Definition at line 76 of file ORB_Table.cpp.
References TAO_ORB_Core::_incr_refcnt(), ACE_GUARD_RETURN, ACE_Array_Map< Key, Value, EqualTo >::find(), find(), table_, and TAO_SYNCH_MUTEX.
Referenced by find().
00077 { 00078 TAO_ORB_Core * orb_core = 0; 00079 00080 ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, 00081 guard, 00082 this->lock_, 00083 0); 00084 00085 iterator const i = this->table_.find (Table::key_type (orb_id)); 00086 00087 // Maintain ownership of the ORB_Core. 00088 if (i != this->end ()) 00089 { 00090 orb_core = (*i).second.core (); 00091 (void) orb_core->_incr_refcnt (); 00092 } 00093 00094 return orb_core; 00095 }
::TAO_ORB_Core* TAO::ORB_Table::find_i | ( | char const * | orb_id | ) | [private] |
Return TAO_ORB_Core
corresponding to ORB with given orb_id. (underlying unlocked implementation).
TAO_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE::TAO_ORB_Core * TAO::ORB_Table::first_orb | ( | void | ) |
Obtain the first ORB for the ORB_Core_instance()
implementation.
Definition at line 12 of file ORB_Table.inl.
References first_orb(), and first_orb_.
Referenced by first_orb().
00013 { 00014 return this->first_orb_; 00015 }
TAO::ORB_Table * TAO::ORB_Table::instance | ( | void | ) | [static] |
Return a unique instance.
Definition at line 175 of file ORB_Table.cpp.
References TAO_Singleton< TYPE, ACE_LOCK >::instance(), and instance().
Referenced by instance().
00176 { 00177 return TAO_Singleton<TAO::ORB_Table, TAO_SYNCH_MUTEX>::instance (); 00178 }
ACE_INLINE TAO_SYNCH_MUTEX & TAO::ORB_Table::lock | ( | void | ) |
void TAO::ORB_Table::not_default | ( | char const * | orb_id | ) |
Method the ORB invokes to specify that it doesnt want to be the default ORB if there are more than one ORB registered.
Definition at line 143 of file ORB_Table.cpp.
References ACE_GUARD, first_orb_not_default_, not_default(), ACE_OS::strcmp(), and TAO_SYNCH_MUTEX.
Referenced by not_default().
00144 { 00145 // @@ This method now works for restricted cases. Should work on 00146 // generalizing it. It works if the first ORB that is registered 00147 // decides to not want be the default ORB. Should generalize it 00148 // to handle all cases. 00149 00150 00151 ACE_GUARD (TAO_SYNCH_MUTEX, 00152 guard, 00153 this->lock_); 00154 00155 // Check if there is a default ORB already and if it is *not* the 00156 // same as the orb_id thats passed in. We don't have to do 00157 // anything. 00158 if (this->first_orb_ != 0) 00159 { 00160 if (ACE_OS::strcmp (this->first_orb_->orbid (), orb_id) != 0) 00161 { 00162 // There is another default ORB. No need to change anything 00163 return; 00164 } 00165 else 00166 { 00167 // The ORB with orbid 'orb_id' is the default now. We need 00168 // to change it. 00169 this->first_orb_not_default_ = true; 00170 } 00171 } 00172 }
void TAO::ORB_Table::operator= | ( | const ORB_Table & | ) | [private] |
void TAO::ORB_Table::set_default | ( | char const * | orb_id | ) |
Set the ORB related to the orb_id as the default ORB and not the ORB that is first binded.
Definition at line 130 of file ORB_Table.cpp.
References ACE_GUARD, ACE_Array_Map< Key, Value, EqualTo >::find(), set_default(), table_, and TAO_SYNCH_MUTEX.
Referenced by set_default().
00131 { 00132 ACE_GUARD (TAO_SYNCH_MUTEX, 00133 guard, 00134 this->lock_); 00135 00136 iterator const i = this->table_.find (key_type (orb_id)); 00137 00138 if (i != this->end ()) 00139 this->first_orb_ = (*i).second.core (); 00140 }
ACE_INLINE TAO::ORB_Table::Table * TAO::ORB_Table::table | ( | void | ) |
int TAO::ORB_Table::unbind | ( | const char * | orb_id | ) |
Definition at line 98 of file ORB_Table.cpp.
References ACE_GUARD_RETURN, ACE_Array_Map< Key, Value, EqualTo >::erase(), ACE_Array_Map< Key, Value, EqualTo >::find(), first_orb_, table_, TAO_SYNCH_MUTEX, and unbind().
Referenced by unbind().
00099 { 00100 ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, 00101 guard, 00102 this->lock_, 00103 -1); 00104 00105 iterator const result = this->table_.find (key_type (orb_id)); 00106 00107 if (result != this->end ()) 00108 { 00109 TAO::ORB_Core_Ref_Counter oc ((*result).second); 00110 00111 this->table_.erase (result); 00112 00113 if (oc.core () == this->first_orb_) 00114 { 00115 if (!this->table_.empty ()) 00116 { 00117 this->first_orb_ = (*this->begin ()).second.core (); 00118 } 00119 else 00120 { 00121 this->first_orb_ = 0; 00122 } 00123 } 00124 } 00125 00126 return 0; 00127 }
::TAO_ORB_Core* TAO::ORB_Table::first_orb_ [private] |
The first ORB created by the user.
Definition at line 146 of file ORB_Table.h.
Referenced by first_orb(), and unbind().
bool TAO::ORB_Table::first_orb_not_default_ [private] |
Variable to check if the first ORB decides not to be the default.
Definition at line 140 of file ORB_Table.h.
Referenced by not_default().
::TAO_SYNCH_MUTEX TAO::ORB_Table::lock_ [private] |
Lock used to synchronize access to the internal state.
Definition at line 136 of file ORB_Table.h.
Referenced by lock().
Table TAO::ORB_Table::table_ [private] |
The underlying table.
Definition at line 143 of file ORB_Table.h.
Referenced by begin(), end(), find(), set_default(), table(), and unbind().