#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 193 of file Storable_Naming_Context.cpp. References ACE_TRACE.
|
|
Destructor.
Definition at line 201 of file Storable_Naming_Context.cpp. References ACE_TRACE.
00202 { 00203 ACE_TRACE("~TAO_Storable_Bindings_Map"); 00204 } |
|
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 148 of file Storable_Naming_Context.cpp. References ACE_TRACE, and shared_bind(). Referenced by TAO_Storable_Naming_Context::load_map().
00152 { 00153 ACE_TRACE("bind"); 00154 return this->shared_bind (id, kind, obj, type, 0); 00155 } |
|
Return current number of entries (name bindings) in the underlying hash map. Implements TAO_Bindings_Map. Definition at line 214 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 168 of file Storable_Naming_Context.cpp. References ACE_CHECK_RETURN, ACE_DECLARE_NEW_CORBA_ENV, ACE_ENV_ARG_PARAMETER, ACE_TRACE, TAO_Storable_IntId::ref_, and TAO_Storable_IntId::type_.
00172 { 00173 ACE_TRACE("find"); 00174 TAO_Storable_ExtId name (id, kind); 00175 TAO_Storable_IntId entry; 00176 00177 if (this->map_.find (name, 00178 entry) != 0) 00179 { 00180 return -1; 00181 } 00182 else 00183 { 00184 ACE_DECLARE_NEW_CORBA_ENV; 00185 obj = orb_->string_to_object (entry.ref_.in() ACE_ENV_ARG_PARAMETER); 00186 ACE_CHECK_RETURN (-1); 00187 type = entry.type_; 00188 00189 return 0; 00190 } 00191 } |
|
Get a reference to the underlying hash map.
Definition at line 207 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 158 of file Storable_Naming_Context.cpp. References ACE_TRACE, and shared_bind().
00162 { 00163 ACE_TRACE("rebind"); 00164 return this->shared_bind (id, kind, obj, type, 1); 00165 } |
|
Helper: factors common code from and .
Definition at line 228 of file Storable_Naming_Context.cpp. References ACE_TRACE, and TAO_Storable_IntId::type_. Referenced by bind(), and rebind().
00233 { 00234 ACE_TRACE("shared_bind"); 00235 TAO_Storable_ExtId new_name (id, kind); 00236 CORBA::String_var ior = orb_->object_to_string(obj); 00237 TAO_Storable_IntId new_entry (ior.in(), type); 00238 TAO_Storable_IntId old_entry; 00239 00240 if (rebind == 0) 00241 { 00242 // Do a normal bind. 00243 return this->map_.bind (new_name, new_entry); 00244 } 00245 else 00246 // Rebind. 00247 { 00248 // Check that types of old and new entries match. 00249 if (this->map_.find (new_name, 00250 old_entry) == 0 00251 && type != old_entry.type_) 00252 return -2; 00253 00254 else 00255 return this->map_.rebind (new_name, new_entry); 00256 } 00257 } |
|
Return the size of the underlying hash table.
Definition at line 221 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 139 of file Storable_Naming_Context.cpp. References ACE_TRACE.
00141 { 00142 ACE_TRACE("unbind"); 00143 TAO_Storable_ExtId name (id, kind); 00144 return this->map_.unbind (name); 00145 } |
|
Hash map used for storage.
Definition at line 200 of file Storable_Naming_Context.h. |
|
Definition at line 202 of file Storable_Naming_Context.h. |