2 //=============================================================================
6 * Implements the Marshal_Object class and the factory
7 * The original encoder and decoder code now appears in files encode.cpp and
10 * @author Aniruddha S. Gokhale
11 * @author Copyright 1994-1995 by Sun Microsystems Inc.
13 //=============================================================================
15 #include "tao/AnyTypeCode/Marshal.h"
16 #include "tao/AnyTypeCode/TypeCode.h"
18 #if !defined (__ACE_INLINE__)
19 # include "tao/AnyTypeCode/Marshal.inl"
20 #endif /* ! __ACE_INLINE__ */
22 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
24 TAO_Marshal_Object::~TAO_Marshal_Object ()
29 TAO_Marshal_Object::perform_skip (CORBA::TypeCode_ptr tc
, TAO_InputCDR
*stream
)
31 CORBA::ULong
const kind
= tc
->kind ();
37 case CORBA::tk_native
:
38 case CORBA::tk_abstract_interface
:
39 case CORBA::tk_component
:
41 // @@ We don't know how to handle any of them yet.
42 return TAO::TRAVERSE_STOP
;
48 case CORBA::tk_ushort
:
51 case CORBA::tk_double
:
52 case CORBA::tk_boolean
:
55 case CORBA::tk_longlong
:
56 case CORBA::tk_ulonglong
:
57 case CORBA::tk_longdouble
:
61 TAO_Marshal_Primitive marshal
;
62 return marshal
.skip (tc
, stream
);
67 TAO_Marshal_Any marshal
;
68 return marshal
.skip (tc
, stream
);
70 case CORBA::tk_TypeCode
:
72 TAO_Marshal_TypeCode marshal
;
73 return marshal
.skip (tc
, stream
);
75 case CORBA::tk_Principal
:
77 TAO_Marshal_Principal marshal
;
78 return marshal
.skip (tc
, stream
);
80 case CORBA::tk_objref
:
82 TAO_Marshal_ObjRef marshal
;
83 return marshal
.skip (tc
, stream
);
85 case CORBA::tk_struct
:
87 TAO_Marshal_Struct marshal
;
88 return marshal
.skip (tc
, stream
);
92 TAO_Marshal_Union marshal
;
93 return marshal
.skip (tc
, stream
);
95 case CORBA::tk_string
:
97 TAO_Marshal_String marshal
;
98 return marshal
.skip (tc
, stream
);
100 case CORBA::tk_sequence
:
102 TAO_Marshal_Sequence marshal
;
103 return marshal
.skip (tc
, stream
);
105 case CORBA::tk_array
:
107 TAO_Marshal_Array marshal
;
108 return marshal
.skip (tc
, stream
);
110 case CORBA::tk_alias
:
112 TAO_Marshal_Alias marshal
;
113 return marshal
.skip (tc
, stream
);
115 case CORBA::tk_except
:
117 TAO_Marshal_Except marshal
;
118 return marshal
.skip (tc
, stream
);
120 case CORBA::tk_wstring
:
122 TAO_Marshal_WString marshal
;
123 return marshal
.skip (tc
, stream
);
125 case CORBA::tk_value_box
:
126 case CORBA::tk_value
:
127 case CORBA::tk_event
:
129 TAO_Marshal_Value marshal
;
130 return marshal
.skip (tc
, stream
);
136 TAO_Marshal_Object::perform_append (CORBA::TypeCode_ptr tc
,
140 CORBA::ULong kind
= tc
->kind ();
145 case CORBA::tk_fixed
:
146 case CORBA::tk_native
:
147 case CORBA::tk_abstract_interface
:
148 case CORBA::tk_component
:
150 // @@ We don't know how to handle any of them yet.
151 return TAO::TRAVERSE_STOP
;
155 case CORBA::tk_short
:
157 case CORBA::tk_ushort
:
158 case CORBA::tk_ulong
:
159 case CORBA::tk_float
:
160 case CORBA::tk_double
:
161 case CORBA::tk_boolean
:
163 case CORBA::tk_octet
:
164 case CORBA::tk_longlong
:
165 case CORBA::tk_ulonglong
:
166 case CORBA::tk_longdouble
:
167 case CORBA::tk_wchar
:
170 TAO_Marshal_Primitive marshal
;
171 return marshal
.append (tc
, src
, dest
);
176 TAO_Marshal_Any marshal
;
177 return marshal
.append (tc
, src
, dest
);
179 case CORBA::tk_TypeCode
:
181 TAO_Marshal_TypeCode marshal
;
182 return marshal
.append (tc
, src
, dest
);
184 case CORBA::tk_Principal
:
186 TAO_Marshal_Principal marshal
;
187 return marshal
.append (tc
, src
, dest
);
189 case CORBA::tk_objref
:
191 TAO_Marshal_ObjRef marshal
;
192 return marshal
.append (tc
, src
, dest
);
194 case CORBA::tk_struct
:
196 TAO_Marshal_Struct marshal
;
197 return marshal
.append (tc
, src
, dest
);
199 case CORBA::tk_union
:
201 TAO_Marshal_Union marshal
;
202 return marshal
.append (tc
, src
, dest
);
204 case CORBA::tk_string
:
206 TAO_Marshal_String marshal
;
207 return marshal
.append (tc
, src
, dest
);
209 case CORBA::tk_sequence
:
211 TAO_Marshal_Sequence marshal
;
212 return marshal
.append (tc
, src
, dest
);
214 case CORBA::tk_array
:
216 TAO_Marshal_Array marshal
;
217 return marshal
.append (tc
, src
, dest
);
219 case CORBA::tk_alias
:
221 TAO_Marshal_Alias marshal
;
222 return marshal
.append (tc
, src
, dest
);
224 case CORBA::tk_except
:
226 TAO_Marshal_Except marshal
;
227 return marshal
.append (tc
, src
, dest
);
229 case CORBA::tk_wstring
:
231 TAO_Marshal_WString marshal
;
232 return marshal
.append (tc
, src
, dest
);
234 case CORBA::tk_value_box
:
235 case CORBA::tk_value
:
236 case CORBA::tk_event
:
238 TAO_Marshal_Value marshal
;
239 return marshal
.append (tc
, src
, dest
);
244 TAO_END_VERSIONED_NAMESPACE_DECL