summaryrefslogtreecommitdiff
path: root/TAO/tao/Marshal.cpp
blob: 03da59524b601ba9fb007066fa82a09487bc87f0 (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
// $Id$

// ============================================================================
//
// = LIBRARY
//    TAO
//
// = FILENAME
//    marshal.cpp
//
// = DESCRIPTION
//   Implements the Marshal_Object class and the factory
//
//   The original encoder and decoder code now appears in files encode.cpp and
//   decode.cpp
//
// = AUTHOR
//     Copyright 1994-1995 by Sun Microsystems Inc.
//     and
//     Aniruddha Gokhale
//
// ============================================================================

#include "tao/Marshal.h"
#include "tao/CDR.h"
#include "tao/Environment.h"

#if !defined (__ACE_INLINE__)
# include "tao/Marshal.i"
#endif /* ! __ACE_INLINE__ */

ACE_RCSID(tao, Marshal, "$Id$")

TAO_Marshal_Object::~TAO_Marshal_Object (void)
{
}

CORBA::TypeCode::traverse_status
TAO_Marshal_Object::perform_skip (CORBA::TypeCode_ptr tc,
                                  TAO_InputCDR *stream
                                  TAO_ENV_ARG_DECL)
{
  CORBA::ULong kind = tc->kind (TAO_ENV_SINGLE_ARG_PARAMETER);
  ACE_CHECK_RETURN (CORBA::TypeCode::TRAVERSE_STOP);

  switch (kind)
    {
    default:
    case CORBA::tk_fixed:
    case CORBA::tk_value:
    case CORBA::tk_value_box:
    case CORBA::tk_native:
    case CORBA::tk_abstract_interface:
    case CORBA::tk_component:
    case CORBA::tk_home:
      // @@ We don't know how to handle any of them yet.
      return CORBA::TypeCode::TRAVERSE_STOP;

    case CORBA::tk_null:
    case CORBA::tk_void:
    case CORBA::tk_short:
    case CORBA::tk_long:
    case CORBA::tk_ushort:
    case CORBA::tk_ulong:
    case CORBA::tk_float:
    case CORBA::tk_double:
    case CORBA::tk_boolean:
    case CORBA::tk_char:
    case CORBA::tk_octet:
    case CORBA::tk_longlong:
    case CORBA::tk_ulonglong:
    case CORBA::tk_longdouble:
    case CORBA::tk_wchar:
    case CORBA::tk_enum:
      {
        TAO_Marshal_Primitive marshal;
        return marshal.skip (tc, stream TAO_ENV_ARG_PARAMETER);
      }

    case CORBA::tk_any:
      {
        TAO_Marshal_Any marshal;
        return marshal.skip (tc, stream TAO_ENV_ARG_PARAMETER);
      }
    case CORBA::tk_TypeCode:
      {
        TAO_Marshal_TypeCode marshal;
        return marshal.skip (tc, stream TAO_ENV_ARG_PARAMETER);
      }
    case CORBA::tk_Principal:
      {
        TAO_Marshal_Principal marshal;
        return marshal.skip (tc, stream TAO_ENV_ARG_PARAMETER);
      }
    case CORBA::tk_objref:
      {
        TAO_Marshal_ObjRef marshal;
        return marshal.skip (tc, stream TAO_ENV_ARG_PARAMETER);
      }
    case CORBA::tk_struct:
      {
        TAO_Marshal_Struct marshal;
        return marshal.skip (tc, stream TAO_ENV_ARG_PARAMETER);
      }
    case CORBA::tk_union:
      {
        TAO_Marshal_Union marshal;
        return marshal.skip (tc, stream TAO_ENV_ARG_PARAMETER);
      }
    case CORBA::tk_string:
      {
        TAO_Marshal_String marshal;
        return marshal.skip (tc, stream TAO_ENV_ARG_PARAMETER);
      }
    case CORBA::tk_sequence:
      {
        TAO_Marshal_Sequence marshal;
        return marshal.skip (tc, stream TAO_ENV_ARG_PARAMETER);
      }
    case CORBA::tk_array:
      {
        TAO_Marshal_Array marshal;
        return marshal.skip (tc, stream TAO_ENV_ARG_PARAMETER);
      }
    case CORBA::tk_alias:
      {
        TAO_Marshal_Alias marshal;
        return marshal.skip (tc, stream TAO_ENV_ARG_PARAMETER);
      }
    case CORBA::tk_except:
      {
        TAO_Marshal_Except marshal;
        return marshal.skip (tc, stream TAO_ENV_ARG_PARAMETER);
      }
    case CORBA::tk_wstring:
      {
        TAO_Marshal_WString marshal;
        return marshal.skip (tc, stream TAO_ENV_ARG_PARAMETER);
      }
    }
}

CORBA::TypeCode::traverse_status
TAO_Marshal_Object::perform_append (CORBA::TypeCode_ptr tc,
                                    TAO_InputCDR *src,
                                    TAO_OutputCDR *dest
                                    TAO_ENV_ARG_DECL)
{
  CORBA::ULong kind = tc->kind (TAO_ENV_SINGLE_ARG_PARAMETER);
  ACE_CHECK_RETURN (CORBA::TypeCode::TRAVERSE_STOP);

  switch (kind)
    {
    default:
    case CORBA::tk_fixed:
    case CORBA::tk_value:
    case CORBA::tk_value_box:
    case CORBA::tk_native:
    case CORBA::tk_abstract_interface:
    case CORBA::tk_component:
    case CORBA::tk_home:
      // @@ We don't know how to handle any of them yet.
      return CORBA::TypeCode::TRAVERSE_STOP;

    case CORBA::tk_null:
    case CORBA::tk_void:
    case CORBA::tk_short:
    case CORBA::tk_long:
    case CORBA::tk_ushort:
    case CORBA::tk_ulong:
    case CORBA::tk_float:
    case CORBA::tk_double:
    case CORBA::tk_boolean:
    case CORBA::tk_char:
    case CORBA::tk_octet:
    case CORBA::tk_longlong:
    case CORBA::tk_ulonglong:
    case CORBA::tk_longdouble:
    case CORBA::tk_wchar:
    case CORBA::tk_enum:
      {
        TAO_Marshal_Primitive marshal;
        return marshal.append (tc, src, dest TAO_ENV_ARG_PARAMETER);
      }

    case CORBA::tk_any:
      {
        TAO_Marshal_Any marshal;
        return marshal.append (tc, src, dest TAO_ENV_ARG_PARAMETER);
      }
    case CORBA::tk_TypeCode:
      {
        TAO_Marshal_TypeCode marshal;
        return marshal.append (tc, src, dest TAO_ENV_ARG_PARAMETER);
      }
    case CORBA::tk_Principal:
      {
        TAO_Marshal_Principal marshal;
        return marshal.append (tc, src, dest TAO_ENV_ARG_PARAMETER);
      }
    case CORBA::tk_objref:
      {
        TAO_Marshal_ObjRef marshal;
        return marshal.append (tc, src, dest TAO_ENV_ARG_PARAMETER);
      }
    case CORBA::tk_struct:
      {
        TAO_Marshal_Struct marshal;
        return marshal.append (tc, src, dest TAO_ENV_ARG_PARAMETER);
      }
    case CORBA::tk_union:
      {
        TAO_Marshal_Union marshal;
        return marshal.append (tc, src, dest TAO_ENV_ARG_PARAMETER);
      }
    case CORBA::tk_string:
      {
        TAO_Marshal_String marshal;
        return marshal.append (tc, src, dest TAO_ENV_ARG_PARAMETER);
      }
    case CORBA::tk_sequence:
      {
        TAO_Marshal_Sequence marshal;
        return marshal.append (tc, src, dest TAO_ENV_ARG_PARAMETER);
      }
    case CORBA::tk_array:
      {
        TAO_Marshal_Array marshal;
        return marshal.append (tc, src, dest TAO_ENV_ARG_PARAMETER);
      }
    case CORBA::tk_alias:
      {
        TAO_Marshal_Alias marshal;
        return marshal.append (tc, src, dest TAO_ENV_ARG_PARAMETER);
      }
    case CORBA::tk_except:
      {
        TAO_Marshal_Except marshal;
        return marshal.append (tc, src, dest TAO_ENV_ARG_PARAMETER);
      }
    case CORBA::tk_wstring:
      {
        TAO_Marshal_WString marshal;
        return marshal.append (tc, src, dest TAO_ENV_ARG_PARAMETER);
      }
    }
}

#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)

#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)

#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */