Line data Source code
1 : /*
2 : * Distributed under the OpenDDS License.
3 : * See: http://www.opendds.org/license.html
4 : */
5 :
6 : #include <DCPS/DdsDcps_pch.h>
7 :
8 : #ifndef OPENDDS_SAFETY_PROFILE
9 : # include "DynamicDataBase.h"
10 :
11 : # include "Utils.h"
12 : # include "DynamicDataFactory.h"
13 :
14 : # include <dds/DCPS/debug.h>
15 : # include <dds/DCPS/ValueHelper.h>
16 : # include <dds/DCPS/DCPS_Utils.h>
17 :
18 : OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL
19 :
20 : namespace OpenDDS {
21 : namespace XTypes {
22 :
23 : using DCPS::LogLevel;
24 : using DCPS::log_level;
25 : using DCPS::retcode_to_string;
26 :
27 : namespace {
28 928 : DDS::TypeDescriptor_var get_type_desc(DDS::DynamicType_ptr type)
29 : {
30 928 : if (!type && log_level >= LogLevel::Warning) {
31 0 : ACE_ERROR((LM_WARNING, "(%P|%t) WARNING: DynamicDataBase: "
32 : "Passed null DynamicType pointer\n"));
33 0 : return DDS::TypeDescriptor_var();
34 : }
35 928 : DDS::TypeDescriptor_var td;
36 928 : const DDS::ReturnCode_t rc = type->get_descriptor(td);
37 928 : if (rc != DDS::RETCODE_OK && log_level >= LogLevel::Warning) {
38 0 : const CORBA::String_var name = type->get_name();
39 0 : ACE_ERROR((LM_WARNING, "(%P|%t) WARNING: DynamicDataBase: "
40 : "Failed to get type descriptor for %C\n", name.in()));
41 0 : }
42 928 : return td;
43 928 : }
44 : }
45 :
46 0 : DynamicDataBase::DynamicDataBase()
47 : {
48 0 : }
49 :
50 928 : DynamicDataBase::DynamicDataBase(DDS::DynamicType_ptr type)
51 928 : : type_(get_base_type(type))
52 928 : , type_desc_(get_type_desc(type_))
53 928 : {}
54 :
55 0 : DDS::DynamicData* DynamicDataBase::interface_from_this() const
56 : {
57 : // Operations defined in IDL interfaces don't use pointer-to-const
58 : // parameter types.
59 0 : return const_cast<DynamicDataBase*>(this);
60 : }
61 :
62 2209 : DDS::ReturnCode_t DynamicDataBase::get_descriptor(DDS::MemberDescriptor*& value, MemberId id)
63 : {
64 2209 : DDS::DynamicTypeMember_var dtm;
65 2209 : const DDS::ReturnCode_t rc = type_->get_member(dtm, id);
66 2209 : if (rc != DDS::RETCODE_OK) {
67 0 : return rc;
68 : }
69 2209 : return dtm->get_descriptor(value);
70 2209 : }
71 :
72 0 : DDS::ReturnCode_t DynamicDataBase::set_descriptor(
73 : DDS::MemberId /*id*/, DDS::MemberDescriptor* /*value*/)
74 : {
75 0 : return unsupported_method("DynamicData::set_descriptor");
76 : }
77 :
78 2 : DDS::MemberId DynamicDataBase::get_member_id_by_name(const char* name)
79 : {
80 2 : const TypeKind tk = type_->get_kind();
81 2 : switch (tk) {
82 0 : case TK_BOOLEAN:
83 : case TK_BYTE:
84 : case TK_INT16:
85 : case TK_INT32:
86 : case TK_INT64:
87 : case TK_UINT16:
88 : case TK_UINT32:
89 : case TK_UINT64:
90 : case TK_FLOAT32:
91 : case TK_FLOAT64:
92 : case TK_FLOAT128:
93 : case TK_INT8:
94 : case TK_UINT8:
95 : case TK_CHAR8:
96 : case TK_CHAR16:
97 : case TK_ENUM:
98 0 : return MEMBER_ID_INVALID;
99 0 : case TK_STRING8:
100 : case TK_STRING16:
101 : case TK_SEQUENCE:
102 : case TK_ARRAY:
103 : // Elements of string, sequence, array must be accessed by index.
104 0 : return MEMBER_ID_INVALID;
105 0 : case TK_MAP:
106 : // Values in map can be accessed by strings which is converted from map keys.
107 : // But need to find out how this conversion works. In the meantime, only allow
108 : // accessing map using index.
109 0 : return MEMBER_ID_INVALID;
110 2 : case TK_BITMASK:
111 : case TK_STRUCTURE:
112 : case TK_UNION: {
113 2 : DDS::DynamicTypeMember_var member;
114 2 : if (type_->get_member_by_name(member, name) != DDS::RETCODE_OK) {
115 0 : return MEMBER_ID_INVALID;
116 : }
117 2 : DDS::MemberDescriptor_var descriptor;
118 2 : if (member->get_descriptor(descriptor) != DDS::RETCODE_OK) {
119 0 : return MEMBER_ID_INVALID;
120 : }
121 2 : if (tk == TK_BITMASK) {
122 : // Bitmask's flags don't have ID, so use index instead.
123 0 : return descriptor->index();
124 : } else {
125 2 : return descriptor->id();
126 : }
127 2 : }
128 : }
129 0 : if (log_level >= LogLevel::Notice) {
130 0 : ACE_ERROR((LM_NOTICE, "(%P|%t) NOTICE: DynamicDataBase::get_member_id_by_name:"
131 : " Calling on an unexpected type %C\n", typekind_to_string(tk)));
132 : }
133 0 : return MEMBER_ID_INVALID;
134 : }
135 :
136 3076 : bool DynamicDataBase::is_type_supported(TypeKind tk, const char* func_name)
137 : {
138 3076 : if (!is_basic(tk)) {
139 0 : if (log_level >= LogLevel::Notice) {
140 0 : ACE_ERROR((LM_NOTICE, "(%P|%t) NOTICE: DynamicDataBase::is_type_supported:"
141 : " Called function %C on an unsupported type (%C)\n",
142 : func_name, typekind_to_string(tk)));
143 : }
144 0 : return false;
145 : }
146 3076 : return true;
147 : }
148 :
149 166 : bool DynamicDataBase::get_index_from_id(DDS::MemberId id, ACE_CDR::ULong& index,
150 : ACE_CDR::ULong bound) const
151 : {
152 : // The mapping from id to index must be consistent with get_member_id_at_index
153 : // for these types. In particular, index and id are equal given that it doesn't
154 : // go out of bound.
155 166 : switch (type_->get_kind()) {
156 120 : case TK_STRING8:
157 : case TK_STRING16:
158 : case TK_SEQUENCE:
159 : case TK_MAP:
160 120 : if (bound == 0 || id < bound) {
161 120 : index = id;
162 120 : return true;
163 : }
164 0 : break;
165 46 : case TK_BITMASK:
166 : case TK_ARRAY:
167 46 : if (id < bound) {
168 46 : index = id;
169 46 : return true;
170 : }
171 : }
172 0 : return false;
173 : }
174 :
175 104 : bool DynamicDataBase::enum_string_helper(char*& strInOut, MemberId id)
176 : {
177 104 : DDS::DynamicType_var mtype;
178 104 : DDS::ReturnCode_t rc = get_member_type(mtype, type_, id);
179 104 : if (rc != DDS::RETCODE_OK || mtype->get_kind() != TK_ENUM) {
180 102 : return false;
181 : }
182 : DDS::Int32 valAsInt;
183 2 : rc = get_enum_value(valAsInt, mtype, this, id);
184 2 : if (rc != DDS::RETCODE_OK) {
185 0 : return false;
186 : }
187 2 : DDS::String8_var valAsStr;
188 2 : rc = get_enumerator_name(valAsStr, valAsInt, mtype);
189 2 : if (rc != DDS::RETCODE_OK) {
190 0 : return false;
191 : }
192 2 : CORBA::string_free(strInOut);
193 2 : strInOut = valAsStr._retn();
194 2 : return true;
195 104 : }
196 :
197 2537 : DDS::ReturnCode_t DynamicDataBase::check_member(
198 : DDS::MemberDescriptor_var& md, DDS::DynamicType_var& type,
199 : const char* method, const char* action, DDS::MemberId id, DDS::TypeKind tk)
200 : {
201 2537 : DDS::ReturnCode_t rc = DDS::RETCODE_OK;
202 2537 : switch (type_->get_kind()) {
203 328 : case TK_STRING8:
204 : case TK_STRING16:
205 : case TK_SEQUENCE:
206 : case TK_ARRAY:
207 : case TK_MAP:
208 328 : type = get_base_type(type_desc_->element_type());
209 328 : break;
210 2209 : case TK_BITMASK:
211 : case TK_STRUCTURE:
212 : case TK_UNION:
213 2209 : rc = get_descriptor(md, id);
214 2209 : if (rc != DDS::RETCODE_OK) {
215 0 : return rc;
216 : }
217 2209 : type = get_base_type(md->type());
218 2209 : if (!type) {
219 0 : return DDS::RETCODE_ERROR;
220 : }
221 2209 : break;
222 0 : default:
223 0 : return DDS::RETCODE_BAD_PARAMETER;
224 : }
225 :
226 2537 : const TypeKind type_kind = type->get_kind();
227 2537 : TypeKind cmp_type_kind = type_kind;
228 2537 : switch (type_kind) {
229 181 : case TK_ENUM:
230 181 : rc = enum_bound(type, cmp_type_kind);
231 181 : if (rc != DDS::RETCODE_OK) {
232 0 : return rc;
233 : }
234 181 : break;
235 0 : case TK_BITMASK:
236 0 : rc = bitmask_bound(type, cmp_type_kind);
237 0 : if (rc != DDS::RETCODE_OK) {
238 0 : return rc;
239 : }
240 0 : break;
241 : }
242 :
243 2537 : bool invalid_tk = true;
244 2537 : if (is_basic(cmp_type_kind)) {
245 2327 : invalid_tk = cmp_type_kind != tk;
246 210 : } else if (tk == TK_NONE) {
247 210 : invalid_tk = !is_complex(type_kind);
248 : }
249 2537 : if (invalid_tk) {
250 12 : if (log_level >= LogLevel::Notice) {
251 0 : const CORBA::String_var member_name = md->name();
252 0 : const CORBA::String_var type_name = type_->get_name();
253 0 : ACE_ERROR((LM_NOTICE, "(%P|%t) NOTICE: %C: "
254 : "trying to %C %C.%C id %u kind %C (%C) as an invalid kind %C\n",
255 : method, action, type_name.in(), member_name.in(), id,
256 : typekind_to_string(cmp_type_kind), typekind_to_string(type_kind),
257 : typekind_to_string(tk)));
258 0 : }
259 12 : return DDS::RETCODE_BAD_PARAMETER;
260 : }
261 2525 : return DDS::RETCODE_OK;
262 : }
263 :
264 0 : DDS::MemberId DynamicDataBase::get_union_default_member(DDS::DynamicType* type)
265 : {
266 : //FUTURE: non-zero defaults for union discriminators are not currently represented
267 : // in the MemberDescriptors created by converting CompleteTypeObject to DynamicType.
268 : // When they are supported, change disc_default below to a value derived from the
269 : // 'type' parameter. Note that 64-bit discriminators are not represented in TypeObject.
270 : static const ACE_CDR::Long disc_default = 0;
271 0 : DDS::MemberId default_branch = MEMBER_ID_INVALID;
272 0 : const ACE_CDR::ULong members = type->get_member_count();
273 0 : for (ACE_CDR::ULong i = 0; i < members; ++i) {
274 0 : DDS::DynamicTypeMember_var member;
275 0 : if (type->get_member_by_index(member, i) != DDS::RETCODE_OK) {
276 0 : return MEMBER_ID_INVALID;
277 : }
278 0 : if (member->get_id() == DISCRIMINATOR_ID) {
279 0 : continue;
280 : }
281 0 : DDS::MemberDescriptor_var mdesc;
282 0 : if (member->get_descriptor(mdesc) != DDS::RETCODE_OK) {
283 0 : return MEMBER_ID_INVALID;
284 : }
285 0 : if (mdesc->is_default_label()) {
286 0 : default_branch = mdesc->id();
287 : } else {
288 0 : const DDS::UnionCaseLabelSeq& lseq = mdesc->label();
289 0 : for (ACE_CDR::ULong lbl = 0; lbl < lseq.length(); ++lbl) {
290 0 : if (lseq[lbl] == disc_default) {
291 0 : return mdesc->id();
292 : }
293 : }
294 : }
295 0 : }
296 : // Reaching this point means that there is no explicit label for the default
297 : // value of the discriminator. If there is a default branch, its member is
298 : // selected. Otherwise the 'MEMBER_ID_INVALID' constant is returned.
299 0 : return default_branch;
300 : }
301 :
302 52 : DDS::ReturnCode_t DynamicDataBase::get_selected_union_branch(DDS::Int32 disc,
303 : bool& found_selected_member, DDS::MemberDescriptor_var& selected_md) const
304 : {
305 52 : found_selected_member = false;
306 52 : bool has_default = false;
307 52 : DDS::ReturnCode_t rc = DDS::RETCODE_OK;
308 52 : DDS::MemberDescriptor_var default_md;
309 227 : for (DDS::UInt32 i = 0; i < type_->get_member_count(); ++i) {
310 225 : DDS::DynamicTypeMember_var dtm;
311 225 : rc = type_->get_member_by_index(dtm, i);
312 225 : if (rc != DDS::RETCODE_OK) {
313 0 : return rc;
314 : }
315 225 : if (dtm->get_id() == DISCRIMINATOR_ID) {
316 52 : continue;
317 : }
318 173 : DDS::MemberDescriptor_var md;
319 173 : rc = dtm->get_descriptor(md);
320 173 : if (rc != DDS::RETCODE_OK) {
321 0 : return rc;
322 : }
323 173 : bool found_matched_label = false;
324 173 : const DDS::UnionCaseLabelSeq labels = md->label();
325 346 : for (DDS::UInt32 j = 0; !found_matched_label && j < labels.length(); ++j) {
326 173 : if (disc == labels[j]) {
327 50 : found_matched_label = true;
328 : }
329 : }
330 173 : if (found_matched_label) {
331 50 : selected_md = md;
332 50 : found_selected_member = true;
333 50 : break;
334 : }
335 123 : if (md->is_default_label()) {
336 0 : default_md = md;
337 0 : has_default = true;
338 : }
339 325 : }
340 52 : if (!found_selected_member && has_default) {
341 0 : selected_md = default_md;
342 0 : found_selected_member = true;
343 : }
344 52 : return rc;
345 52 : }
346 :
347 37 : DDS::ReturnCode_t DynamicDataBase::get_selected_union_branch(
348 : bool& found_selected_member, DDS::MemberDescriptor_var& selected_md)
349 : {
350 : // TODO: Support UInt64 and Int64 (https://issues.omg.org/issues/DDSXTY14-36)
351 : DDS::Int64 i64_disc;
352 37 : DDS::ReturnCode_t rc = get_int64_value(i64_disc, DISCRIMINATOR_ID);
353 37 : if (rc != DDS::RETCODE_OK) {
354 0 : return rc;
355 : }
356 37 : if (i64_disc < ACE_INT32_MIN || i64_disc > ACE_INT32_MAX) {
357 0 : if (log_level >= LogLevel::Notice) {
358 0 : ACE_ERROR((LM_NOTICE, "(%P|%t) NOTICE: DynamicDataBase::get_selected_union_branch: "
359 : "union discriminator can't fit in int32: %q\n", i64_disc));
360 : }
361 0 : return DDS::RETCODE_ERROR;
362 : }
363 37 : return get_selected_union_branch(static_cast<DDS::Int32>(i64_disc), found_selected_member, selected_md);
364 : }
365 :
366 5 : bool DynamicDataBase::discriminator_selects_no_member(DDS::Int32 disc) const
367 : {
368 : bool found_selected_member;
369 5 : DDS::MemberDescriptor_var selected_md;
370 5 : const DDS::ReturnCode_t rc = get_selected_union_branch(disc, found_selected_member, selected_md);
371 5 : if (rc != DDS::RETCODE_OK) {
372 0 : if (log_level >= LogLevel::Warning) {
373 0 : ACE_ERROR((LM_WARNING, "(%P|%t) WARNING: DynamicDataBase::discriminator_selects_no_member: "
374 : "get_selected_union_branch failed: %C\n", retcode_to_string(rc)));
375 : }
376 0 : return false;
377 : }
378 5 : return !found_selected_member;
379 5 : }
380 :
381 2584 : bool DynamicDataBase::has_explicit_keys(DDS::DynamicType* dt)
382 : {
383 : // see dds_generator.h struct_has_explicit_keys() in opendds_idl
384 2584 : DDS::TypeDescriptor_var type_descriptor;
385 2584 : DDS::ReturnCode_t ret = dt->get_descriptor(type_descriptor);
386 2584 : if (ret != DDS::RETCODE_OK) {
387 0 : return false;
388 : }
389 2584 : DDS::DynamicType* const base = type_descriptor->base_type();
390 2584 : if (base && has_explicit_keys(base)) {
391 0 : return true;
392 : }
393 :
394 46754 : for (ACE_CDR::ULong i = 0; i < dt->get_member_count(); ++i) {
395 44295 : DDS::DynamicTypeMember_var member;
396 44295 : ret = dt->get_member_by_index(member, i);
397 44295 : if (ret != DDS::RETCODE_OK) {
398 0 : return false;
399 : }
400 44295 : DDS::MemberDescriptor_var descriptor;
401 44295 : ret = member->get_descriptor(descriptor);
402 44295 : if (ret != DDS::RETCODE_OK) {
403 0 : return false;
404 : }
405 44295 : if (descriptor->is_key()) {
406 125 : return true;
407 : }
408 44420 : }
409 2459 : return false;
410 2584 : }
411 :
412 0 : DDS::ReturnCode_t DynamicDataBase::unsupported_method(const char* method_name, bool warning) const
413 : {
414 0 : if (log_level >= (warning ? LogLevel::Warning : LogLevel::Notice)) {
415 0 : ACE_ERROR((warning ? LM_WARNING : LM_NOTICE, "(%P|%t) %C: %C: not implemented\n",
416 : warning ? "WARNING" : "NOTICE", method_name));
417 : }
418 0 : return DDS::RETCODE_UNSUPPORTED;
419 : }
420 :
421 : #ifndef OPENDDS_NO_CONTENT_SUBSCRIPTION_PROFILE
422 0 : DDS::ReturnCode_t DynamicDataBase::get_simple_value(DCPS::Value& /*value*/, DDS::MemberId /*id*/)
423 : {
424 0 : return unsupported_method("DynamicDataBase::get_simple_value");
425 : }
426 : #endif
427 :
428 3428 : DDS::DynamicType_ptr DynamicDataBase::type()
429 : {
430 3428 : return DDS::DynamicType::_duplicate(type_);
431 : }
432 :
433 0 : DDS::Boolean DynamicDataBase::equals(DDS::DynamicData_ptr /*other*/)
434 : {
435 0 : unsupported_method("DynamicDataBase::equals", true);
436 0 : return false;
437 : }
438 :
439 0 : DDS::DynamicData_ptr DynamicDataBase::loan_value(DDS::MemberId /*id*/)
440 : {
441 0 : unsupported_method("DynamicDataBase::loan_value");
442 0 : return 0;
443 : }
444 :
445 0 : DDS::ReturnCode_t DynamicDataBase::return_loaned_value(DDS::DynamicData_ptr /*other*/)
446 : {
447 0 : return unsupported_method("DynamicDataBase::return_loaned_value");
448 : }
449 :
450 0 : DDS::DynamicData_ptr DynamicDataBase::clone()
451 : {
452 0 : DDS::DynamicData_var new_copy = DDS::DynamicDataFactory::get_instance()->create_data(type_);
453 0 : if (!new_copy || copy(new_copy, this) != DDS::RETCODE_OK) {
454 0 : if (log_level >= LogLevel::Notice) {
455 0 : ACE_ERROR((LM_NOTICE, "(%P|%t) NOTICE: DynamicDataBase::clone: Failed to create a copy\n"));
456 : }
457 0 : return 0;
458 : }
459 0 : return new_copy._retn();
460 0 : }
461 :
462 : namespace {
463 0 : DDS::ReturnCode_t invalid_cast(const char* method, TypeKind to, TypeKind from)
464 : {
465 0 : if (log_level >= LogLevel::Notice) {
466 0 : ACE_ERROR((LM_NOTICE, "(%P|%t) NOTICE: DynamicDataBase::%C: Can't cast %C to %C\n",
467 : method, typekind_to_string(from), typekind_to_string(to)));
468 : }
469 0 : return DDS::RETCODE_ILLEGAL_OPERATION;
470 : }
471 : }
472 :
473 151 : DDS::ReturnCode_t DynamicDataBase::get_int64_value(DDS::Int64& value, DDS::MemberId id)
474 : {
475 151 : DDS::DynamicType_var member_type;
476 151 : DDS::ReturnCode_t rc = get_member_type(member_type, type_, id);
477 151 : if (rc != DDS::RETCODE_OK) {
478 0 : return rc;
479 : }
480 151 : const TypeKind tk = member_type->get_kind();
481 151 : switch (tk) {
482 0 : case TK_BOOLEAN:
483 : {
484 : DDS::Boolean tmp;
485 0 : rc = get_boolean_value(tmp, id);
486 0 : if (rc == DDS::RETCODE_OK) {
487 0 : value = static_cast<DDS::Int64>(tmp);
488 : }
489 0 : return rc;
490 : }
491 0 : case TK_BYTE:
492 : {
493 : DDS::Byte tmp;
494 0 : rc = get_byte_value(tmp, id);
495 0 : if (rc == DDS::RETCODE_OK) {
496 0 : value = static_cast<DDS::Int64>(tmp);
497 : }
498 0 : return rc;
499 : }
500 0 : case TK_INT8:
501 : case TK_INT16:
502 : case TK_INT32:
503 0 : return get_int_value(value, this, id, tk);
504 114 : case TK_INT64:
505 114 : return get_int64_value_impl(value, id);
506 27 : case TK_UINT8:
507 : case TK_UINT16:
508 : case TK_UINT32:
509 : {
510 : DDS::UInt64 tmp;
511 27 : rc = get_uint_value(tmp, this, id, tk);
512 27 : if (rc == DDS::RETCODE_OK) {
513 27 : value = static_cast<DDS::Int64>(tmp);
514 : }
515 27 : return rc;
516 : }
517 0 : case TK_CHAR8:
518 : {
519 : DDS::Char8 tmp;
520 0 : rc = get_char8_value(tmp, id);
521 0 : if (rc == DDS::RETCODE_OK) {
522 0 : value = static_cast<DDS::Int64>(tmp);
523 : }
524 0 : return rc;
525 : }
526 0 : case TK_CHAR16:
527 : {
528 : DDS::Char16 tmp;
529 0 : rc = get_char16_value(tmp, id);
530 0 : if (rc == DDS::RETCODE_OK) {
531 0 : value = static_cast<DDS::Int64>(tmp);
532 : }
533 0 : return rc;
534 : }
535 10 : case TK_ENUM:
536 : {
537 : DDS::Int32 tmp;
538 10 : rc = get_enum_value(tmp, member_type, this, id);
539 10 : if (rc == DDS::RETCODE_OK) {
540 10 : value = static_cast<DDS::Int64>(tmp);
541 : }
542 10 : return rc;
543 : }
544 0 : default:
545 0 : return invalid_cast("get_int64_value", TK_INT64, tk);
546 : }
547 151 : }
548 :
549 122 : DDS::ReturnCode_t DynamicDataBase::get_uint64_value(DDS::UInt64& value, DDS::MemberId id)
550 : {
551 122 : DDS::DynamicType_var member_type;
552 122 : DDS::ReturnCode_t rc = get_member_type(member_type, type_, id);
553 122 : if (rc != DDS::RETCODE_OK) {
554 0 : return rc;
555 : }
556 122 : const TypeKind tk = member_type->get_kind();
557 122 : switch (tk) {
558 0 : case TK_BOOLEAN:
559 : {
560 : DDS::Boolean tmp;
561 0 : rc = get_boolean_value(tmp, id);
562 0 : if (rc == DDS::RETCODE_OK) {
563 0 : value = tmp ? 1 : 0;
564 : }
565 0 : return rc;
566 : }
567 0 : case TK_BYTE:
568 : {
569 : DDS::Byte tmp;
570 0 : rc = get_byte_value(tmp, id);
571 0 : if (rc == DDS::RETCODE_OK) {
572 0 : value = static_cast<DDS::UInt64>(tmp);
573 : }
574 0 : return rc;
575 : }
576 0 : case TK_INT8:
577 : case TK_INT16:
578 : case TK_INT32:
579 : {
580 : DDS::Int64 tmp;
581 0 : rc = get_int_value(tmp, this, id, tk);
582 0 : if (rc == DDS::RETCODE_OK) {
583 0 : value = static_cast<DDS::UInt64>(tmp);
584 : }
585 0 : return rc;
586 : }
587 0 : case TK_UINT8:
588 : case TK_UINT16:
589 : case TK_UINT32:
590 0 : return get_uint_value(value, this, id, tk);
591 122 : case TK_UINT64:
592 122 : return get_uint64_value_impl(value, id);
593 0 : case TK_CHAR8:
594 : {
595 : DDS::Char8 tmp;
596 0 : rc = get_char8_value(tmp, id);
597 0 : if (rc == DDS::RETCODE_OK) {
598 0 : value = DCPS::char_value(tmp);
599 : }
600 0 : return rc;
601 : }
602 0 : case TK_CHAR16:
603 : {
604 : DDS::Char16 tmp;
605 0 : rc = get_char16_value(tmp, id);
606 0 : if (rc == DDS::RETCODE_OK) {
607 0 : value = DCPS::char_value(tmp);
608 : }
609 0 : return rc;
610 : }
611 0 : default:
612 0 : return invalid_cast("get_uint64_value", TK_UINT64, tk);
613 : }
614 122 : }
615 :
616 : } // namespace XTypes
617 : } // namespace OpenDDS
618 :
619 : OPENDDS_END_VERSIONED_NAMESPACE_DECL
620 :
621 : #endif // OPENDDS_SAFETY_PROFILE
|