#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 *const * | get_orbs (size_t &num_orbs) |
::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 | |
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. | |
::TAO_ORB_Core ** | orbs_ |
List of orbs for get_orbs call. | |
size_t | num_orbs_ |
Number of ORBs in the table. |
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.
|
Definition at line 78 of file ORB_Table.h. |
|
Definition at line 81 of file ORB_Table.h. |
|
Definition at line 77 of file ORB_Table.h. |
|
Definition at line 80 of file ORB_Table.h. |
|
Definition at line 76 of file ORB_Table.h. |
|
Definition at line 79 of file ORB_Table.h. |
|
Constructor.
Definition at line 22 of file ORB_Table.cpp. References TAO_DEFAULT_ORB_TABLE_SIZE.
00023 : lock_ (), 00024 first_orb_not_default_ (false), 00025 table_ (TAO_DEFAULT_ORB_TABLE_SIZE), 00026 first_orb_ (0), 00027 orbs_ (0), 00028 num_orbs_ (0) 00029 { 00030 } |
|
|
|
Definition at line 18 of file ORB_Table.inl. Referenced by TAO_ORB_Core::create_object(), TAO_ORB_Core::initialize_object_i(), and unbind().
00019 { 00020 return this->table_.begin (); 00021 } |
|
Definition at line 33 of file ORB_Table.cpp. References ACE_GUARD_RETURN, first_orb_, first_orb_not_default_, and TAO_SYNCH_MUTEX.
00035 { 00036 // Make sure that the supplied ORB core pointer is valid, 00037 // i.e. non-zero. 00038 if (orb_id == 0 || orb_core == 0) 00039 { 00040 errno = EINVAL; 00041 return -1; 00042 }; 00043 00044 value_type const value = 00045 std::make_pair (key_type (orb_id), data_type (orb_core)); 00046 00047 ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, 00048 guard, 00049 this->lock_, 00050 -1); 00051 00052 std::pair<iterator, bool> result = this->table_.insert (value); 00053 00054 if (result.second) 00055 { 00056 // This is not the first ORB, but if the current default ORB 00057 // decided not to be the default and there is more than one ORB 00058 // then set this ORB to be the default. 00059 if (this->first_orb_ != 0 00060 && this->first_orb_not_default_) 00061 { 00062 this->first_orb_ = orb_core; 00063 this->first_orb_not_default_ = false; 00064 } 00065 00066 // Set the "first_orb_" member for the first given ORB Core 00067 // that was successfully added to the ORB table. 00068 if (this->first_orb_ == 0) 00069 { 00070 this->first_orb_ = orb_core; 00071 } 00072 } 00073 00074 return (result.second ? 0 : 1); 00075 } |
|
Definition at line 24 of file ORB_Table.inl. Referenced by TAO_ORB_Core::create_object(), find(), TAO_ORB_Core::initialize_object_i(), set_default(), and unbind().
00025 { 00026 return this->table_.end (); 00027 } |
|
Definition at line 78 of file ORB_Table.cpp. References TAO_ORB_Core::_incr_refcnt(), ACE_GUARD_RETURN, end(), and TAO_SYNCH_MUTEX.
00079 { 00080 TAO_ORB_Core * orb_core = 0; 00081 00082 ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, 00083 guard, 00084 this->lock_, 00085 0); 00086 00087 iterator const i = this->table_.find (Table::key_type (orb_id)); 00088 00089 // Maintain ownership of the ORB_Core. 00090 if (i != this->end ()) 00091 { 00092 orb_core = (*i).second.core (); 00093 (void) orb_core->_incr_refcnt (); 00094 } 00095 00096 return orb_core; 00097 } |
|
Return |
|
Obtain the first ORB for the Definition at line 12 of file ORB_Table.inl. References first_orb_. Referenced by TAO_ORB_Core_instance().
00013 { 00014 return this->first_orb_; 00015 } |
|
Definition at line 30 of file ORB_Table.inl. References num_orbs_, and orbs_.
|
|
Return a unique instance.
Definition at line 177 of file ORB_Table.cpp. References TAO_Singleton< TYPE, ACE_LOCK >::instance(). Referenced by TAO_ORB_Core::create_object(), TAO_ORB_Core::destroy(), TAO_ORB_Core::initialize_object_i(), TAO_ORB_Core::not_default(), CORBA::ORB_init(), TAO_ORB_Core::set_default(), and TAO_ORB_Core_instance().
00178 { 00179 return TAO_Singleton<TAO::ORB_Table, TAO_SYNCH_MUTEX>::instance (); 00180 } |
|
Return reference to underlying lock.
Definition at line 44 of file ORB_Table.inl.
00045 { 00046 return this->lock_; 00047 } |
|
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 145 of file ORB_Table.cpp. References ACE_GUARD, first_orb_, first_orb_not_default_, ACE_OS::strcmp(), and TAO_SYNCH_MUTEX. Referenced by TAO_ORB_Core::not_default().
00146 { 00147 // @@ This method now works for restricted cases. Should work on 00148 // generalizing it. It works if the first ORB that is registered 00149 // decides to not want be the default ORB. Should generalize it 00150 // to handle all cases. 00151 00152 00153 ACE_GUARD (TAO_SYNCH_MUTEX, 00154 guard, 00155 this->lock_); 00156 00157 // Check if there is a default ORB already and if it is *not* the 00158 // same as the orb_id thats passed in. We don't have to do 00159 // anything. 00160 if (this->first_orb_ != 0) 00161 { 00162 if (ACE_OS::strcmp (this->first_orb_->orbid (), orb_id) != 0) 00163 { 00164 // There is another default ORB. No need to change anything 00165 return; 00166 } 00167 else 00168 { 00169 // The ORB with orbid 'orb_id' is the default now. We need 00170 // to change it. 00171 this->first_orb_not_default_ = true; 00172 } 00173 } 00174 } |
|
|
|
Set the ORB related to the orb_id as the default ORB and not the ORB that is first binded. Definition at line 132 of file ORB_Table.cpp. References ACE_GUARD, end(), first_orb_, and TAO_SYNCH_MUTEX. Referenced by TAO_ORB_Core::set_default().
00133 { 00134 ACE_GUARD (TAO_SYNCH_MUTEX, 00135 guard, 00136 this->lock_); 00137 00138 iterator const i = this->table_.find (key_type (orb_id)); 00139 00140 if (i != this->end ()) 00141 this->first_orb_ = (*i).second.core (); 00142 } |
|
Accessor to the underlying table_.
Definition at line 38 of file ORB_Table.inl.
00039 { 00040 return &this->table_; 00041 } |
|
Definition at line 100 of file ORB_Table.cpp. References ACE_GUARD_RETURN, begin(), TAO::ORB_Core_Ref_Counter::core(), end(), first_orb_, and TAO_SYNCH_MUTEX.
00101 { 00102 ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, 00103 guard, 00104 this->lock_, 00105 -1); 00106 00107 iterator const result = this->table_.find (key_type (orb_id)); 00108 00109 if (result != this->end ()) 00110 { 00111 TAO::ORB_Core_Ref_Counter oc ((*result).second); 00112 00113 this->table_.erase (result); 00114 00115 if (oc.core () == this->first_orb_) 00116 { 00117 if (!this->table_.empty ()) 00118 { 00119 this->first_orb_ = (*this->begin ()).second.core (); 00120 } 00121 else 00122 { 00123 this->first_orb_ = 0; 00124 } 00125 } 00126 } 00127 00128 return 0; 00129 } |
|
The first ORB created by the user.
Definition at line 148 of file ORB_Table.h. Referenced by bind(), first_orb(), not_default(), set_default(), and unbind(). |
|
Variable to check if the first ORB decides not to be the default. Definition at line 142 of file ORB_Table.h. Referenced by bind(), and not_default(). |
|
Lock used to synchronize access to the internal state.
Definition at line 138 of file ORB_Table.h. |
|
Number of ORBs in the table.
Definition at line 157 of file ORB_Table.h. Referenced by get_orbs(). |
|
List of orbs for get_orbs call.
Definition at line 154 of file ORB_Table.h. Referenced by get_orbs(). |
|
The underlying table.
Definition at line 145 of file ORB_Table.h. |