summaryrefslogtreecommitdiff
path: root/TAO/tao/DynStruct_i.h
blob: 23cb0fa4e0ec15aa8bb01283748f84789362e2c0 (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
/* -*- C++ -*- */
// $Id$

// ========================================================================
//
// = LIBRARY
//    TAO
//
// = FILENAME
//    DynStruct_i.h
//
// = AUTHOR
//    Jeff Parsons <jp4@cs.wustl.edu>
//
// ========================================================================

#ifndef TAO_DYNSTRUCT_I_H
#define TAO_DYNSTRUCT_I_H

#include "ace/Containers.h"

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

class TAO_Export TAO_DynStruct_i : public POA_CORBA::DynStruct
{
  // = TITLE
  //    TAO_DynStruct_i
  //
  // = DESCRIPTION
  //    Implementation of Dynamic Any type for Structs
  //
public:
  TAO_DynStruct_i (const CORBA_Any& any);
  // constructor taking an Any argument

  TAO_DynStruct_i (CORBA_TypeCode_ptr tc);
  // constructor taking a typecode argument

  ~TAO_DynStruct_i (void);
  // destructor

  // Functions specific to DynStruct

  FieldName current_member_name (CORBA::Environment &TAO_IN_ENV);
  // FieldName is IDL typedef for string

  CORBA::TCKind current_member_kind (CORBA::Environment &TAO_IN_ENV);

  // Assign and dump elements using IDL defined type NameValuePairSeq

  NameValuePairSeq* get_members (CORBA::Environment &TAO_IN_ENV);

  void set_members (const NameValuePairSeq& value,
                    CORBA::Environment &TAO_IN_ENV);

  // Functions common to all Dynamic Any types

  void assign (CORBA_DynAny_ptr dyn_any,
               CORBA::Environment &TAO_IN_ENV);
  // Sets the value of the receiver to the value of the argument

  CORBA_DynAny_ptr copy (CORBA::Environment &TAO_IN_ENV);
  // Creates a copy

  void destroy (CORBA::Environment &TAO_IN_ENV);
  // Makes sure the contents are disposed of correctly

  void from_any (const CORBA::Any& any,
                 CORBA::Environment &TAO_IN_ENV);
  // Assigns value from an Any argument

  CORBA::Any_ptr to_any (CORBA::Environment &TAO_IN_ENV);
  // Outputs contents as an Any

  CORBA::TypeCode_ptr type (CORBA::Environment &TAO_IN_ENV);
  // Returns the (constant) type

  CORBA_DynAny_ptr current_component (CORBA::Environment &TAO_IN_ENV);
  // Used in iterating through the contents

  CORBA::Boolean next (CORBA::Environment &TAO_IN_ENV);
  // Returns next component

  CORBA::Boolean seek (CORBA::Long index,
                       CORBA::Environment &TAO_IN_ENV);
  // Jump to component at <index>

  void rewind (CORBA::Environment &TAO_IN_ENV);
  // Makes first component the current one

  // Insert and get functions

  void insert_boolean (CORBA::Boolean value,
                       CORBA::Environment &TAO_IN_ENV);
  void insert_octet (CORBA::Octet value,
                     CORBA::Environment &TAO_IN_ENV);
  void insert_char (CORBA::Char value,
                    CORBA::Environment &TAO_IN_ENV);
  void insert_short (CORBA::Short value,
                     CORBA::Environment &TAO_IN_ENV);
  void insert_ushort (CORBA::UShort value,
                      CORBA::Environment &TAO_IN_ENV);
  void insert_long (CORBA::Long value,
                    CORBA::Environment &TAO_IN_ENV);
  void insert_ulong (CORBA::ULong value,
                     CORBA::Environment &TAO_IN_ENV);
  void insert_float (CORBA::Float value,
                     CORBA::Environment &TAO_IN_ENV);
  void insert_double (CORBA::Double value,
                      CORBA::Environment &TAO_IN_ENV);
  void insert_string (const char * value,
                      CORBA::Environment &TAO_IN_ENV);
  void insert_reference (CORBA::Object_ptr value,
                         CORBA::Environment &TAO_IN_ENV);
  void insert_typecode (CORBA::TypeCode_ptr value,
                        CORBA::Environment &TAO_IN_ENV);
  void insert_longlong (CORBA::LongLong value,
                        CORBA::Environment &TAO_IN_ENV);
  void insert_ulonglong (CORBA::ULongLong value,
                         CORBA::Environment &TAO_IN_ENV);
  void insert_wchar (CORBA::WChar value,
                      CORBA::Environment &TAO_IN_ENV);
  void insert_any (const CORBA::Any& value,
                   CORBA::Environment &TAO_IN_ENV);
  CORBA::Boolean get_boolean (CORBA::Environment &TAO_IN_ENV);

  CORBA::Octet get_octet (CORBA::Environment &TAO_IN_ENV);

  CORBA::Char get_char (CORBA::Environment &TAO_IN_ENV);

  CORBA::Short get_short (CORBA::Environment &TAO_IN_ENV);

  CORBA::UShort get_ushort (CORBA::Environment &TAO_IN_ENV);

  CORBA::Long get_long (CORBA::Environment &TAO_IN_ENV);

  CORBA::ULong get_ulong (CORBA::Environment &TAO_IN_ENV);

  CORBA::Float get_float (CORBA::Environment &TAO_IN_ENV);

  CORBA::Double get_double (CORBA::Environment &TAO_IN_ENV);

  char * get_string (CORBA::Environment &TAO_IN_ENV);

  CORBA::Object_ptr get_reference (CORBA::Environment &TAO_IN_ENV);

  CORBA::TypeCode_ptr get_typecode (CORBA::Environment &TAO_IN_ENV);

  CORBA::LongLong get_longlong (CORBA::Environment &TAO_IN_ENV);

  CORBA::ULongLong get_ulonglong (CORBA::Environment &TAO_IN_ENV);

  CORBA::WChar get_wchar (CORBA::Environment &TAO_IN_ENV);

  CORBA::Any_ptr get_any (CORBA::Environment &TAO_IN_ENV);

private:
  CORBA::TypeCode_var type_;
  // Holds the typecode of the Struct

  CORBA::Long index_;
  // Index of the current component

  ACE_Array_Base<CORBA_DynAny_var> da_members_;
  // Each component is also a DynAny

  TAO_DynStruct_i (void);
  // Must be instantiated with at least a typecode

  // Use copy() or assign() instead of these
  TAO_DynStruct_i (const TAO_DynStruct_i &src);
  TAO_DynStruct_i &operator= (const TAO_DynStruct_i &src);
};

#endif /* TAO_DYNSTRUCT_I_H */