1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
/* -*- C++ -*- */
// $Id$
// ============================================================================
//
// = LIBRARY
// cos
//
// = FILENAME
// Persistent_Bindings_Map.h
//
// = AUTHOR
// Marina Spivak <marina@cs.wustl.edu>
//
// ============================================================================
#ifndef TAO_PERSISTENT_BINDINGS_MAP_H
#define TAO_PERSISTENT_BINDINGS_MAP_H
#include "Persistent_Entries.h"
class TAO_ORBSVCS_Export TAO_Persistent_Bindings_Map
{
// = TITLE
//
//
// = DESCRIPTION
//
public:
typedef ACE_Shared_Hash_Map<TAO_Persistent_ExtId, TAO_Persistent_IntId> HASH_MAP;
// = Initialization and termination methods.
TAO_Persistent_Bindings_Map (CORBA::ORB_ptr orb);
// "Do-nothing" constructor.
int open (size_t size,
ACE_Allocator *alloc);
// Allocate hash map using the <alloc>.
void set (HASH_MAP *map,
ACE_Allocator *alloc);
// The map is already preallocated for us.
~TAO_Persistent_Bindings_Map (void);
// destructor, do some cleanup :TBD: last dtor should "compress"
// file
void destroy (void);
// This method removes frees up the hash map from allocator.
// It better be empty, since we are not cleaning up the insides. (We
// could add <close> to clean entries, but not the data inside.
size_t total_size (void);
size_t current_size (void);
// return the size of the underlying hash map.
int bind (const char *id,
const char *kind,
CORBA::Object_ptr obj,
CosNaming::BindingType type);
// Bind a new name to a naming context
int rebind (const char *id,
const char *kind,
CORBA::Object_ptr obj,
CosNaming::BindingType type);
// Overwrite the value or type of an existing name in a
// ACE_Local_Name_Space or bind a new name to the context, if it
// didn't exist yet. (Wide charcter strings interface).
int unbind (const char * id,
const char * kind);
int find (const char * id,
const char * kind,
CORBA::Object_ptr & obj,
CosNaming::BindingType &type);
//A method to get the iterator.
HASH_MAP *map (void);
// accessor
private:
int shared_bind (const char *id,
const char *kind,
CORBA::Object_ptr obj,
CosNaming::BindingType type,
int rebind);
// Factor out code from <bind> and <rebind>.
ACE_Allocator *allocator_;
// Pointer to the allocator
HASH_MAP *map_;
// Pointer to the allocated map manager.
CORBA::ORB_var orb_;
// a pointer to the orb so that we can do string/object conversions.
};
#endif /* TAO_PERSISTENT_BINDINGS_MAP */
|