summaryrefslogtreecommitdiff
path: root/TAO/tao/DynAny.pidl
blob: 942e4c52ac90806858917f7878983e86dd6e36f3 (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
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
/* -*- C++ -*- */
// $Id$

// ============================================================================
//
// = LIBRARY
//    TAO
//
// = FILENAME
//    DynAny.pidl
//
// = DESCRIPTION
//    Allows composition and decomposition of arbitrarily complex CORBA::Any
//    values at runtime, without requiring compile-time knowledge of the
//    IDL. See the OMG spec for CORBA v2.2, chapter 7.
//
// = AUTHOR
//    OMG 
//
// ============================================================================

#if !defined DYN_ANY_IDL
#define DYN_ANY_IDL

#pragma prefix "omg.org"

typedef unsigned long TCKind;

// IDL
interface CORBA_DynAny
  {
    typedef CORBA_DynAny DynAny;

    exception Invalid {};
    // Typecodes don't match, or argument has no meaningful value.

    exception InvalidValue {};
    // Argument's typecode doesn't match.

    exception TypeMismatch {};
    // Requested type doesn't match what's there.

    exception InvalidSeq {};
    // Wrong length or typecode.


    // Used only with DynFixed
    //typedef sequence<octet> OctetSeq;


    TypeCode type ();
    // Returns the typecode expected or contained which, 
    // once the DynAny object is created, cannot be changed.

    void assign (in DynAny dyn_any)
      raises (Invalid);
    // Previous value is overwriiten, but typecodes must match.

    void from_any (in any value)
      raises (Invalid);
    // Previous value is overwritten, but typecodes must match.

    any to_any ()
      raises (Invalid);
    // Constructs a new CORBA::Any.

    void destroy ();
    // Destroys this object and any DynAny objects derived from it.

    DynAny copy ();
    // Clones this object.


                // Insertion operations

    void insert_boolean (in boolean value)
      raises (InvalidValue);

    void insert_octet (in octet value)
      raises (InvalidValue);

    void insert_char (in char value)
      raises (InvalidValue);

    void insert_short (in short value)
      raises (InvalidValue);

    void insert_ushort (in unsigned short value)
      raises (InvalidValue);

    void insert_long (in long value)
      raises (InvalidValue);

    void insert_ulong (in unsigned long value)
      raises (InvalidValue);

    void insert_float (in float value)
      raises (InvalidValue);

    void insert_double (in double value)
      raises (InvalidValue);

    void insert_string (in string value)
      raises (InvalidValue);

    void insert_reference (in Object value)
      raises (InvalidValue);

    void insert_typecode (in TypeCode value)
      raises (InvalidValue);

    void insert_longlong (in long long value)
      raises (InvalidValue);

    void insert_ulonglong (in unsigned long long value)
      raises (InvalidValue);

   // If sizeof(long double) != 16, it's represented as 
   // as struct and ACE has no support for conversion or
   // arithmetic operations.
/*
    void insert_longdouble (in long double value)
        raises (InvalidValue);
*/

    void insert_wchar (in wchar value)
      raises (InvalidValue);


    // TAO IDL compiler doesn't recognize this type yet.
/*
    void insert_wstring (in wstring value)
      raises (InvalidValue);
*/

    void insert_any (in any value)
      raises (InvalidValue);


                // Extraction operations
                    
    boolean get_boolean ()
        raises (TypeMismatch);

    octet get_octet ()
        raises (TypeMismatch);

    char get_char ()
      raises (TypeMismatch);

    short get_short ()
      raises (TypeMismatch);

    unsigned short get_ushort ()
      raises (TypeMismatch);

    long get_long ()
      raises (TypeMismatch);

    unsigned long get_ulong ()
      raises (TypeMismatch);

    float get_float ()
      raises (TypeMismatch);

    double get_double ()
      raises (TypeMismatch);

    string get_string ()
      raises (TypeMismatch);

    Object get_reference ()
      raises (TypeMismatch);

    TypeCode get_typecode ()
      raises (TypeMismatch);

    long long get_longlong ()
      raises (TypeMismatch);

    unsigned long long get_ulonglong ()
      raises (TypeMismatch);

   // If sizeof(long double) != 16, see above.
/*
    long double get_longdouble ()
      raises (TypeMismatch);
*/

    wchar get_wchar ()
      raises (TypeMismatch);


    // TAO IDL compiler doesn't recognize this type yet.
/*
    wstring get_wstring ()
      raises (TypeMismatch);
*/

    any get_any ()
      raises (TypeMismatch);



    DynAny current_component ();
    // Returns component at the current position which, for simple
    // and enumerated types, is *this.

    boolean next ();
    // Moves to the next component. Returns FALSE if already at the
    // last component.

    boolean seek (in long index);
    // Makes the component at index the current component.
    // Returns FALSE if index is out of range.

    void rewind ();
    // Same as seek (0), which never returns a FALSE value.
  };



  // Fixed types aren't supported by TAO at this time.
/*
interface DynFixed : DynAny
  {
    OctetSeq get_value ();

    void set_value (in OctetSeq val)
      raises (InvalidValue);
  };
*/


interface CORBA_DynEnum : CORBA_DynAny
  {
    // Since the internal representation is a ulong,
    // insert_ulong () and get_ulong () can also be used.

    attribute string value_as_string;

    attribute unsigned long value_as_ulong;
  };



typedef string FieldName;
// The name of a struct or union member.

struct NameValuePair
  {
    FieldName id;

    any value;
  };
// Representation of a struct or union member.

typedef sequence<NameValuePair> NameValuePairSeq;
// External representation of the members of a DynStruct object.

interface CORBA_DynStruct : CORBA_DynAny
  {
    FieldName current_member_name ();

    TCKind current_member_kind ();

    NameValuePairSeq get_members ();

    void set_members (in NameValuePairSeq value)
      raises (InvalidSeq);
    // If the argument has the wrong length or order,
    // mismatched typecodes or invalid members, the
    // exception is raised.
  };



interface CORBA_DynUnion : CORBA_DynAny
  {
    attribute boolean set_as_default;
    // Should be treated as if it were readonly, which it
    // probably will be in a future spec.

    DynAny discriminator ();

    TCKind discriminator_kind ();

    DynAny member ();

    attribute FieldName member_name;

    TCKind member_kind ();
  };



typedef sequence<any> AnySeq;
// Representation of the values in a DynArray or DynSequence object.

interface CORBA_DynSequence : CORBA_DynAny
  {
    attribute unsigned long length;

    AnySeq get_elements ();

    void set_elements (in AnySeq value)
      raises (InvalidSeq);
    // Length and each typecode must match.
  };



interface CORBA_DynArray : CORBA_DynAny
  {
    AnySeq get_elements ();

    void set_elements (in AnySeq value)
      raises (InvalidSeq);
  // Length and each typecode must match.
  };

#endif /* !defined DYN_ANY_IDL */