summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/IFR_Service/Repository_i.h
blob: 8b805e81a72930f2794ae0e320f151c7b6729f6e (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
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
/* -*- C++ -*- */
// $Id$

// ============================================================================
//
// = LIBRARY
//    TAO/orbsvcs/IFR_Service
//
// = FILENAME
//    Repository_i.h
//
// = DESCRIPTION
//    Repository servant class.
//
// = AUTHOR
//    Jeff Parsons <parsons@cs.wustl.edu>
//
// ============================================================================

#ifndef REPOSITORY_I_H
#define REPOSITORY_I_H

#include "Container_i.h"

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

#if defined(_MSC_VER)
#if (_MSC_VER >= 1200)
#pragma warning(push)
#endif /* _MSC_VER >= 1200 */
#pragma warning(disable:4250)
#endif /* _MSC_VER */

#include "IFR_macro.h"
#include "tao/TypeCodeFactory/TypeCodeFactory_Loader.h"
#include "tao/CORBA_String.h"

class IFR_Servant_Factory;

class TAO_Repository_i : public virtual TAO_Container_i
{
  // = TITLE
  //    TAO_Repository_i
  //
  // = DESCRIPTION
  //    Provides global access to the Interface Repository, but
  //    does not support access to information related to
  //    CORBA Components.
  //
public:
  TAO_Repository_i (CORBA::ORB_ptr orb,
                    PortableServer::POA_ptr poa,
                    ACE_Configuration *config);
  // Constructor.

  virtual ~TAO_Repository_i (void);
  // Destructor.

  virtual CORBA::DefinitionKind def_kind (
      ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)

    ACE_THROW_SPEC ((CORBA::SystemException));
  // Accessor for the readonly attribute.

  virtual void destroy (
      ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)

    ACE_THROW_SPEC ((CORBA::SystemException));
  // May not be called on a repository - raises BAD_INV_ORDER.

  virtual CORBA_Contained_ptr lookup_id (
      const char *search_id
      ACE_ENV_ARG_DECL_WITH_DEFAULTS)

    ACE_THROW_SPEC ((CORBA::SystemException));

  CORBA_Contained_ptr lookup_id_i (
      const char *search_id
      ACE_ENV_ARG_DECL_WITH_DEFAULTS)

    ACE_THROW_SPEC ((CORBA::SystemException));

  virtual CORBA::TypeCode_ptr get_canonical_typecode (
      CORBA::TypeCode_ptr tc
      ACE_ENV_ARG_DECL_WITH_DEFAULTS)

    ACE_THROW_SPEC ((CORBA::SystemException));

  CORBA::TypeCode_ptr get_canonical_typecode_i (
      CORBA::TypeCode_ptr tc
      ACE_ENV_ARG_DECL_WITH_DEFAULTS)

    ACE_THROW_SPEC ((CORBA::SystemException));

  virtual CORBA::PrimitiveDef_ptr get_primitive (
      CORBA::PrimitiveKind kind
      ACE_ENV_ARG_DECL_WITH_DEFAULTS)

    ACE_THROW_SPEC (( CORBA::SystemException));
  // No locking necessary because the database is not
  // accessed.

  virtual CORBA_StringDef_ptr create_string (
      CORBA::ULong bound
      ACE_ENV_ARG_DECL_WITH_DEFAULTS)

    ACE_THROW_SPEC ((CORBA::SystemException));

  CORBA_StringDef_ptr create_string_i (
      CORBA::ULong bound
      ACE_ENV_ARG_DECL_WITH_DEFAULTS)

    ACE_THROW_SPEC ((CORBA::SystemException));

  virtual CORBA_WstringDef_ptr create_wstring (
      CORBA::ULong bound
      ACE_ENV_ARG_DECL_WITH_DEFAULTS)

    ACE_THROW_SPEC ((CORBA::SystemException));

  CORBA_WstringDef_ptr create_wstring_i (
      CORBA::ULong bound
      ACE_ENV_ARG_DECL_WITH_DEFAULTS)

    ACE_THROW_SPEC ((CORBA::SystemException));

  virtual CORBA_SequenceDef_ptr create_sequence (
      CORBA::ULong bound,
      CORBA_IDLType_ptr element_type
      ACE_ENV_ARG_DECL_WITH_DEFAULTS)

    ACE_THROW_SPEC (( CORBA::SystemException));

  CORBA_SequenceDef_ptr create_sequence_i (
      CORBA::ULong bound,
      CORBA_IDLType_ptr element_type
      ACE_ENV_ARG_DECL_WITH_DEFAULTS)

    ACE_THROW_SPEC (( CORBA::SystemException));

  virtual CORBA_ArrayDef_ptr create_array (
      CORBA::ULong length,
      CORBA_IDLType_ptr element_type
      ACE_ENV_ARG_DECL_WITH_DEFAULTS)

    ACE_THROW_SPEC ((CORBA::SystemException));

  CORBA_ArrayDef_ptr create_array_i (
      CORBA::ULong length,
      CORBA_IDLType_ptr element_type
      ACE_ENV_ARG_DECL_WITH_DEFAULTS)

    ACE_THROW_SPEC ((CORBA::SystemException));

  virtual CORBA_FixedDef_ptr create_fixed (
      CORBA::UShort digits,
      CORBA::Short scale
      ACE_ENV_ARG_DECL_WITH_DEFAULTS)

    ACE_THROW_SPEC ((CORBA::SystemException));

  CORBA_FixedDef_ptr create_fixed_i (
      CORBA::UShort digits,
      CORBA::Short scale
      ACE_ENV_ARG_DECL_WITH_DEFAULTS)

    ACE_THROW_SPEC ((CORBA::SystemException));

  PortableServer::POA_ptr ir_poa (void) const;
  // Accessor for the POA that creates the servants.

  ACE_Configuration *config (void) const;
  // Accessor for the ACE_Configuration database.

  IFR_Servant_Factory *servant_factory (void) const;
  // Accessor for the servant factory.

  CORBA::TypeCodeFactory_ptr tc_factory (void) const;
  // Accessor for the Typecode factory.

  CORBA_Repository_ptr repo_objref (void) const;
  void repo_objref (CORBA_Repository_ptr objref);
  // Accessor/mutator for our object reference.

  ACE_Configuration_Section_Key root_key (void) const;
  // Accessor for the root key for all IR objects.

  ACE_Configuration_Section_Key repo_ids_key (void) const;
  // Accessor for the repository ids root key.

  ACE_Configuration_Section_Key pkinds_key (void) const;
  // Accessor for the primitive kinds section.

  ACE_Configuration_Section_Key strings_key (void) const;
  // Accessor for the bounded strings section.

  ACE_Configuration_Section_Key wstrings_key (void) const;
  // Accessor for the bounded wstrings section.

  ACE_Configuration_Section_Key fixeds_key (void) const;
  // Accessor for the fixed types section.

  ACE_Configuration_Section_Key arrays_key (void) const;
  // Accessor for the anonymous arrays section.

  ACE_Configuration_Section_Key sequences_key (void) const;
  // Accessor for the anonymous sequences section.

  const char *extension (void) const;
  // Accessor for the name extension string.

  ACE_Lock &lock (void) const;
  // Repo lock.

  void shutdown (void);
  // Used ONLY with Purify, for memory leak checking.
  // A call to this can be temporariily appended to the
  // destroy() method of the last thing to be destroyed
  // by the test code.

protected:
  CORBA::ORB_ptr orb_;
  // Reference to our ORB.

  PortableServer::POA_ptr ir_poa_;
  // Reference to the POA that creates the servants.

  ACE_Configuration *config_;
  // Our ACE_Configuration database.

  IFR_Servant_Factory *servant_factory_;
  // Creates _i and _tie instances.

  CORBA::TypeCodeFactory_var tc_factory_;
  // Our Typecode factory.

  CORBA_Repository_ptr repo_objref_;
  // The object reference of this servant.

  ACE_Configuration_Section_Key root_key_;
  // Root of all IR objects.

  ACE_Configuration_Section_Key repo_ids_key_;
  // Flat section of Interface Repository ids.

  ACE_Configuration_Section_Key pkinds_key_;
  // Section holding the primitive kinds.

  ACE_Configuration_Section_Key strings_key_;
  // Section holding the bounded strings.

  ACE_Configuration_Section_Key wstrings_key_;
  // Section holding the bounded wstrings.

  ACE_Configuration_Section_Key fixeds_key_;
  // Section holding the fixed types.

  ACE_Configuration_Section_Key arrays_key_;
  // Section holding the anonymous arrays.

  ACE_Configuration_Section_Key sequences_key_;
  // Section holding the anonymous sequences.

  CORBA::String_var extension_;
  // Added to names temporarily to avoid name clashes.

  ACE_Lock *lock_;
  // Lock.

private:
  static const char *TAO_IFR_primitive_kinds[];
  // Set of strings corresponding to the CORBA_PrimitiveKind
  // enum values.

  const char *pkind_to_string (CORBA::PrimitiveKind pkind) const;
  // Convert the enum value to the equivalent string.

  u_int num_pkinds (void) const;
  // Return the number of entries in the CORBA_PrimitiveKind enum.

};

#if defined(_MSC_VER) && (_MSC_VER >= 1200)
#pragma warning(pop)
#endif /* _MSC_VER */

#endif /* TAO_REPOSITORY_I_H */