Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / TAO / tao / AnyTypeCode / Marshal.cpp
blobb7274bcd45882bc6f910e54a1ce2a71d78b60c6a
2 //=============================================================================
3 /**
4 * @file Marshal.cpp
6 * Implements the Marshal_Object class and the factory
7 * The original encoder and decoder code now appears in files encode.cpp and
8 * decode.cpp
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 ()
28 TAO::traverse_status
29 TAO_Marshal_Object::perform_skip (CORBA::TypeCode_ptr tc, TAO_InputCDR *stream)
31 CORBA::ULong const kind = tc->kind ();
33 switch (kind)
35 default:
36 case CORBA::tk_fixed:
37 case CORBA::tk_native:
38 case CORBA::tk_abstract_interface:
39 case CORBA::tk_component:
40 case CORBA::tk_home:
41 // @@ We don't know how to handle any of them yet.
42 return TAO::TRAVERSE_STOP;
44 case CORBA::tk_null:
45 case CORBA::tk_void:
46 case CORBA::tk_short:
47 case CORBA::tk_long:
48 case CORBA::tk_ushort:
49 case CORBA::tk_ulong:
50 case CORBA::tk_float:
51 case CORBA::tk_double:
52 case CORBA::tk_boolean:
53 case CORBA::tk_char:
54 case CORBA::tk_octet:
55 case CORBA::tk_longlong:
56 case CORBA::tk_ulonglong:
57 case CORBA::tk_longdouble:
58 case CORBA::tk_wchar:
59 case CORBA::tk_enum:
61 TAO_Marshal_Primitive marshal;
62 return marshal.skip (tc, stream);
65 case CORBA::tk_any:
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);
90 case CORBA::tk_union:
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);
135 TAO::traverse_status
136 TAO_Marshal_Object::perform_append (CORBA::TypeCode_ptr tc,
137 TAO_InputCDR *src,
138 TAO_OutputCDR *dest)
140 CORBA::ULong kind = tc->kind ();
142 switch (kind)
144 default:
145 case CORBA::tk_fixed:
146 case CORBA::tk_native:
147 case CORBA::tk_abstract_interface:
148 case CORBA::tk_component:
149 case CORBA::tk_home:
150 // @@ We don't know how to handle any of them yet.
151 return TAO::TRAVERSE_STOP;
153 case CORBA::tk_null:
154 case CORBA::tk_void:
155 case CORBA::tk_short:
156 case CORBA::tk_long:
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:
162 case CORBA::tk_char:
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:
168 case CORBA::tk_enum:
170 TAO_Marshal_Primitive marshal;
171 return marshal.append (tc, src, dest);
174 case CORBA::tk_any:
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