TAO_CosNaming 4.0.1
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
TAO_Persistent_Bindings_Map Class Reference

Provides hash-table-based persistent storage for name to object bindings in a Naming Context. More...

#include <Persistent_Naming_Context.h>

Inheritance diagram for TAO_Persistent_Bindings_Map:
Inheritance graph
[legend]
Collaboration diagram for TAO_Persistent_Bindings_Map:
Collaboration graph
[legend]

Public Types

typedef ACE_Hash_Map_With_Allocator< TAO_Persistent_ExtId, TAO_Persistent_IntIdHASH_MAP
 Underlying data structure - typedef for ease of use.
 

Public Member Functions

 TAO_Persistent_Bindings_Map (CORBA::ORB_ptr orb)
 Constructor.
 
int open (size_t hash_map_size, ACE_Allocator *alloc)
 
void set (HASH_MAP *map, ACE_Allocator *alloc)
 
virtual ~TAO_Persistent_Bindings_Map ()
 
void destroy ()
 
HASH_MAPmap ()
 Get a pointer to the underlying hash map.
 
size_t total_size ()
 Return the size of the underlying hash table.
 
virtual size_t current_size ()
 Return the size of the underlying hash table.
 
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)
 
- Public Member Functions inherited from TAO_Bindings_Map
virtual ~TAO_Bindings_Map ()
 Destructor.
 

Protected Member Functions

int open_helper (size_t hash_table_size, void *buffer)
 
int shared_bind (const char *id, const char *kind, CORBA::Object_ptr obj, CosNaming::BindingType type, int rebind)
 Helper: factors common code from <bind> and <rebind>.
 

Protected Attributes

ACE_Allocatorallocator_
 Pointer to the allocator we use to make bindings persistent.
 
HASH_MAPmap_
 Pointer to the underlying hash map.
 
CORBA::ORB_var orb_
 Pointer to the orb. We need it to do string/object conversions.
 

Detailed Description

Provides hash-table-based persistent storage for name to object bindings in a Naming Context.

Wrapper on top of ACE_Hash_Map_With_Allocator (which is a wrapper around ACE_Hash_Map_Manager). Uses ACE_Allocator (allocating from persistent storage) to make bindings persistent and supports TAO_Bindings_Map interface. Used by TAO_Persistent_Naming_Context.

Member Typedef Documentation

◆ HASH_MAP

Underlying data structure - typedef for ease of use.

Constructor & Destructor Documentation

◆ TAO_Persistent_Bindings_Map()

TAO_Persistent_Bindings_Map::TAO_Persistent_Bindings_Map ( CORBA::ORB_ptr orb)

Constructor.

◆ ~TAO_Persistent_Bindings_Map()

TAO_Persistent_Bindings_Map::~TAO_Persistent_Bindings_Map ( )
virtual

Destructor. Does not deallocate the hash map: if an instance of this class goes out of scope, its hash_map remains in persistent storage.

Member Function Documentation

◆ bind()

int TAO_Persistent_Bindings_Map::bind ( const char * id,
const char * kind,
CORBA::Object_ptr obj,
CosNaming::BindingType type )
virtual

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 id and kind.

Implements TAO_Bindings_Map.

◆ current_size()

size_t TAO_Persistent_Bindings_Map::current_size ( )
virtual

Return the size of the underlying hash table.

Implements TAO_Bindings_Map.

◆ destroy()

void TAO_Persistent_Bindings_Map::destroy ( )

This method removes the hash map from persistent storage/frees up the memory. The hash map better be empty, since we are not cleaning up the insides. (We could add <close> to clean entries, but not the data inside the entries.

◆ find()

int TAO_Persistent_Bindings_Map::find ( const char * id,
const char * kind,
CORBA::Object_ptr & obj,
CosNaming::BindingType & type )
virtual

Find the binding containing <id> and <kind> 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 <obj>, so the caller is responsible for its deallocation.

Implements TAO_Bindings_Map.

◆ map()

TAO_Persistent_Bindings_Map::HASH_MAP * TAO_Persistent_Bindings_Map::map ( )

Get a pointer to the underlying hash map.

◆ open()

int TAO_Persistent_Bindings_Map::open ( size_t hash_map_size,
ACE_Allocator * alloc )

Allocate hash map of size hash_map_size from persistent storage using the alloc.

◆ open_helper()

int TAO_Persistent_Bindings_Map::open_helper ( size_t hash_table_size,
void * buffer )
protected

Helper to the <open> method. By isolating placement new into a separate method, we can deal with memory allocation failures more efficiently. If there is a problem in HASH_MAP constructor, we can clean up preallocated space.

◆ rebind()

int TAO_Persistent_Bindings_Map::rebind ( const char * id,
const char * kind,
CORBA::Object_ptr obj,
CosNaming::BindingType type )
virtual

Overwrite a binding containing id and kind (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.

◆ set()

void TAO_Persistent_Bindings_Map::set ( HASH_MAP * map,
ACE_Allocator * alloc )

The hash map has already been preallocated for us. We just need to set our data members take ownership of it.

◆ shared_bind()

int TAO_Persistent_Bindings_Map::shared_bind ( const char * id,
const char * kind,
CORBA::Object_ptr obj,
CosNaming::BindingType type,
int rebind )
protected

Helper: factors common code from <bind> and <rebind>.

◆ total_size()

size_t TAO_Persistent_Bindings_Map::total_size ( )

Return the size of the underlying hash table.

◆ unbind()

int TAO_Persistent_Bindings_Map::unbind ( const char * id,
const char * kind )
virtual

Remove a binding containing <id> and <kind> from the table. Return 0 on success and -1 on failure.

Implements TAO_Bindings_Map.

Member Data Documentation

◆ allocator_

ACE_Allocator* TAO_Persistent_Bindings_Map::allocator_
protected

Pointer to the allocator we use to make bindings persistent.

◆ map_

HASH_MAP* TAO_Persistent_Bindings_Map::map_
protected

Pointer to the underlying hash map.

◆ orb_

CORBA::ORB_var TAO_Persistent_Bindings_Map::orb_
protected

Pointer to the orb. We need it to do string/object conversions.


The documentation for this class was generated from the following files: