#include <Storable_Naming_Context.h>
Inheritance diagram for TAO_Storable_Bindings_Map:
Public Types | |
typedef ACE_Hash_Map_Manager< TAO_Storable_ExtId, TAO_Storable_IntId, ACE_Null_Mutex > | HASH_MAP |
Underlying data structure - typedef for ease of use. | |
Public Member Functions | |
TAO_Storable_Bindings_Map (size_t hash_table_size, CORBA::ORB_ptr orb) | |
Constructor. | |
virtual | ~TAO_Storable_Bindings_Map (void) |
Destructor. | |
HASH_MAP & | map (void) |
Get a reference to the underlying hash map. | |
size_t | total_size (void) |
Return the size of the underlying hash table. | |
virtual size_t | current_size (void) |
virtual int | bind (const char *id, const char *kind, CORBA::Object_ptr obj, CosNaming::BindingType type) |
virtual int | rebind (const char *id, const char *kind, CORBA::Object_ptr obj, CosNaming::BindingType type) |
virtual int | unbind (const char *id, const char *kind) |
virtual int | find (const char *id, const char *kind, CORBA::Object_ptr &obj, CosNaming::BindingType &type) |
Private Member Functions | |
int | shared_bind (const char *id, const char *kind, CORBA::Object_ptr obj, CosNaming::BindingType type, int rebind) |
Helper: factors common code from and . | |
Private Attributes | |
HASH_MAP | map_ |
Hash map used for storage. | |
CORBA::ORB_var | orb_ |
A thin wrapper on top of ACE_Hash_Map_Manager. Supports TAO_Bindings_Map interface. Used by TAO_Transient_Naming_Context.
Definition at line 119 of file Storable_Naming_Context.h.
|
Underlying data structure - typedef for ease of use.
Definition at line 126 of file Storable_Naming_Context.h. |
|
Constructor.
Definition at line 188 of file Storable_Naming_Context.cpp. References ACE_TRACE.
|
|
Destructor.
Definition at line 196 of file Storable_Naming_Context.cpp. References ACE_TRACE.
00197 { 00198 ACE_TRACE("~TAO_Storable_Bindings_Map"); 00199 } |
|
Add a binding with the specified parameters to the table. Return 0 on success and -1 on failure, 1 if there already is a binding with and . Implements TAO_Bindings_Map. Definition at line 146 of file Storable_Naming_Context.cpp. References ACE_TRACE, and shared_bind(). Referenced by TAO_Storable_Naming_Context::load_map().
00150 { 00151 ACE_TRACE("bind"); 00152 return this->shared_bind (id, kind, obj, type, 0); 00153 } |
|
Return current number of entries (name bindings) in the underlying hash map. Implements TAO_Bindings_Map. Definition at line 209 of file Storable_Naming_Context.cpp. References ACE_TRACE. Referenced by TAO_Storable_Naming_Context::Write().
|
|
Find the binding containing and in the table, and pass binding's type and object back to the caller by reference. Return 0 on success and -1 on failure. Note: a 'duplicated' object reference is assigned to , so the caller is responsible for its deallocation. Implements TAO_Bindings_Map. Definition at line 166 of file Storable_Naming_Context.cpp. References ACE_TRACE, TAO_Storable_IntId::ref_, and TAO_Storable_IntId::type_.
00170 { 00171 ACE_TRACE("find"); 00172 TAO_Storable_ExtId name (id, kind); 00173 TAO_Storable_IntId entry; 00174 00175 if (this->map_.find (name, entry) != 0) 00176 { 00177 return -1; 00178 } 00179 else 00180 { 00181 obj = orb_->string_to_object (entry.ref_.in()); 00182 type = entry.type_; 00183 00184 return 0; 00185 } 00186 } |
|
Get a reference to the underlying hash map.
Definition at line 202 of file Storable_Naming_Context.cpp. References ACE_TRACE. Referenced by TAO_Storable_Naming_Context::list(), and TAO_Storable_Naming_Context::Write().
|
|
Overwrite a binding containing and (or create a new one if one doesn't exist) with the specified parameters. Return 0 or 1 on success. Return -1 or -2 on failure. (-2 is returned if the new and old bindings differ in type). Implements TAO_Bindings_Map. Definition at line 156 of file Storable_Naming_Context.cpp. References ACE_TRACE, and shared_bind().
00160 { 00161 ACE_TRACE("rebind"); 00162 return this->shared_bind (id, kind, obj, type, 1); 00163 } |
|
Helper: factors common code from and .
Definition at line 223 of file Storable_Naming_Context.cpp. References ACE_TRACE, and TAO_Storable_IntId::type_. Referenced by bind(), and rebind().
00228 { 00229 ACE_TRACE("shared_bind"); 00230 TAO_Storable_ExtId new_name (id, kind); 00231 CORBA::String_var ior = orb_->object_to_string(obj); 00232 TAO_Storable_IntId new_entry (ior.in(), type); 00233 TAO_Storable_IntId old_entry; 00234 00235 if (rebind == 0) 00236 { 00237 // Do a normal bind. 00238 return this->map_.bind (new_name, new_entry); 00239 } 00240 else 00241 // Rebind. 00242 { 00243 // Check that types of old and new entries match. 00244 if (this->map_.find (new_name, 00245 old_entry) == 0 00246 && type != old_entry.type_) 00247 return -2; 00248 00249 else 00250 return this->map_.rebind (new_name, new_entry); 00251 } 00252 } |
|
Return the size of the underlying hash table.
Definition at line 216 of file Storable_Naming_Context.cpp. References ACE_TRACE. Referenced by TAO_Storable_Naming_Context::new_context().
|
|
Remove a binding containing and from the table. Return 0 on success and -1 on failure. Implements TAO_Bindings_Map. Definition at line 138 of file Storable_Naming_Context.cpp. References ACE_TRACE.
00139 { 00140 ACE_TRACE("unbind"); 00141 TAO_Storable_ExtId name (id, kind); 00142 return this->map_.unbind (name); 00143 } |
|
Hash map used for storage.
Definition at line 199 of file Storable_Naming_Context.h. |
|
Definition at line 201 of file Storable_Naming_Context.h. |