summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/orbsvcs/Naming/Persistent_Entries.h
blob: 59a86851fa416ae96be442aa734d7ec3a87a4c8c (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
/* -*- 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 "tao/corba.h"
#include "orbsvcs/CosNamingC.h"
#include "Shared_Hash_Map_T.h"

class TAO_ORBSVCS_Export TAO_Persistent_IntId
{
  // = TITLE
  //     Stores information a context keeps for each bound name.
  //
  // = DESCRIPTION
  //     Each bound name is associated with an object reference and
  //     the type of binding.
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 (does copy memory).

  CosNaming::BindingType type (void);
  //

  const char * ref_;
  // This should be allocated from shared/mmap memory.

  CosNaming::BindingType type_;
  // Indicator of whether the object is a NamingContext that should
  // participate in name resolution when compound names are used.
};

class TAO_ORBSVCS_Export TAO_Persistent_ExtId
{
  // = TITLE
  //    Stores the name to which an object is bound.
  //
  // = DESCRIPTION
  //    This class is used as the External ID for the
  //    <ACE_Hash_Map_Manager>.  We do not allocate memory for <id>
  //    and <kind>, we do not deallocate it.
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.

  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;
  // This class has to have a hash for use with ACE_Hash_Map_Manager.

  const char * id_;
  const char * kind_;
  // These point into shared/mmaped memory.

  // Accessors.
  const char * id (void);
  const char * kind (void);
};

class TAO_ORBSVCS_Export TAO_Persistent_Index_IntId
{
  // = TITLE
  //     Stores information about a context.
  //
  // = DESCRIPTION
  //     Each context
  //     the type of binding.
public:
  // = Initialization and termination methods.
  TAO_Persistent_Index_IntId (void);
  // Constructor.

  TAO_Persistent_Index_IntId (ACE_UINT32 *counter,
                              ACE_Shared_Hash_Map<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).

  ACE_UINT32 *counter_;
  //

  ACE_Shared_Hash_Map<TAO_Persistent_ExtId,
    TAO_Persistent_IntId> * hash_map_;
  // The pointer to the context's bindings hash map.
};

class TAO_ORBSVCS_Export TAO_Persistent_Index_ExtId
{
  // = TITLE
  //    Stores the poa_id of a context.
  //
  // = DESCRIPTION
  //    This class is used as the External ID for the
  //    <ACE_Hash_Map_Manager>.  We do not allocate memory for
  //    <poa_id>, we do not deallocate it.
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.

  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;
  // This class has to have a hash for use with ACE_Hash_Map_Manager.

  const char * poa_id_;
  // These point into shared/mmaped memory.

};

#endif /* TAO_PERSISTENT_ENTRIES_H */