summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/orbsvcs/Naming/Persistent_Entries.h
blob: 69cf5d1a45001ca03732218d1d63546f0fe8f3f5 (plain)
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
/* -*- C++ -*- */
// $Id$

// ============================================================================
//
// = LIBRARY
//    cos
//
// = FILENAME
//   Persistent_Entries.h
//
// = AUTHOR
//    Marina Spivak <marina@cs.wustl.edu>
//
// ============================================================================

#ifndef TAO_PERSISTENT_ENTRIES_H
#define TAO_PERSISTENT_ENTRIES_H

#include "ace/Hash_Map_With_Allocator_T.h"
#include "tao/corba.h"
#include "orbsvcs/CosNamingC.h"

#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */

class TAO_ORBSVCS_Export TAO_Persistent_IntId
{
  // = TITLE
  //     Helper class for TAO_Persistent_Bindings_Map: unifies several
  //     data items, so they can be stored together as a  <value>
  //     for a <key> in a hash table holding the state of a Persistent
  //     Naming Context.
  //
  // = DESCRIPTION
  //     This class holds a strigified IOR and a binding type, so
  //     they can be stored together as a <value> for a <key> in a
  //     hash table holding the state of a Persistent Naming Context.
  //
  //     Memory for the ior isn't allocated/deallocated, this class just
  //     copies a pointer.
public:
  // = Initialization and termination methods.
  TAO_Persistent_IntId (void);
  // Constructor.

  TAO_Persistent_IntId (char * obj_ref,
                        CosNaming::BindingType type /* = CosNaming::nobject */);
  // Constructor.

  TAO_Persistent_IntId (const TAO_Persistent_IntId & rhs);
  // Copy constructor.

  ~TAO_Persistent_IntId (void);
  // Destructor.

  void operator= (const TAO_Persistent_IntId & rhs);
  // Assignment operator.

  // = Data members.

  const char *ref_;
  // Stringified IOR to be stored in a Persistent Naming Context.

  CosNaming::BindingType type_;
  // Binding type for <ref_>.
};

class TAO_ORBSVCS_Export TAO_Persistent_ExtId
{
  // = TITLE
  //     Helper class for TAO_Persistent_Bindings_Map: unifies several
  //     data items, so they can be stored together as a  <key>
  //     for a <value> in a hash table holding the state of a Persistent
  //     Naming Context.
  //
  // = DESCRIPTION
  //     This class holds id and kind strings, so
  //     they can be stored together as a <key> for a <value> in a
  //     hash table holding the state of a Persistent Naming Context.
  //
  //     Memory for id and kind isn't allocated/deallocated, this
  //     class just copies pointers.
public:
  // = Initialization and termination methods.

  TAO_Persistent_ExtId (void);
  // Constructor.

  TAO_Persistent_ExtId (const char *id,
                        const char *kind);
  // Constructor.

  TAO_Persistent_ExtId (const TAO_Persistent_ExtId & rhs);
  // Copy constructor.

  ~TAO_Persistent_ExtId (void);
  // Destructor.

  // = Assignment and comparison methods.

  void operator= (const TAO_Persistent_ExtId & rhs);
  // Assignment operator (does copy memory).

  int operator== (const TAO_Persistent_ExtId &rhs) const;
  // Equality comparison operator (must match both id_ and kind_).

  int operator!= (const TAO_Persistent_ExtId &rhs) const;
  // Inequality comparison operator.

  u_long hash (void) const;
  // <hash> function is required in order for this class to be usable by
  // ACE_Hash_Map_Manager.

  // = Data members.

  const char * id_;
  // <kind> portion of the name to be associated with some object
  // reference in a Persistent Naming Context.

  const char * kind_;
  // <id> portion of the name to be associated with some object
  // reference in a Persistent Naming Context.

  // Accessors.

  const char * id (void);
  const char * kind (void);
};

class TAO_ORBSVCS_Export TAO_Persistent_Index_IntId
{
  // = TITLE
  //     Helper class for TAO_Persistent_Context_Index: unifies several
  //     data items, so they can be stored together as a  <value>
  //     for a <key> in a hash table holding the state of a Persistent
  //     Context Index.  (Persistent Context Index is like directory
  //     that stores info about every active Naming Context).
  //
  // = DESCRIPTION
  //     This class holds a counter and a hash map pointers, so
  //     they can be stored together as a <value> for a <key> in a
  //     hash table holding the state of a Persistent Context Index.
  //
public:
  // = Initialization and termination methods.
  TAO_Persistent_Index_IntId (void);
  // Constructor.

  TAO_Persistent_Index_IntId (ACE_UINT32 *counter,
                              ACE_Hash_Map_With_Allocator<TAO_Persistent_ExtId,
                              TAO_Persistent_IntId> * hash_map);
  // Constructor.

  TAO_Persistent_Index_IntId (const TAO_Persistent_Index_IntId & rhs);
  // Copy constructor.

  ~TAO_Persistent_Index_IntId (void);
  // Destructor.

  void operator= (const TAO_Persistent_Index_IntId & rhs);
  // Assignment operator (does copy memory).

  // = Data members.

  ACE_UINT32 *counter_;
  // Pointer to a Persistent Naming Context's counter.

  ACE_Hash_Map_With_Allocator<TAO_Persistent_ExtId,
    TAO_Persistent_IntId> * hash_map_;
  // Pointer to a Persistent Naming Context's hash map.
};

class TAO_ORBSVCS_Export TAO_Persistent_Index_ExtId
{
  // = TITLE
  //    Helper class for TAO_Persistent_Context_Index: holds
  //    Persistent Naming Context POA id, so it can be stored as a <key>
  //    for a <value> in a hash table holding state of a Persistent
  //    Context Index.  (Persistent Context Index is like directory
  //    that stores info about every active Naming Context).
  //
  // = DESCRIPTION
  //    We need this wrapper class around the actual data because we must
  //    provide <hash> function for it to work with
  //    ACE_Hash_Map_Manager.
  //
public:
  // = Initialization and termination methods.

  TAO_Persistent_Index_ExtId (void);
  // Constructor.

  TAO_Persistent_Index_ExtId (const char *poa_id);
  // Constructor.

  TAO_Persistent_Index_ExtId (const TAO_Persistent_Index_ExtId & rhs);
  // Copy constructor.

  ~TAO_Persistent_Index_ExtId (void);
  // Destructor.

  // = Assignment and comparison methods.

  void operator= (const TAO_Persistent_Index_ExtId & rhs);
  // Assignment operator (does copy memory).

  int operator== (const TAO_Persistent_Index_ExtId &rhs) const;
  // Equality comparison operator (must match both id_ and kind_).

  int operator!= (const TAO_Persistent_Index_ExtId &rhs) const;
  // Inequality comparison operator.

  u_long hash (void) const;
  // <hash> function is required in order for this class to be usable by
  // ACE_Hash_Map_Manager.

  // = Data member.

  const char * poa_id_;
  // POA id to be associated with the rest of the info for some
  // Persistent Naming Context in the Persistent Context Index.
};

#endif /* TAO_PERSISTENT_ENTRIES_H */