OpenDDS  Snapshot(2023/04/28-20:55)
DynamicDataImpl.h
Go to the documentation of this file.
1 /*
2  * Distributed under the OpenDDS License.
3  * See: http://www.opendds.org/license.html
4  */
5 
6 #ifndef OPENDDS_DCPS_XTYPES_DYNAMIC_DATA_IMPL_H
7 #define OPENDDS_DCPS_XTYPES_DYNAMIC_DATA_IMPL_H
8 
9 #ifndef OPENDDS_SAFETY_PROFILE
10 # include "DynamicDataBase.h"
11 
13 # include <dds/DCPS/Sample.h>
14 
16 
17 namespace OpenDDS {
18 
19 namespace XTypes {
20 class DynamicDataImpl;
21 }
22 
23 namespace DCPS {
25 bool serialized_size(const Encoding& encoding, size_t& size, const XTypes::DynamicDataImpl& data);
27 bool operator<<(Serializer& ser, const XTypes::DynamicDataImpl& data);
29 bool serialized_size(const Encoding& encoding, size_t& size, const KeyOnly<const XTypes::DynamicDataImpl>& data);
31 bool operator<<(Serializer& ser, const KeyOnly<const XTypes::DynamicDataImpl>& data);
32 }
33 
34 namespace XTypes {
35 
37 public:
38  explicit DynamicDataImpl(DDS::DynamicType_ptr type);
39  DynamicDataImpl(const DynamicDataImpl& other);
40 
42 
43  MemberId get_member_id_at_index(ACE_CDR::ULong index);
44  ACE_CDR::ULong get_item_count();
45 
46  DDS::ReturnCode_t clear_all_values();
47  DDS::ReturnCode_t clear_nonkey_values();
48  DDS::ReturnCode_t clear_value(DDS::MemberId id);
49 
50  DDS::DynamicData_ptr clone();
51 
52  DDS::ReturnCode_t get_int8_value(CORBA::Int8& value,
53  DDS::MemberId id);
54  DDS::ReturnCode_t set_int8_value(DDS::MemberId id,
55  CORBA::Int8 value);
56 
57  DDS::ReturnCode_t get_uint8_value(CORBA::UInt8& value,
58  DDS::MemberId id);
59  DDS::ReturnCode_t set_uint8_value(DDS::MemberId id,
60  CORBA::UInt8 value);
61 
62  DDS::ReturnCode_t get_int16_value(CORBA::Short& value,
63  DDS::MemberId id);
64  DDS::ReturnCode_t set_int16_value(DDS::MemberId id,
65  CORBA::Short value);
66 
67  DDS::ReturnCode_t get_uint16_value(CORBA::UShort& value,
68  DDS::MemberId id);
69  DDS::ReturnCode_t set_uint16_value(DDS::MemberId id,
70  CORBA::UShort value);
71 
72  DDS::ReturnCode_t get_int32_value(CORBA::Long& value,
73  DDS::MemberId id);
74  DDS::ReturnCode_t set_int32_value(DDS::MemberId id,
75  CORBA::Long value);
76 
77  DDS::ReturnCode_t get_uint32_value(CORBA::ULong& value,
79  DDS::ReturnCode_t set_uint32_value(DDS::MemberId id,
80  CORBA::ULong value);
81 
82  DDS::ReturnCode_t get_int64_value_impl(CORBA::LongLong& value, DDS::MemberId id);
83  DDS::ReturnCode_t set_int64_value(DDS::MemberId id,
84  CORBA::LongLong value);
85 
86  DDS::ReturnCode_t get_uint64_value_impl(CORBA::ULongLong& value, DDS::MemberId id);
87  DDS::ReturnCode_t set_uint64_value(DDS::MemberId id,
88  CORBA::ULongLong value);
89 
90  DDS::ReturnCode_t get_float32_value(CORBA::Float& value,
91  DDS::MemberId id);
92  DDS::ReturnCode_t set_float32_value(DDS::MemberId id,
93  CORBA::Float value);
94 
95  DDS::ReturnCode_t get_float64_value(CORBA::Double& value,
96  DDS::MemberId id);
97  DDS::ReturnCode_t set_float64_value(DDS::MemberId id,
98  CORBA::Double value);
99 
100  DDS::ReturnCode_t get_float128_value(CORBA::LongDouble& value,
101  DDS::MemberId id);
102  DDS::ReturnCode_t set_float128_value(DDS::MemberId id,
103  CORBA::LongDouble value);
104 
105  DDS::ReturnCode_t get_char8_value(CORBA::Char& value,
106  DDS::MemberId id);
107  DDS::ReturnCode_t set_char8_value(DDS::MemberId id,
108  CORBA::Char value);
109 
110  DDS::ReturnCode_t get_char16_value(CORBA::WChar& value,
111  DDS::MemberId id);
112  DDS::ReturnCode_t set_char16_value(DDS::MemberId id,
113  CORBA::WChar value);
114 
115  DDS::ReturnCode_t get_byte_value(CORBA::Octet& value,
116  DDS::MemberId id);
117  DDS::ReturnCode_t set_byte_value(DDS::MemberId id,
118  CORBA::Octet value);
119 
120  DDS::ReturnCode_t get_boolean_value(CORBA::Boolean& value,
121  DDS::MemberId id);
122  DDS::ReturnCode_t set_boolean_value(DDS::MemberId id,
123  CORBA::Boolean value);
124 
125  DDS::ReturnCode_t get_string_value(char*& value,
126  DDS::MemberId id);
127  DDS::ReturnCode_t set_string_value(DDS::MemberId id,
128  const char* value);
129 
130  DDS::ReturnCode_t get_wstring_value(CORBA::WChar*& value,
131  DDS::MemberId id);
132  DDS::ReturnCode_t set_wstring_value(DDS::MemberId id,
133  const CORBA::WChar* value);
134 
135  DDS::ReturnCode_t get_complex_value(DDS::DynamicData_ptr& value,
136  DDS::MemberId id);
137  DDS::ReturnCode_t set_complex_value(DDS::MemberId id,
138  DDS::DynamicData_ptr value);
139 
140  DDS::ReturnCode_t get_int32_values(DDS::Int32Seq& value,
141  DDS::MemberId id);
142  DDS::ReturnCode_t set_int32_values(DDS::MemberId id,
143  const DDS::Int32Seq& value);
144 
145  DDS::ReturnCode_t get_uint32_values(DDS::UInt32Seq& value,
146  DDS::MemberId id);
147  DDS::ReturnCode_t set_uint32_values(DDS::MemberId id,
148  const DDS::UInt32Seq& value);
149 
150  DDS::ReturnCode_t get_int8_values(DDS::Int8Seq& value,
151  DDS::MemberId id);
152  DDS::ReturnCode_t set_int8_values(DDS::MemberId id,
153  const DDS::Int8Seq& value);
154 
155  DDS::ReturnCode_t get_uint8_values(DDS::UInt8Seq& value,
156  DDS::MemberId id);
157  DDS::ReturnCode_t set_uint8_values(DDS::MemberId id,
158  const DDS::UInt8Seq& value);
159 
160  DDS::ReturnCode_t get_int16_values(DDS::Int16Seq& value,
161  DDS::MemberId id);
162  DDS::ReturnCode_t set_int16_values(DDS::MemberId id,
163  const DDS::Int16Seq& value);
164 
165  DDS::ReturnCode_t get_uint16_values(DDS::UInt16Seq& value,
166  DDS::MemberId id);
167  DDS::ReturnCode_t set_uint16_values(DDS::MemberId id,
168  const DDS::UInt16Seq& value);
169 
170  DDS::ReturnCode_t get_int64_values(DDS::Int64Seq& value,
171  DDS::MemberId id);
172  DDS::ReturnCode_t set_int64_values(DDS::MemberId id,
173  const DDS::Int64Seq& value);
174 
175  DDS::ReturnCode_t get_uint64_values(DDS::UInt64Seq& value,
176  DDS::MemberId id);
177  DDS::ReturnCode_t set_uint64_values(DDS::MemberId id,
178  const DDS::UInt64Seq& value);
179 
180  DDS::ReturnCode_t get_float32_values(DDS::Float32Seq& value,
181  DDS::MemberId id);
182  DDS::ReturnCode_t set_float32_values(DDS::MemberId id,
183  const DDS::Float32Seq& value);
184 
185  DDS::ReturnCode_t get_float64_values(DDS::Float64Seq& value,
186  DDS::MemberId id);
187  DDS::ReturnCode_t set_float64_values(DDS::MemberId id,
188  const DDS::Float64Seq& value);
189 
190  DDS::ReturnCode_t get_float128_values(DDS::Float128Seq& value,
191  DDS::MemberId id);
192  DDS::ReturnCode_t set_float128_values(DDS::MemberId id,
193  const DDS::Float128Seq& value);
194 
195  DDS::ReturnCode_t get_char8_values(DDS::CharSeq& value,
196  DDS::MemberId id);
197  DDS::ReturnCode_t set_char8_values(DDS::MemberId id,
198  const DDS::CharSeq& value);
199 
200  DDS::ReturnCode_t get_char16_values(DDS::WcharSeq& value,
201  DDS::MemberId id);
202  DDS::ReturnCode_t set_char16_values(DDS::MemberId id,
203  const DDS::WcharSeq& value);
204 
205  DDS::ReturnCode_t get_byte_values(DDS::ByteSeq& value,
206  DDS::MemberId id);
207  DDS::ReturnCode_t set_byte_values(DDS::MemberId id,
208  const DDS::ByteSeq& value);
209 
210  DDS::ReturnCode_t get_boolean_values(DDS::BooleanSeq& value,
211  DDS::MemberId id);
212  DDS::ReturnCode_t set_boolean_values(DDS::MemberId id,
213  const DDS::BooleanSeq& value);
214 
215  DDS::ReturnCode_t get_string_values(DDS::StringSeq& value,
216  DDS::MemberId id);
217  DDS::ReturnCode_t set_string_values(DDS::MemberId id,
218  const DDS::StringSeq& value);
219 
220  DDS::ReturnCode_t get_wstring_values(DDS::WstringSeq& value,
221  DDS::MemberId id);
222  DDS::ReturnCode_t set_wstring_values(DDS::MemberId id,
223  const DDS::WstringSeq& value);
224 
225 #ifndef OPENDDS_NO_CONTENT_SUBSCRIPTION_PROFILE
226  DDS::ReturnCode_t get_simple_value(DCPS::Value& value, DDS::MemberId id);
227 #endif
228 
229 private:
230 #ifndef OPENDDS_NO_CONTENT_SUBSCRIPTION_PROFILE
231  DDS::ReturnCode_t get_simple_value_boolean(DCPS::Value& value, DDS::MemberId id) const;
232  DDS::ReturnCode_t get_simple_value_char(DCPS::Value& value, DDS::MemberId id) const;
233  template<typename ValueType>
234  DDS::ReturnCode_t get_simple_value_primitive(DCPS::Value& value, DDS::MemberId id) const;
235  DDS::ReturnCode_t get_simple_value_string(DCPS::Value& value, DDS::MemberId id) const;
236  DDS::ReturnCode_t get_simple_value_enum(DCPS::Value& value, DDS::MemberId id) const;
237 #endif
238 
239  CORBA::ULong get_sequence_size() const;
240  void erase_member(DDS::MemberId id);
241 
242  /// Group of functions to read a basic value represented by this DynamicData instance
243  bool read_basic_value(ACE_OutputCDR::from_int8& value);
244  bool read_basic_value(ACE_OutputCDR::from_uint8& value);
245  bool read_basic_value(CORBA::Short& value);
246  bool read_basic_value(CORBA::UShort& value);
247  bool read_basic_value(CORBA::Long& value);
248  bool read_basic_value(CORBA::ULong& value);
249  bool read_basic_value(CORBA::LongLong& value);
250  bool read_basic_value(CORBA::ULongLong& value);
251  bool read_basic_value(CORBA::Float& value);
252  bool read_basic_value(CORBA::Double& value);
253  bool read_basic_value(CORBA::LongDouble& value);
254  bool read_basic_value(ACE_OutputCDR::from_char& value);
255  bool read_basic_value(ACE_OutputCDR::from_wchar& value);
256  bool read_basic_value(ACE_OutputCDR::from_octet& value);
257  bool read_basic_value(ACE_OutputCDR::from_boolean& value);
258  bool read_basic_value(char*& value) const;
259 #ifdef DDS_HAS_WCHAR
260  bool read_basic_value(CORBA::WChar*& value) const;
261 #endif
262 
263  void cast_to_enum_value(ACE_OutputCDR::from_int8& dst, CORBA::Long src) const;
264  void cast_to_enum_value(CORBA::Short& dst, CORBA::Long src) const;
265  void cast_to_enum_value(CORBA::Long& dst, CORBA::Long src) const;
266 
267  template<typename ValueType>
268  void cast_to_enum_value(ValueType& dst, CORBA::Long src) const;
269 
270  /// Read a basic member from a containing type
271  template<typename ValueType>
272  bool read_basic_in_single_map(ValueType& value, DDS::MemberId id);
273 
274  template<typename ValueType>
275  bool read_basic_in_complex_map(ValueType& value, DDS::MemberId id);
276 
277  template<typename ValueType>
278  bool read_basic_member(ValueType& value, DDS::MemberId id);
279 
280  template<typename ValueType>
281  bool get_value_from_self(ValueType& value, DDS::MemberId id);
282 
283  template<TypeKind ValueTypeKind, typename ValueType>
284  bool get_value_from_enum(ValueType& value, DDS::MemberId id);
285 
286  template<TypeKind ValueTypeKind, typename ValueType>
287  bool get_value_from_bitmask(ValueType& value, DDS::MemberId id);
288 
289  template<TypeKind ValueTypeKind, typename ValueType>
290  bool get_value_from_struct(ValueType& value, DDS::MemberId id);
291 
292  template<TypeKind ValueTypeKind, typename ValueType>
293  bool get_value_from_union(ValueType& value, DDS::MemberId id);
294 
295  template<TypeKind ValueTypeKind, typename ValueType>
296  bool get_value_from_collection(ValueType& value, DDS::MemberId id);
297 
298  template<TypeKind CharKind, TypeKind StringKind, typename FromCharT, typename CharT>
299  DDS::ReturnCode_t get_char_common(CharT& value, DDS::MemberId id);
300 
301  template<typename UIntType>
302  bool get_boolean_from_bitmask(CORBA::ULong index, CORBA::Boolean& value);
303 
304  template<TypeKind MemberTypeKind, typename MemberType>
305  bool set_value_to_struct(DDS::MemberId id, const MemberType& value);
306 
307  bool cast_to_discriminator_value(CORBA::Long& disc_value, const ACE_OutputCDR::from_boolean& value) const;
308  bool cast_to_discriminator_value(CORBA::Long& disc_value, const ACE_OutputCDR::from_octet& value) const;
309  bool cast_to_discriminator_value(CORBA::Long& disc_value, const ACE_OutputCDR::from_char& value) const;
310 #ifdef DDS_HAS_WCHAR
311  bool cast_to_discriminator_value(CORBA::Long& disc_value, const ACE_OutputCDR::from_wchar& value) const;
312 #endif
313  bool cast_to_discriminator_value(CORBA::Long& disc_value, const ACE_OutputCDR::from_int8& value) const;
314  bool cast_to_discriminator_value(CORBA::Long& disc_value, const ACE_OutputCDR::from_uint8& value) const;
315  bool cast_to_discriminator_value(CORBA::Long& disc_value, const CORBA::Short& value) const;
316  bool cast_to_discriminator_value(CORBA::Long& disc_value, const CORBA::UShort& value) const;
317  bool cast_to_discriminator_value(CORBA::Long& disc_value, const CORBA::Long& value) const;
318  bool cast_to_discriminator_value(CORBA::Long& disc_value, const CORBA::ULong& value) const;
319  bool cast_to_discriminator_value(CORBA::Long& disc_value, const CORBA::LongLong& value) const;
320  bool cast_to_discriminator_value(CORBA::Long& disc_value, const CORBA::ULongLong& value) const;
321 
322  template<typename MemberType>
323  bool cast_to_discriminator_value(CORBA::Long& disc_value, const MemberType& value) const;
324 
325  template<TypeKind MemberTypeKind, typename MemberType>
326  bool set_value_to_union(DDS::MemberId id, const MemberType& value,
327  TypeKind enum_or_bitmask = TK_NONE, LBound lower = 0, LBound upper = 0);
328 
329  template<TypeKind ElementTypeKind, typename ElementType>
330  bool set_value_to_collection(DDS::MemberId id, const ElementType& value,
331  TypeKind coll_tk, TypeKind enum_or_bitmask = TK_NONE, LBound lower = 0, LBound upper = 0);
332 
333  template<TypeKind ValueTypeKind, typename ValueType>
334  DDS::ReturnCode_t set_single_value(DDS::MemberId id, const ValueType& value,
335  TypeKind enum_or_bitmask = TK_NONE, LBound lower = 0, LBound upper = 0);
336 
337  template<TypeKind CharKind, TypeKind StringKind, typename FromCharT>
338  DDS::ReturnCode_t set_char_common(DDS::MemberId id, const FromCharT& value);
339 
340  bool check_index_from_id(TypeKind tk, DDS::MemberId id, CORBA::ULong bound) const;
341  static bool is_valid_discriminator_type(TypeKind tk);
342  bool is_default_member_selected(CORBA::Long disc_val, DDS::MemberId default_id) const;
343  bool read_discriminator(CORBA::Long& disc_val) const;
344  DDS::MemberId find_selected_member() const;
345  bool validate_discriminator(CORBA::Long disc_val, const DDS::MemberDescriptor_var& md) const;
346 
347  bool set_complex_to_struct(DDS::MemberId id, DDS::DynamicData_var value);
348  bool set_complex_to_union(DDS::MemberId id, DDS::DynamicData_var value);
349  bool set_complex_to_collection(DDS::MemberId id, DDS::DynamicData_var value, TypeKind tk);
350  bool validate_member_id_collection(DDS::MemberId id, TypeKind collection_tk) const;
351 
352  DDS::ReturnCode_t clear_value_i(DDS::MemberId id, const DDS::DynamicType_var& member_type);
353 
354  bool insert_single(DDS::MemberId id, const ACE_OutputCDR::from_int8& value);
355  bool insert_single(DDS::MemberId id, const ACE_OutputCDR::from_uint8& value);
356  bool insert_single(DDS::MemberId id, const ACE_OutputCDR::from_char& value);
357  bool insert_single(DDS::MemberId id, const ACE_OutputCDR::from_octet& value);
358  bool insert_single(DDS::MemberId id, const ACE_OutputCDR::from_boolean& value);
359 #ifdef DDS_HAS_WCHAR
360  bool insert_single(DDS::MemberId id, const ACE_OutputCDR::from_wchar& value);
361 #endif
362  template<typename SingleType>
363  bool insert_single(DDS::MemberId id, const SingleType& value);
364 
365  bool insert_complex(DDS::MemberId id, const DDS::DynamicData_var& value);
366 
367  template<typename SequenceType>
368  bool insert_sequence(DDS::MemberId id, const SequenceType& value);
369 
370  template<TypeKind ElementTypeKind>
371  bool check_seqmem_in_struct_and_union(DDS::MemberId id, TypeKind enum_or_bitmask,
372  LBound lower, LBound upper) const;
373  template<TypeKind ElementTypeKind>
374  bool check_seqmem_in_sequence_and_array(DDS::MemberId id, CORBA::ULong bound,
375  TypeKind enum_or_bitmask, LBound lower, LBound upper) const;
376 
377  template<TypeKind ElementTypeKind, typename SequenceType>
378  bool set_values_to_struct(DDS::MemberId id, const SequenceType& value,
379  TypeKind enum_or_bitmask, LBound lower, LBound upper);
380 
381  template<TypeKind ElementTypeKind, typename SequenceType>
382  bool set_values_to_union(DDS::MemberId id, const SequenceType& value,
383  TypeKind enum_or_bitmask, LBound lower, LBound upper);
384 
385  template<TypeKind ElementTypeKind, typename SequenceType>
386  bool set_values_to_sequence(DDS::MemberId id, const SequenceType& value,
387  TypeKind enum_or_bitmask, LBound lower, LBound upper);
388 
389  template<TypeKind ElementTypeKind, typename SequenceType>
390  bool set_values_to_array(DDS::MemberId id, const SequenceType& value,
391  TypeKind enum_or_bitmask, LBound lower, LBound upper);
392 
393  template<TypeKind ElementTypeKind, typename SequenceType>
394  DDS::ReturnCode_t set_sequence_values(DDS::MemberId id, const SequenceType& value,
395  TypeKind enum_or_bitmask = TK_NONE,
396  LBound lower = 0, LBound upper = 0);
397 
398  template<TypeKind ValueTypeKind, typename ValueType>
399  DDS::ReturnCode_t get_single_value(ValueType& value, DDS::MemberId id);
400 
401  // Contain data for an instance of a basic type.
402  struct SingleValue {
403  SingleValue(CORBA::Long int32);
404  SingleValue(CORBA::ULong uint32);
407  SingleValue(CORBA::Short int16);
408  SingleValue(CORBA::UShort uint16);
411  SingleValue(CORBA::Float float32);
412  SingleValue(CORBA::Double float64);
413  SingleValue(CORBA::LongDouble float128);
417  SingleValue(const char* str);
418 #ifdef DDS_HAS_WCHAR
420  SingleValue(const CORBA::WChar* wstr);
421 #endif
422  SingleValue(const SingleValue& other);
423 
424  ~SingleValue();
425 
426  // Return a reference to the stored value. Mostly for serialization.
427  template<typename T> const T& get() const;
428 
429  // Return a duplication of the stored string/wstring.
430  // Used for the get_* interfaces of DynamicData.
431  // Caller is responsible for release the returned string.
432  char* get_string() const;
433  CORBA::WChar* get_wstring() const;
434 
436  // Used for types that need ACE_OutputCDR disambiguators.
437  void* active_;
438  union {
441  unsigned char int8_[sizeof(ACE_OutputCDR::from_int8)];
442  unsigned char uint8_[sizeof(ACE_OutputCDR::from_uint8)];
450  unsigned char char8_[sizeof(ACE_OutputCDR::from_char)];
451  unsigned char byte_[sizeof(ACE_OutputCDR::from_octet)];
452  unsigned char boolean_[sizeof(ACE_OutputCDR::from_boolean)];
453  const char* str_;
454 #ifdef DDS_HAS_WCHAR
455  unsigned char char16_[sizeof(ACE_OutputCDR::from_wchar)];
456  const CORBA::WChar* wstr_;
457 #endif
458  };
459 
460  private:
461  SingleValue& operator=(const SingleValue&); // = delete
462  };
463 
464  struct SequenceValue {
465  SequenceValue(const DDS::Int32Seq& int32_seq);
466  SequenceValue(const DDS::UInt32Seq& uint32_seq);
467  SequenceValue(const DDS::Int8Seq& int8_seq);
468  SequenceValue(const DDS::UInt8Seq& uint8_seq);
469  SequenceValue(const DDS::Int16Seq& int16_seq);
470  SequenceValue(const DDS::UInt16Seq& uint16_seq);
471  SequenceValue(const DDS::Int64Seq& int64_seq);
472  SequenceValue(const DDS::UInt64Seq& uint64_seq);
473  SequenceValue(const DDS::Float32Seq& float32_seq);
474  SequenceValue(const DDS::Float64Seq& float64_seq);
475  SequenceValue(const DDS::Float128Seq& float128_seq);
476  SequenceValue(const DDS::CharSeq& char8_seq);
477  SequenceValue(const DDS::ByteSeq& byte_seq);
478  SequenceValue(const DDS::BooleanSeq& boolean_seq);
479  SequenceValue(const DDS::StringSeq& str_seq);
480 #ifdef DDS_HAS_WCHAR
481  SequenceValue(const DDS::WcharSeq& char16_seq);
482  SequenceValue(const DDS::WstringSeq& wstr_seq);
483 #endif
484 
485  SequenceValue(const SequenceValue& rhs);
486  ~SequenceValue();
487 
488  template<typename T> const T& get() const;
489 
491  void* active_;
492  union {
493 #define SEQUENCE_VALUE_MEMBER(T, N) unsigned char N ## _[sizeof(T)]
509 #ifdef DDS_HAS_WCHAR
512 #endif
513 #undef SEQUENCE_VALUE_MEMBER
514  };
515 
516  private:
517  SequenceValue& operator=(const SequenceValue& rhs);
518  };
519 
520  typedef OPENDDS_VECTOR(CORBA::ULong) IndexToIdMap;
521 
522  // Container for all data written to this DynamicData object.
523  // At anytime, there can be at most 1 entry for any given MemberId in all maps.
524  // That is, each member is stored in at most 1 map.
525  struct DataContainer {
526  typedef OPENDDS_MAP(DDS::MemberId, SingleValue)::const_iterator const_single_iterator;
527  typedef OPENDDS_MAP(DDS::MemberId, SequenceValue)::const_iterator const_sequence_iterator;
528  typedef OPENDDS_MAP(DDS::MemberId, DDS::DynamicData_var)::const_iterator const_complex_iterator;
529 
530  DataContainer(const DDS::DynamicType_var& type, const DynamicDataImpl* data)
531  : type_(type)
532  , type_desc_(data->type_desc_)
533  , data_(data)
534  {}
535 
536  DataContainer(const DataContainer& other, const DynamicDataImpl* data)
537  : single_map_(other.single_map_)
538  , sequence_map_(other.sequence_map_)
539  , complex_map_(other.complex_map_)
540  , type_(data->type_)
541  , type_desc_(data->type_desc_)
542  , data_(data)
543  {}
544 
545  void clear();
546 
547  // Get the largest index of all elements in each map.
548  // Call only for collection-like types (sequence, string, etc).
549  // Must be called with a non-empty map.
550  bool get_largest_single_index(CORBA::ULong& index) const;
551  bool get_largest_sequence_index(CORBA::ULong& index) const;
552  bool get_largest_complex_index(CORBA::ULong& index) const;
553 
554  // Get the largest index in a collection of a basic type (sequence, string, array).
555  // This assumes there is at least 1 value of a basic type stored.
556  bool get_largest_index_basic(CORBA::ULong& index) const;
557 
558  // Get the largest index in a collection of sequences of basic type
559  // (each element of the collection is a sequence of a basic type).
560  // Assuming at least 1 sequence is stored.
561  bool get_largest_index_basic_sequence(CORBA::ULong& index) const;
562 
563  bool serialize_single_value(DCPS::Serializer& ser, const SingleValue& sv) const;
564 
565  template<typename PrimitiveType>
566  bool serialize_primitive_value(DCPS::Serializer& ser, PrimitiveType default_value) const;
567  bool serialized_size_enum(const DCPS::Encoding& encoding,
568  size_t& size, const DDS::DynamicType_var& enum_type) const;
569  bool serialize_enum_default_value(DCPS::Serializer& ser,
570  const DDS::DynamicType_var& enum_type) const;
571  bool serialize_enum_value(DCPS::Serializer& ser) const;
572  bool serialized_size_bitmask(const DCPS::Encoding& encoding,
573  size_t& size, const DDS::DynamicType_var& bitmask_type) const;
574  bool serialize_bitmask_default_value(DCPS::Serializer& ser,
575  const DDS::DynamicType_var& bitmask_type) const;
576  bool serialize_bitmask_value(DCPS::Serializer& ser) const;
577  bool reconstruct_string_value(CORBA::Char* str) const;
578  bool serialized_size_string(const DCPS::Encoding& encoding, size_t& size) const;
579  bool serialize_string_value(DCPS::Serializer& ser) const;
580  bool reconstruct_wstring_value(CORBA::WChar* wstr) const;
581  bool serialized_size_wstring(const DCPS::Encoding& encoding, size_t& size) const;
582  bool serialize_wstring_value(DCPS::Serializer& ser) const;
583  void serialized_size_primitive_sequence(const DCPS::Encoding& encoding, size_t& size,
584  TypeKind elem_tk, CORBA::ULong length) const;
585 
586  void set_default_basic_value(CORBA::Long& value) const;
587  void set_default_basic_value(CORBA::ULong& value) const;
588  void set_default_basic_value(ACE_OutputCDR::from_int8& value) const;
589  void set_default_basic_value(ACE_OutputCDR::from_uint8& value) const;
590  void set_default_basic_value(CORBA::Short& value) const;
591  void set_default_basic_value(CORBA::UShort& value) const;
592  void set_default_basic_value(CORBA::LongLong& value) const;
593  void set_default_basic_value(CORBA::ULongLong& value) const;
594  void set_default_basic_value(CORBA::Float& value) const;
595  void set_default_basic_value(CORBA::Double& value) const;
596  void set_default_basic_value(CORBA::LongDouble& value) const;
597  void set_default_basic_value(ACE_OutputCDR::from_char& value) const;
598  void set_default_basic_value(ACE_OutputCDR::from_octet& value) const;
599  void set_default_basic_value(const char*& value) const;
600  void set_default_basic_value(char*& value) const;
601  void set_default_basic_value(ACE_OutputCDR::from_boolean& value) const;
602 #ifdef DDS_HAS_WCHAR
603  void set_default_basic_value(ACE_OutputCDR::from_wchar& value) const;
604  void set_default_basic_value(const CORBA::WChar*& value) const;
605  void set_default_basic_value(CORBA::WChar*& value) const;
606 #endif
607 
608  bool set_default_enum_value(const DDS::DynamicType_var& dt, CORBA::Long& value) const;
609 
610  void set_default_bitmask_value(ACE_OutputCDR::from_uint8& value) const;
611  void set_default_bitmask_value(CORBA::UShort& value) const;
612  void set_default_bitmask_value(CORBA::ULong& value) const;
613  void set_default_bitmask_value(CORBA::ULongLong& value) const;
614 
615  template<typename Type>
616  void set_default_bitmask_value(Type& value) const;
617 
618  void set_default_primitive_values(DDS::Int8Seq& collection) const;
619  void set_default_primitive_values(DDS::UInt8Seq& collection) const;
620  void set_default_primitive_values(DDS::CharSeq& collection) const;
621  void set_default_primitive_values(DDS::ByteSeq& collection) const;
622  void set_default_primitive_values(DDS::BooleanSeq& collection) const;
623 #ifdef DDS_HAS_WCHAR
624  void set_default_primitive_values(DDS::WcharSeq& collection) const;
625 #endif
626 
627  template<typename CollectionType>
628  void set_default_primitive_values(CollectionType& collection) const;
629 
630  template<typename ElementType, typename CollectionType>
631  bool set_primitive_values(CollectionType& collection, CORBA::ULong bound,
632  const ElementType& elem_tag) const;
633 
634  template<typename ElementType, typename CollectionType>
635  bool reconstruct_primitive_collection(CollectionType& collection,
636  CORBA::ULong size, CORBA::ULong bound, const ElementType& elem_tag) const;
637 
638  bool serialize_primitive_sequence(DCPS::Serializer& ser, TypeKind elem_tk,
639  CORBA::ULong size, CORBA::ULong bound) const;
640 
641  void serialized_size_string_common(const DCPS::Encoding& encoding, size_t& size,
642  const char* str) const;
643 #ifdef DDS_HAS_WCHAR
644  void serialized_size_string_common(const DCPS::Encoding& encoding, size_t& size,
645  const CORBA::WChar* wstr) const;
646 #endif
647  void serialized_size_string_common(const DCPS::Encoding& encoding, size_t& size,
648  const SingleValue& sv) const;
649 
650  template<typename StringType>
651  bool serialized_size_generic_string_collection(const DCPS::Encoding& encoding, size_t& size,
652  const IndexToIdMap& index_to_id) const;
653  template<typename StringType>
654  bool serialized_size_generic_string_sequence(const DCPS::Encoding& encoding, size_t& size,
655  const IndexToIdMap& index_to_id) const;
656  template<typename StringType>
657  bool serialize_generic_string_collection(DCPS::Serializer& ser,
658  const IndexToIdMap& index_to_id) const;
659  template<typename StringType>
660  bool serialize_generic_string_sequence(DCPS::Serializer& ser, CORBA::ULong length,
661  CORBA::ULong bound) const;
662 
663  template<typename ElementType, typename CollectionType>
664  bool set_default_enum_values(CollectionType& collection,
665  const DDS::DynamicType_var& enum_type) const;
666 
667  template<typename ElementType, typename WrapElementType, typename CollectionType>
668  bool reconstruct_enum_collection(CollectionType& collection, CORBA::ULong size,
669  CORBA::ULong bound, const DDS::DynamicType_var& enum_type, const WrapElementType& elem_tag) const;
670 
671  void serialized_size_enum_sequence_as_int8s(const DCPS::Encoding& encoding, size_t& size,
672  CORBA::ULong length) const;
673  void serialized_size_enum_sequence(const DCPS::Encoding& encoding, size_t& size,
674  const DDS::Int8Seq& seq) const;
675  bool serialize_enum_sequence_as_ints_i(DCPS::Serializer& ser, const DDS::Int8Seq& enumseq) const;
676  bool serialize_enum_sequence_as_int8s(DCPS::Serializer& ser, CORBA::ULong size,
677  CORBA::ULong bound, const DDS::DynamicType_var& enum_type) const;
678  void serialized_size_enum_sequence_as_int16s(const DCPS::Encoding& encoding, size_t& size,
679  CORBA::ULong length) const;
680  void serialized_size_enum_sequence(const DCPS::Encoding& encoding, size_t& size,
681  const DDS::Int16Seq& seq) const;
682  bool serialize_enum_sequence_as_ints_i(DCPS::Serializer& ser, const DDS::Int16Seq& enumseq) const;
683  bool serialize_enum_sequence_as_int16s(DCPS::Serializer& ser, CORBA::ULong size,
684  CORBA::ULong bound, const DDS::DynamicType_var& enum_type) const;
685  void serialized_size_enum_sequence_as_int32s(const DCPS::Encoding& encoding, size_t& size,
686  CORBA::ULong length) const;
687  void serialized_size_enum_sequence(const DCPS::Encoding& encoding, size_t& size,
688  const DDS::Int32Seq& seq) const;
689  bool serialize_enum_sequence_as_ints_i(DCPS::Serializer& ser, const DDS::Int32Seq& enumseq) const;
690  bool serialize_enum_sequence_as_int32s(DCPS::Serializer& ser, CORBA::ULong size,
691  CORBA::ULong bound, const DDS::DynamicType_var& enum_type) const;
692 
693  void serialized_size_enum_sequence(const DCPS::Encoding& encoding, size_t& size,
694  CORBA::ULong length, CORBA::ULong bitbound) const;
695  bool serialize_enum_sequence(DCPS::Serializer& ser, CORBA::ULong size, CORBA::ULong bitbound,
696  CORBA::ULong seqbound, const DDS::DynamicType_var& enum_type) const;
697 
698  template<typename CollectionType>
699  void set_default_bitmask_values(CollectionType& col) const;
700 
701  template<typename WrapElementType, typename CollectionType>
702  bool reconstruct_bitmask_collection(CollectionType& collection, CORBA::ULong size,
703  CORBA::ULong bound, const WrapElementType& elem_tag) const;
704  void serialized_size_bitmask_sequence_as_uint8s(const DCPS::Encoding& encoding,
705  size_t& size, CORBA::ULong length) const;
706  void serialized_size_bitmask_sequence(const DCPS::Encoding& encoding, size_t& size,
707  const DDS::UInt8Seq& seq) const;
708  bool serialize_bitmask_sequence_as_uints_i(DCPS::Serializer& ser,
709  const DDS::UInt8Seq& bitmask_seq) const;
710  bool serialize_bitmask_sequence_as_uint8s(DCPS::Serializer& ser, CORBA::ULong size,
711  CORBA::ULong bound) const;
712  void serialized_size_bitmask_sequence_as_uint16s(const DCPS::Encoding& encoding, size_t& size,
713  CORBA::ULong length) const;
714  void serialized_size_bitmask_sequence(const DCPS::Encoding& encoding, size_t& size,
715  const DDS::UInt16Seq& seq) const;
716  bool serialize_bitmask_sequence_as_uints_i(DCPS::Serializer& ser,
717  const DDS::UInt16Seq& bitmask_seq) const;
718  bool serialize_bitmask_sequence_as_uint16s(DCPS::Serializer& ser, CORBA::ULong size,
719  CORBA::ULong bound) const;
720  void serialized_size_bitmask_sequence_as_uint32s(const DCPS::Encoding& encoding, size_t& size,
721  CORBA::ULong length) const;
722  void serialized_size_bitmask_sequence(const DCPS::Encoding& encoding, size_t& size,
723  const DDS::UInt32Seq& seq) const;
724  bool serialize_bitmask_sequence_as_uints_i(DCPS::Serializer& ser,
725  const DDS::UInt32Seq& bitmask_seq) const;
726  bool serialize_bitmask_sequence_as_uint32s(DCPS::Serializer& ser, CORBA::ULong size,
727  CORBA::ULong bound) const;
728  void serialized_size_bitmask_sequence_as_uint64s(const DCPS::Encoding& encoding, size_t& size,
729  CORBA::ULong length) const;
730  void serialized_size_bitmask_sequence(const DCPS::Encoding& encoding, size_t& size,
731  const DDS::UInt64Seq& seq) const;
732  bool serialize_bitmask_sequence_as_uints_i(DCPS::Serializer& ser,
733  const DDS::UInt64Seq& bitmask_seq) const;
734  bool serialize_bitmask_sequence_as_uint64s(DCPS::Serializer& ser, CORBA::ULong size,
735  CORBA::ULong bound) const;
736  void serialized_size_bitmask_sequence(const DCPS::Encoding& encoding, size_t& size,
737  CORBA::ULong length, CORBA::ULong bitbound) const;
738  bool serialize_bitmask_sequence(DCPS::Serializer& ser, CORBA::ULong size,
739  CORBA::ULong bitbound, CORBA::ULong seqbound) const;
740 
741  bool serialized_size_sequence_value(const DCPS::Encoding& encoding, size_t& size,
742  const SequenceValue& sv) const;
743  bool serialize_sequence_value(DCPS::Serializer& ser, const SequenceValue& sv) const;
744  bool get_index_to_id_map(IndexToIdMap& index_to_id, CORBA::ULong bound) const;
745  bool serialized_size_complex_member_i(const DCPS::Encoding& encoding, size_t& size,
746  DDS::MemberId id, DCPS::Sample::Extent ext) const;
747 
748  template<typename SequenceType>
749  bool serialized_size_nested_basic_sequences(const DCPS::Encoding& encoding, size_t& size,
750  const IndexToIdMap& index_to_id, SequenceType protoseq) const;
751 
752  template<typename SequenceType>
753  bool serialized_size_nesting_basic_sequence(const DCPS::Encoding& encoding, size_t& size,
754  const IndexToIdMap& index_to_id, SequenceType protoseq) const;
755 
756  bool serialize_complex_member_i(DCPS::Serializer& ser, DDS::MemberId id, DCPS::Sample::Extent ext) const;
757 
758  template<typename SequenceType>
759  bool serialize_nested_basic_sequences(DCPS::Serializer& ser, const IndexToIdMap& index_to_id,
760  SequenceType protoseq) const;
761 
762  template<typename SequenceType>
763  bool serialize_nesting_basic_sequence_i(DCPS::Serializer& ser, CORBA::ULong size,
764  CORBA::ULong bound, SequenceType protoseq) const;
765 
766  bool serialized_size_nesting_basic_sequence(const DCPS::Encoding& encoding, size_t& size,
767  TypeKind nested_elem_tk, const IndexToIdMap& index_to_id) const;
768  bool serialize_nesting_basic_sequence(DCPS::Serializer& ser, TypeKind nested_elem_tk,
769  CORBA::ULong size, CORBA::ULong bound) const;
770  bool serialized_size_nested_enum_sequences(const DCPS::Encoding& encoding, size_t& size,
771  const IndexToIdMap& index_to_id) const;
772  bool serialized_size_nesting_enum_sequence(const DCPS::Encoding& encoding, size_t& size,
773  const IndexToIdMap& index_to_id) const;
774  bool serialize_nested_enum_sequences(DCPS::Serializer& ser, const IndexToIdMap& index_to_id) const;
775  bool serialize_nesting_enum_sequence(DCPS::Serializer& ser, CORBA::ULong size,
776  CORBA::ULong bound) const;
777  bool serialized_size_nested_bitmask_sequences(const DCPS::Encoding& encoding, size_t& size,
778  const IndexToIdMap& index_to_id) const;
779  bool serialized_size_nesting_bitmask_sequence(const DCPS::Encoding& encoding, size_t& size,
780  const IndexToIdMap& index_to_id) const;
781  bool serialize_nested_bitmask_sequences(DCPS::Serializer& ser,
782  const IndexToIdMap& index_to_id) const;
783  bool serialize_nesting_bitmask_sequence(DCPS::Serializer& ser, CORBA::ULong size,
784  CORBA::ULong bound) const;
785  bool serialized_size_complex_member(const DCPS::Encoding& encoding, size_t& size,
786  DDS::MemberId id, const DDS::DynamicType_var& elem_type,
787  DCPS::Sample::Extent ext) const;
788  bool serialized_size_complex_sequence(const DCPS::Encoding& encoding, size_t& size,
789  const IndexToIdMap& index_to_id, const DDS::DynamicType_var& elem_type, DCPS::Sample::Extent ext) const;
790  bool serialize_complex_sequence_i(DCPS::Serializer& ser, const IndexToIdMap& index_to_id,
791  const DDS::DynamicType_var& elem_type, DCPS::Sample::Extent ext) const;
792  bool serialize_complex_sequence(DCPS::Serializer& ser, CORBA::ULong size, CORBA::ULong bound,
793  const DDS::DynamicType_var& elem_type, DCPS::Sample::Extent ext) const;
794  bool get_index_to_id_from_complex(IndexToIdMap& index_to_id, CORBA::ULong bound) const;
795  bool serialized_size_sequence(const DCPS::Encoding& encoding, size_t& size, DCPS::Sample::Extent ext) const;
796  bool serialize_sequence(DCPS::Serializer& ser, DCPS::Sample::Extent ext) const;
797 
798  // Serialize array
799  void serialized_size_primitive_array(const DCPS::Encoding& encoding, size_t& size,
800  TypeKind elem_tk, CORBA::ULong length) const;
801  bool serialize_primitive_array(DCPS::Serializer& ser, TypeKind elem_tk, CORBA::ULong length) const;
802 
803  template<typename StringType>
804  bool serialized_size_generic_string_array(const DCPS::Encoding& encoding, size_t& size,
805  const IndexToIdMap& index_to_id) const;
806  template<typename StringType>
807  bool serialize_generic_string_array(DCPS::Serializer& ser, CORBA::ULong length) const;
808  void serialized_size_enum_array_as_int8s(const DCPS::Encoding& encoding, size_t& size,
809  CORBA::ULong length) const;
810  bool serialize_enum_array_as_ints_i(DCPS::Serializer& ser, const DDS::Int8Seq& enumarr) const;
811  bool serialize_enum_array_as_int8s(DCPS::Serializer& ser, CORBA::ULong length,
812  const DDS::DynamicType_var& enum_type) const;
813  void serialized_size_enum_array_as_int16s(const DCPS::Encoding& encoding, size_t& size,
814  CORBA::ULong length) const;
815  bool serialize_enum_array_as_ints_i(DCPS::Serializer& ser, const DDS::Int16Seq& enumarr) const;
816  bool serialize_enum_array_as_int16s(DCPS::Serializer& ser, CORBA::ULong length,
817  const DDS::DynamicType_var& enum_type) const;
818  void serialized_size_enum_array_as_int32s(const DCPS::Encoding& encoding, size_t& size,
819  CORBA::ULong length) const;
820  bool serialize_enum_array_as_ints_i(DCPS::Serializer& ser, const DDS::Int32Seq& enumarr) const;
821  bool serialize_enum_array_as_int32s(DCPS::Serializer& ser, CORBA::ULong length,
822  const DDS::DynamicType_var& enum_type) const;
823  void serialized_size_enum_array(const DCPS::Encoding& encoding, size_t& size,
824  CORBA::ULong length, CORBA::ULong bitbound) const;
825  bool serialize_enum_array(DCPS::Serializer& ser, CORBA::ULong bitbound, CORBA::ULong length,
826  const DDS::DynamicType_var& enum_type) const;
827 
828  void serialized_size_bitmask_array_as_uint8s(const DCPS::Encoding& encoding, size_t& size,
829  CORBA::ULong length) const;
830  bool serialize_bitmask_array_as_uints_i(DCPS::Serializer& ser,
831  const DDS::UInt8Seq& bitmask_arr) const;
832  bool serialize_bitmask_array_as_uint8s(DCPS::Serializer& ser, CORBA::ULong length) const;
833  void serialized_size_bitmask_array_as_uint16s(const DCPS::Encoding& encoding, size_t& size,
834  CORBA::ULong length) const;
835  bool serialize_bitmask_array_as_uints_i(DCPS::Serializer& ser,
836  const DDS::UInt16Seq& bitmask_arr) const;
837  bool serialize_bitmask_array_as_uint16s(DCPS::Serializer& ser, CORBA::ULong length) const;
838  void serialized_size_bitmask_array_as_uint32s(const DCPS::Encoding& encoding, size_t& size,
839  CORBA::ULong length) const;
840  bool serialize_bitmask_array_as_uints_i(DCPS::Serializer& ser,
841  const DDS::UInt32Seq& bitmask_arr) const;
842  bool serialize_bitmask_array_as_uint32s(DCPS::Serializer& ser, CORBA::ULong length) const;
843  void serialized_size_bitmask_array_as_uint64s(const DCPS::Encoding& encoding, size_t& size,
844  CORBA::ULong length) const;
845  bool serialize_bitmask_array_as_uints_i(DCPS::Serializer& ser,
846  const DDS::UInt64Seq& bitmask_arr) const;
847  bool serialize_bitmask_array_as_uint64s(DCPS::Serializer& ser, CORBA::ULong length) const;
848  void serialized_size_bitmask_array(const DCPS::Encoding& encoding, size_t& size,
849  CORBA::ULong length, CORBA::ULong bitbound) const;
850  bool serialize_bitmask_array(DCPS::Serializer& ser, CORBA::ULong bitbound,
851  CORBA::ULong length) const;
852 
853  template<typename SequenceType>
854  bool serialized_size_nesting_basic_array(const DCPS::Encoding& encoding, size_t& size,
855  const IndexToIdMap& index_to_id, SequenceType protoseq) const;
856 
857  template<typename SequenceType>
858  bool serialize_nesting_basic_array_i(DCPS::Serializer& ser, CORBA::ULong length,
859  SequenceType protoseq) const;
860  bool serialized_size_nesting_basic_array(const DCPS::Encoding& encoding, size_t& size,
861  TypeKind nested_elem_tk, const IndexToIdMap& index_to_id) const;
862  bool serialize_nesting_basic_array(DCPS::Serializer& ser, TypeKind nested_elem_tk,
863  CORBA::ULong length) const;
864  bool serialized_size_nesting_enum_array(const DCPS::Encoding& encoding, size_t& size,
865  const IndexToIdMap& index_to_id) const;
866  bool serialize_nesting_enum_array(DCPS::Serializer& ser, CORBA::ULong length) const;
867  bool serialized_size_nesting_bitmask_array(const DCPS::Encoding& encoding, size_t& size,
868  const IndexToIdMap& index_to_id) const;
869  bool serialize_nesting_bitmask_array(DCPS::Serializer& ser, CORBA::ULong length) const;
870  bool serialized_size_complex_array(const DCPS::Encoding& encoding, size_t& size,
871  const IndexToIdMap& index_to_id, const DDS::DynamicType_var& elem_type, DCPS::Sample::Extent ext) const;
872  bool serialize_complex_array(DCPS::Serializer& ser, CORBA::ULong length,
873  const DDS::DynamicType_var& elem_type, DCPS::Sample::Extent ext) const;
874  bool serialized_size_array(const DCPS::Encoding& encoding, size_t& size, DCPS::Sample::Extent ext) const;
875  bool serialize_array(DCPS::Serializer& ser, DCPS::Sample::Extent ext) const;
876 
877  bool serialized_size_primitive_member(const DCPS::Encoding& encoding, size_t& size,
878  TypeKind member_tk) const;
879 
880  bool serialized_size_basic_member_default_value(const DCPS::Encoding& encoding, size_t& size,
881  TypeKind member_tk) const;
882  bool serialized_size_basic_member(const DCPS::Encoding& encoding, size_t& size,
883  TypeKind member_tk, const_single_iterator it) const;
884  bool serialize_basic_member_default_value(DCPS::Serializer& ser, TypeKind member_tk) const;
885 
886  bool serialized_size_single_aggregated_member_xcdr2(const DCPS::Encoding& encoding, size_t& size,
887  const_single_iterator it, const DDS::DynamicType_var& member_type, bool optional,
888  DDS::ExtensibilityKind extensibility, size_t& mutable_running_total) const;
889  bool serialize_single_aggregated_member_xcdr2(DCPS::Serializer& ser, const_single_iterator it,
890  const DDS::DynamicType_var& member_type, bool optional, bool must_understand,
891  DDS::ExtensibilityKind extensibility) const;
892  bool serialized_size_complex_aggregated_member_xcdr2_default(const DCPS::Encoding& encoding,
893  size_t& size, const DDS::DynamicType_var& member_type, bool optional,
894  DDS::ExtensibilityKind extensibility, size_t& mutable_running_total, DCPS::Sample::Extent ext) const;
895  bool serialize_complex_aggregated_member_xcdr2_default(DCPS::Serializer& ser, DDS::MemberId id,
896  const DDS::DynamicType_var& member_type, bool optional, bool must_understand,
897  DDS::ExtensibilityKind extensibility, DCPS::Sample::Extent ext) const;
898  bool serialized_size_complex_aggregated_member_xcdr2(const DCPS::Encoding& encoding, size_t& size,
899  const_complex_iterator it, bool optional, DDS::ExtensibilityKind extensibility,
900  size_t& mutable_running_total, DCPS::Sample::Extent ext) const;
901  bool serialize_complex_aggregated_member_xcdr2(DCPS::Serializer& ser, const_complex_iterator it,
902  bool optional, bool must_understand, DDS::ExtensibilityKind extensibility, DCPS::Sample::Extent ext) const;
903  bool serialized_size_basic_struct_member_xcdr2(const DCPS::Encoding& encoding, size_t& size,
904  DDS::MemberId id, const DDS::DynamicType_var& member_type, bool optional,
905  DDS::ExtensibilityKind extensibility, size_t& mutable_running_total) const;
906  bool serialize_basic_struct_member_xcdr2(DCPS::Serializer& ser, DDS::MemberId id,
907  const DDS::DynamicType_var& member_type, bool optional, bool must_understand,
908  DDS::ExtensibilityKind extensibility) const;
909 
910  void serialized_size_sequence_member_default_value(const DCPS::Encoding& encoding,
911  size_t& size, TypeKind elem_tk) const;
912  bool serialize_sequence_member_default_value(DCPS::Serializer& ser, TypeKind elem_tk) const;
913 
914  bool serialized_size_basic_sequence(const DCPS::Encoding& encoding, size_t& size,
915  const_sequence_iterator it) const;
916  bool serialize_basic_sequence(DCPS::Serializer& ser, const_sequence_iterator it) const;
917  bool serialized_size_enum_sequence(const DCPS::Encoding& encoding, size_t& size,
918  const_sequence_iterator it) const;
919  bool serialize_enum_sequence(DCPS::Serializer& ser, const_sequence_iterator it) const;
920  bool serialized_size_bitmask_sequence(const DCPS::Encoding& encoding, size_t& size,
921  const_sequence_iterator it) const;
922  bool serialize_bitmask_sequence(DCPS::Serializer& ser, const_sequence_iterator it) const;
923  void serialized_size_sequence_aggregated_member_xcdr2(const DCPS::Encoding& encoding,
924  size_t& size, const_sequence_iterator it, TypeKind elem_tk, bool optional,
925  DDS::ExtensibilityKind extensibility, size_t& mutable_running_total) const;
926  bool serialize_sequence_aggregated_member_xcdr2(DCPS::Serializer& ser, const_sequence_iterator it,
927  TypeKind elem_tk, bool optional, bool must_understand, DDS::ExtensibilityKind extensibility) const;
928  bool serialized_size_sequence_struct_member_xcdr2(const DCPS::Encoding& encoding, size_t& size,
929  DDS::MemberId id, TypeKind elem_tk, bool optional,
930  DDS::ExtensibilityKind extensibility, size_t& mutable_running_total, DCPS::Sample::Extent ext) const;
931  bool serialize_sequence_struct_member_xcdr2(DCPS::Serializer& ser, DDS::MemberId id,
932  TypeKind elem_tk, bool optional, bool must_understand, DDS::ExtensibilityKind extensibility, DCPS::Sample::Extent ext) const;
933  bool serialized_size_structure_xcdr2(const DCPS::Encoding& encoding, size_t& size, DCPS::Sample::Extent ext) const;
934  bool serialize_structure_xcdr2(DCPS::Serializer& ser, DCPS::Sample::Extent ext) const;
935  bool serialized_size_structure_xcdr1(const DCPS::Encoding& encoding, size_t& size, DCPS::Sample::Extent ext) const;
936  bool serialize_structure_xcdr1(DCPS::Serializer& ser, DCPS::Sample::Extent ext) const;
937  bool serialized_size_structure(const DCPS::Encoding& encoding, size_t& size,
938  DCPS::Sample::Extent ext) const;
939  bool serialize_structure(DCPS::Serializer& ser, DCPS::Sample::Extent) const;
940 
941  bool set_default_discriminator_value(CORBA::Long& value,
942  const DDS::DynamicType_var& disc_type) const;
943  bool get_discriminator_value(CORBA::Long& value, const_single_iterator single_it,
944  const_complex_iterator complex_it, const DDS::DynamicType_var& disc_type) const;
945  bool serialized_size_discriminator_member_xcdr2(const DCPS::Encoding& encoding, size_t& size,
946  const DDS::DynamicType_var& disc_type, DDS::ExtensibilityKind extensibility,
947  size_t& mutable_running_total) const;
948  bool serialize_discriminator_member_xcdr2(DCPS::Serializer& ser, CORBA::Long value,
949  const DDS::DynamicType_var& disc_type, DDS::ExtensibilityKind extensibility) const;
950  bool serialized_size_selected_member_xcdr2(const DCPS::Encoding& encoding, size_t& size,
951  DDS::MemberId selected_id, DDS::ExtensibilityKind extensibility,
952  size_t& mutable_running_total) const;
953  bool serialize_selected_member_xcdr2(DCPS::Serializer& ser, DDS::MemberId selected_id,
954  DDS::ExtensibilityKind extensibility) const;
955  bool serialized_size_union_xcdr2(const DCPS::Encoding& encoding, size_t& size, DCPS::Sample::Extent ext) const;
956  bool serialize_union_xcdr2(DCPS::Serializer& ser, DCPS::Sample::Extent ext) const;
957  bool serialized_size_union_xcdr1(const DCPS::Encoding& encoding, size_t& size, DCPS::Sample::Extent ext) const;
958  bool serialize_union_xcdr1(DCPS::Serializer& ser, DCPS::Sample::Extent ext) const;
959  bool serialized_size_union(const DCPS::Encoding& encoding, size_t& size,
960  DCPS::Sample::Extent ext) const;
961  bool serialize_union(DCPS::Serializer& ser, DCPS::Sample::Extent ext) const;
962 
963  // Internal data
964  OPENDDS_MAP(DDS::MemberId, SingleValue) single_map_;
965  OPENDDS_MAP(DDS::MemberId, SequenceValue) sequence_map_;
966  OPENDDS_MAP(DDS::MemberId, DDS::DynamicData_var) complex_map_;
967 
968  const DDS::DynamicType_var& type_;
969  const DDS::TypeDescriptor_var& type_desc_;
971  };
972 
973  // Copy a value of a basic member from single map to a DynamicData object.
974  bool move_single_to_complex(const DataContainer::const_single_iterator& it,
975  DynamicDataImpl* data);
976  bool move_single_to_complex_i(const DataContainer::const_single_iterator& it,
977  DynamicDataImpl* data, const TypeKind treat_as);
978 
979  template<typename SequenceType>
980  void move_sequence_helper(const DataContainer::const_sequence_iterator& it,
981  DynamicDataImpl* data);
982 
983  // Copy values of a basic sequence member from sequence map to a DynamicData object.
984  bool move_sequence_to_complex(const DataContainer::const_sequence_iterator& it,
985  DynamicDataImpl* data);
986 
987  // Indicate whether the value of a member is found in the complex map or
988  // one of the other two maps or not found from any map in the container.
989  enum FoundStatus { FOUND_IN_COMPLEX_MAP, FOUND_IN_NON_COMPLEX_MAP, NOT_FOUND };
990  bool get_complex_from_aggregated(DDS::DynamicData_var& value, DDS::MemberId id,
991  FoundStatus& found_status);
992 
993  bool get_complex_from_struct(DDS::DynamicData_ptr& value, DDS::MemberId id);
994  bool write_discriminator_helper(CORBA::Long value, TypeKind treat_as);
995  bool write_discriminator(CORBA::Long value);
996  bool get_complex_from_union(DDS::DynamicData_ptr& value, DDS::MemberId id);
997  bool get_complex_from_collection(DDS::DynamicData_ptr& value, DDS::MemberId id);
998 
999  bool read_discriminator(CORBA::Long& disc_val, const DDS::DynamicType_var& disc_type,
1000  DataContainer::const_single_iterator it) const;
1001 
1002  // Add a single value for any valid discriminator value that selects the given member
1003  bool insert_valid_discriminator(DDS::MemberDescriptor* memberSelected);
1004  bool insert_discriminator(ACE_CDR::Long value);
1005  void clear_container();
1006 
1008 
1009  bool serialized_size_i(const DCPS::Encoding& encoding, size_t& size, DCPS::Sample::Extent ext) const;
1010  bool serialize_i(DCPS::Serializer& ser, DCPS::Sample::Extent ext) const;
1011 
1012  friend OpenDDS_Dcps_Export
1013  bool DCPS::serialized_size(const DCPS::Encoding& encoding, size_t& size, const DynamicDataImpl& data);
1014 
1015  friend OpenDDS_Dcps_Export
1016  bool DCPS::operator<<(DCPS::Serializer& ser, const DynamicDataImpl& data);
1017 
1018  friend OpenDDS_Dcps_Export
1020 
1021  friend OpenDDS_Dcps_Export
1022  bool DCPS::operator<<(DCPS::Serializer& ser, const DCPS::KeyOnly<const DynamicDataImpl>& data);
1023 };
1024 
1025 } // namespace XTypes
1026 } // namespace OpenDDS
1027 
1029 
1030 #endif // OPENDDS_SAFETY_PROFILE
1031 
1032 #endif // OPENDDS_DCPS_XTYPES_DYNAMIC_DATA_IMPL_H
ACE_CDR::Long Long
sequence< unsigned short > UInt16Seq
sequence< long > Int32Seq
ACE_CDR::ULong MemberId
Definition: TypeObject.h:910
sequence< wchar > WcharSeq
const LogLevel::Value value
Definition: debug.cpp:61
CORBA::Boolean operator<<(TAO_OutputCDR &, const CORBA::Object *)
Definition: Object.cpp:321
sequence< char > CharSeq
sequence< long long > Int64Seq
ACE_CDR::LongLong LongLong
#define OpenDDS_Dcps_Export
Definition: dcps_export.h:24
ACE_CDR::Short Short
DataContainer(const DataContainer &other, const DynamicDataImpl *data)
void serialized_size(const Encoding &encoding, size_t &size, const SequenceNumber &)
ACE_CDR::ULongLong ULongLong
sequence< short > Int16Seq
ACE_CDR::Octet TypeKind
Definition: TypeObject.h:210
sequence< unsigned long long > UInt64Seq
sequence< boolean > BooleanSeq
ACE_CDR::ULong ULong
typedef OPENDDS_VECTOR(MemberPair) MatchedSet
Class to serialize and deserialize data for DDS.
Definition: Serializer.h:369
ACE_CDR::Boolean operator<<(Serializer &serializer, CoherentChangeControl &value)
Marshal/Insertion into a buffer.
sequence< uint8 > UInt8Seq
ACE_CDR::Boolean Boolean
sequence< octet > ByteSeq
sequence< unsigned long > UInt32Seq
ACE_CDR::UShort UShort
sequence< long double > Float128Seq
OPENDDS_MAP(DDS::MemberId, SingleValue) typedef OPENDDS_MAP(DDS::MemberId, SequenceValue) typedef OPENDDS_MAP(DDS::MemberId, DDS::DynamicData_var) DataContainer(const DDS::DynamicType_var &type, const DynamicDataImpl *data)
const DDS::TypeDescriptor_var & type_desc_
sequence< float > Float32Seq
ACE_UINT32 ULong
ACE_INT32 Long
ExtensibilityKind
sequence< wstring > WstringSeq
ACE_CDR::Char Char
ACE_CDR::Octet Octet
#define OPENDDS_END_VERSIONED_NAMESPACE_DECL
typedef OPENDDS_MAP(TypeIdentifier, TypeObject) TypeMap
ACE_CDR::WChar WChar
sequence< int8 > Int8Seq
ACE_CDR::ULong LBound
Definition: TypeObject.h:312
const DCPS::Encoding encoding(DCPS::Encoding::KIND_UNALIGNED_CDR, DCPS::ENDIAN_BIG)
const TypeKind TK_NONE
Definition: TypeObject.h:213
sequence< double > Float64Seq
The Internal API and Implementation of OpenDDS.
Definition: AddressCache.h:28
#define SEQUENCE_VALUE_MEMBER(T, N)
sequence< string > StringSeq
Definition: DdsDcpsCore.idl:50
extensibility(MUTABLE) struct TypeLookup_getTypes_In
Definition: TypeLookup.idl:29