8 #ifndef OPENDDS_SAFETY_PROFILE 33 switch (base_type->get_kind()) {
37 DDS::TypeDescriptor_var td;
59 const TypeKind tk = base_type->get_kind();
64 DDS::DynamicTypeMembersById_var members;
65 rc = base_type->get_all_members(members);
77 it != members_impl->
end(); ++it) {
78 DDS::MemberDescriptor_var md;
79 rc = it->second->get_descriptor(md);
84 DDS::DynamicType_ptr member_type = md->type();
93 ext = std::max(member_ext, ext);
118 "at pos %B with %B left trying to increment by %B\n",
pos,
left, by));
134 "empty or null path\n"));
142 const bool nested_member =
left > 0 ? path[0] ==
'.' :
false;
143 if (nested_member &&
pos == 0) {
146 "at pos 0 found unexpected '.'\n"));
159 for (; i <
left && scan; ++i) {
167 "at pos %B unexpected '%c' in a subscript\n",
pos + i, c));
186 "at pos %B expected to find a ']' to end subscript\n",
pos + i));
195 const char*
const expected =
in_subscript ?
"index or key" :
"member name";
198 "at pos %B expected to find %C before '%c'\n",
pos + i, expected, c));
201 "at pos %B expected to find %C before the end of the path\n",
pos + i, expected));
216 subpath.find_first_not_of(
"0123456789") != DCPS::String::npos) {
219 "\"%C\" is not a valid subscript index\n",
subpath.c_str()));
239 "given \"%C\", which contains subscripts and these are currently not supported\n",
244 DDS::DynamicTypeMember_var dtm;
251 DDS::MemberDescriptor_var md;
252 rc = dtm->get_descriptor(md);
265 "parser failed to parse \"%C\"\n", path.c_str()));
273 DDS::DynamicType_ptr type, DDS::DynamicTypeMember_var& member)
285 MemberIdVec::iterator it = ids.begin();
286 DDS::DynamicType_var current_type = DDS::DynamicType::_duplicate(type);
287 DDS::DynamicTypeMember_var current_member;
294 if (++it == ids.end()) {
298 DDS::MemberDescriptor_var md;
299 rc = current_member->get_descriptor(md);
309 member = current_member;
315 DDS::DynamicData_ptr data, DDS::DynamicData_var& container,
DDS::MemberId& member_id)
322 MemberIdVec::iterator it = ids.begin();
323 DDS::DynamicData_var current_container = DDS::DynamicData::_duplicate(data);
326 if (++it == ids.end()) {
327 member_id = current_id;
331 DDS::DynamicData_var next;
336 current_container = next;
338 container = current_container;
351 const TypeKind kind = base_type->get_kind();
355 DDS::DynamicTypeMembersById_var members;
373 it != members_i->
end(); ++it) {
374 DDS::MemberDescriptor_var md;
387 it != members_i->
end(); ++it) {
388 DDS::MemberDescriptor_var md;
393 if ((filter ==
Filter_NonKeys) != (include_all || md->is_key())) {
395 rc = get_values_i(md->type(), paths,
407 DDS::DynamicTypeMember_var disc;
410 bool include =
false;
419 DDS::MemberDescriptor_var md;
420 rc = disc->get_descriptor(md);
436 paths.push_back(this_path);
442 if (base_path.
level() == 0) {
445 "get_values was passed an invalid topic type: %C\n",
450 paths.push_back(base_path);
460 return get_values_i(type, paths, filter,
MemberPath());
473 count = paths.size();
478 bool is_key(DDS::DynamicType_ptr type,
const char* field)
484 for (
size_t i = 0; i < paths.size(); ++i) {
485 DDS::DynamicTypeMember_var m;
490 if (0 == std::strcmp(name, field)) {
498 template <
typename T>
499 void cmp(
int& result, T a, T b)
514 DDS::DynamicType_var a_type;
521 DDS::DynamicType_var b_type;
531 "trying to compare a %C to a %C\n",
544 DDS::Boolean a_value;
545 a_rc = a_data->get_boolean_value(a_value, a_id);
547 DDS::Boolean b_value;
548 b_rc = b_data->get_boolean_value(b_value, b_id);
550 cmp(result, a_value, b_value);
559 a_rc = a_data->get_byte_value(a_value, a_id);
562 b_rc = b_data->get_byte_value(b_value, b_id);
564 cmp(result, a_value, b_value);
581 cmp(result, a_value, b_value);
598 cmp(result, a_value, b_value);
607 a_rc = a_data->get_float32_value(a_value, a_id);
610 b_rc = b_data->get_float32_value(b_value, b_id);
612 cmp(result, a_value, b_value);
621 a_rc = a_data->get_float64_value(a_value, a_id);
624 b_rc = b_data->get_float64_value(b_value, b_id);
626 cmp(result, a_value, b_value);
635 a_rc = a_data->get_float128_value(a_value, a_id);
638 b_rc = b_data->get_float128_value(b_value, b_id);
640 cmp(result, a_value, b_value);
649 a_rc = a_data->get_char8_value(a_value, a_id);
652 b_rc = b_data->get_char8_value(b_value, b_id);
654 cmp(result, a_value, b_value);
663 a_rc = a_data->get_char16_value(a_value, a_id);
666 b_rc = b_data->get_char16_value(b_value, b_id);
668 cmp(result, a_value, b_value);
677 a_rc = a_data->get_string_value(a_value, a_id);
680 b_rc = b_data->get_string_value(b_value, b_id);
682 result = std::strcmp(a_value.
in(), b_value.
in());
691 a_rc = a_data->get_wstring_value(a_value, a_id);
694 b_rc = b_data->get_wstring_value(b_value, b_id);
696 result = std::wcscmp(a_value.
in(), b_value.
in());
710 cmp(result, a_value, b_value);
724 cmp(result, a_value, b_value);
740 DDS::DynamicData_var a_value;
741 a_rc = a_data->get_complex_value(a_value, a_id);
743 DDS::DynamicData_var b_value;
744 b_rc = b_data->get_complex_value(b_value, b_id);
750 const DDS::UInt32 a_count = a_value->get_item_count();
751 const DDS::UInt32 b_count = b_value->get_item_count();
752 const DDS::UInt32 count = std::min(a_count, b_count);
753 for (DDS::UInt32 i = 0;
755 a_rc = b_rc = member_compare(result,
756 a_value, a_value->get_member_id_at_index(i),
757 b_value, b_value->get_member_id_at_index(i));
759 if (result == 0 && a_count != b_count) {
760 result = count == a_count ? -1 : 1;
795 "Could not compare member type %C id %u from %C (%C) to %C (%C)\n",
807 bool& result, DDS::DynamicData_ptr a, DDS::DynamicData_ptr b,
Filter filter)
809 DDS::DynamicType_var a_type = a->type();
821 for (MemberPathVec::iterator it = paths.begin(); it != paths.end(); it++) {
822 DDS::DynamicData_var a_container;
824 rc = it->get_member_from_data(a, a_container, a_member_id);
828 "get_member_from_data for a failed: %C\n",
834 DDS::DynamicData_var b_container;
836 rc = it->get_member_from_data(b, b_container, b_member_id);
840 "get_member_from_data for b failed: %C\n",
847 rc = member_compare(compare, a_container, a_member_id, b_container, b_member_id);
852 result = compare < 0;
867 return member_compare(result, a,
id, b,
id);
873 const DDS::TypeKind container_kind = container_type->get_kind();
875 DDS::TypeDescriptor_var td;
884 "Accessing a %C DynamicData via id %u, not MEMBER_ID_INVALID\n",
887 member_type = DDS::DynamicType::_duplicate(container_type);
890 DDS::DynamicTypeMember_var dtm;
895 DDS::MemberDescriptor_var md;
896 rc = dtm->get_descriptor(md);
913 rc = src->get_uint8_value(v,
id);
922 rc = src->get_uint16_value(v,
id);
931 rc = src->get_uint32_value(v,
id);
938 rc = src->get_uint64_value(value,
id);
949 return dest->set_uint8_value(
id, static_cast<DDS::UInt8>(value));
951 return dest->set_uint16_value(
id, static_cast<DDS::UInt16>(value));
953 return dest->set_uint32_value(
id, static_cast<DDS::UInt32>(value));
955 return dest->set_uint64_value(
id, value);
968 rc = src->get_int8_value(v,
id);
977 rc = src->get_int16_value(v,
id);
986 rc = src->get_int32_value(v,
id);
993 rc = src->get_int64_value(value,
id);
1004 return dest->set_int8_value(
id, static_cast<DDS::Int8>(value));
1006 return dest->set_int16_value(
id, static_cast<DDS::Int16>(value));
1008 return dest->set_int32_value(
id, static_cast<DDS::Int32>(value));
1010 return dest->set_int64_value(
id, value);
1017 DDS::UInt32 total = 1;
1019 for (DDS::UInt32 i = 0; i < bounds.length(); ++i) {
1031 "expected bitmask, got %C\n",
1037 DDS::TypeDescriptor_var td;
1043 const size_t bound_size = td->bound()[0];
1044 if (bound_size >= 1 && bound_size <= 8) {
1046 }
else if (bound_size >= 9 && bound_size <= 16) {
1048 }
else if (bound_size >= 17 && bound_size <= 32) {
1050 }
else if (bound_size >= 33 && bound_size <= 64) {
1055 "Got unexpected bound size %B\n",
1064 DDS::UInt64&
value, DDS::DynamicType_ptr type, DDS::DynamicData_ptr src,
DDS::MemberId id)
1080 "expected enum, got %C\n",
1086 DDS::TypeDescriptor_var td;
1092 const size_t bound_size = td->bound()[0];
1093 if (bound_size >= 1 && bound_size <= 8) {
1095 }
else if (bound_size >= 9 && bound_size <= 16) {
1097 }
else if (bound_size >= 17 && bound_size <= 32) {
1102 "Got unexpected bound size %B\n",
1111 DDS::Int32&
value, DDS::DynamicType_ptr enum_type, DDS::DynamicData_ptr src,
DDS::MemberId id)
1123 value =
static_cast<DDS::Int32
>(v);
1128 DDS::String8_var&
name, DDS::Int32
value, DDS::DynamicType_ptr type)
1130 DDS::DynamicTypeMember_var dtm;
1131 DDS::ReturnCode_t rc = type->get_member(dtm, static_cast<DDS::MemberId>(value));
1136 DDS::MemberDescriptor_var md;
1137 rc = dtm->get_descriptor(md);
1147 DDS::Int32&
value,
const char*
name, DDS::DynamicType_ptr type)
1149 DDS::DynamicTypeMember_var dtm;
1155 DDS::MemberDescriptor_var md;
1156 rc = dtm->get_descriptor(md);
1161 value =
static_cast<DDS::Int32
>(md->id());
1166 DDS::DynamicType_ptr enum_type, DDS::DynamicData_ptr dest,
DDS::MemberId id, DDS::Int32
value)
1177 DDS::DynamicType_ptr type, DDS::DynamicData_ptr dest,
DDS::MemberId id,
const char* enumeral_name)
1179 DDS::DynamicTypeMember_var dtm;
1184 "No such enumeral named \"%C\"\n",
1189 DDS::MemberDescriptor_var md;
1190 rc = dtm->get_descriptor(md);
1206 const DDS::DynamicType_var dest_type = dest->type();
1207 DDS::DynamicType_var use_dest_type;
1218 const DDS::DynamicType_var src_type = src->type();
1219 DDS::DynamicType_var use_src_type;
1234 "type %C from %C id %u to %C id %u\n",
1238 if (src_tk != dest_tk) {
1241 "Can not copy member type %C id %u to type %C id %u\n",
1253 get_rc = src->get_boolean_value(value, src_id);
1255 set_rc = dest->set_boolean_value(dest_id, value);
1263 get_rc = src->get_byte_value(value, src_id);
1265 set_rc = dest->set_byte_value(dest_id, value);
1299 get_rc = src->get_float32_value(value, src_id);
1301 set_rc = dest->set_float32_value(dest_id, value);
1309 get_rc = src->get_float64_value(value, src_id);
1311 set_rc = dest->set_float64_value(dest_id, value);
1319 get_rc = src->get_float128_value(value, src_id);
1321 set_rc = dest->set_float128_value(dest_id, value);
1329 get_rc = src->get_char8_value(value, src_id);
1331 set_rc = dest->set_char8_value(dest_id, value);
1339 get_rc = src->get_char16_value(value, src_id);
1341 set_rc = dest->set_char16_value(dest_id, value);
1349 get_rc = src->get_string_value(value, src_id);
1351 set_rc = dest->set_string_value(dest_id, value);
1359 get_rc = src->get_wstring_value(value, src_id);
1361 set_rc = dest->set_wstring_value(dest_id, value);
1381 DDS::DynamicData_var subsrc;
1382 get_rc = src->get_complex_value(subsrc, src_id);
1384 DDS::DynamicData_var subdest;
1385 get_rc = dest->get_complex_value(subdest, dest_id);
1387 set_rc =
copy(subdest, subsrc);
1410 "Did not copy member type %C from %C id %u to %C id %u: get returned %C\n",
1424 DDS::MemberDescriptor_var src_md;
1427 src_member_name = src_md->name();
1430 DDS::MemberDescriptor_var dest_md;
1431 rc = dest->get_descriptor(dest_md, dest_id);
1433 dest_member_name = dest_md->name();
1436 "Could not copy member type %C from %C.%C id %u to %C.%C id %u: get: %C set: %C\n",
1438 src_type_name.
in(), src_member_name.
in() ? src_member_name.
in() :
"?", src_id,
1439 dest_type_name.
in(), dest_member_name.
in() ? dest_member_name.
in() :
"?", dest_id,
1443 "Could not copy member type %C from %C id %u to %C id %u: get: %C set: %C\n",
1460 const DDS::DynamicType_var dest_type = dest->type();
1461 const DDS::DynamicType_var actual_dest_type =
get_base_type(dest_type);
1464 const DDS::DynamicType_var src_type = src->type();
1465 const DDS::DynamicType_var actual_src_type =
get_base_type(src_type);
1468 if (src_tk != dest_tk) {
1471 "Can not copy type %C to type %C\n",
1501 if (src->get_item_count() == 2) {
1522 DDS::DynamicTypeMembersById_var src_members_var;
1523 rc = actual_src_type->get_all_members(src_members_var);
1530 DDS::DynamicTypeMembersById_var dest_members_var;
1531 rc = actual_dest_type->get_all_members(dest_members_var);
1539 src_it != src_members->
end(); ++src_it) {
1542 if (dest_it == dest_members->
end()) {
1557 const DDS::UInt32 count = src->get_item_count();
1558 for (DDS::UInt32 i = 0; i < count; ++i) {
1560 dest, dest->get_member_id_at_index(i),
1561 src, src->get_member_id_at_index(i));
1588 #endif // OPENDDS_SAFETY_PROFILE DCPS::Extensibility dds_to_opendds_ext(DDS::ExtensibilityKind ext)
const TypeKind TK_SEQUENCE
bool is_key(DDS::DynamicType_ptr type, const char *field)
DDS::ReturnCode_t key_less_than(bool &result, DDS::DynamicData_ptr a, DDS::DynamicData_ptr b)
const LogLevel::Value value
DDS::ReturnCode_t get_enumerator_value(DDS::Int32 &value, const char *name, DDS::DynamicType_ptr type)
sequence< unsigned long > BoundSeq
const TypeKind TK_STRING16
const TypeKind TK_FLOAT128
DDS::ReturnCode_t get_member_type(DDS::DynamicType_var &member_type, DDS::DynamicType_ptr container_type, DDS::MemberId id)
DDS::ReturnCode_t set_int_value(DDS::DynamicData_ptr dest, DDS::MemberId id, DDS::TypeKind kind, DDS::Int64 value)
DDS::ReturnCode_t resolve_string_path(DDS::DynamicType_ptr type, const DCPS::String &path)
DDS::DynamicType_var get_base_type(DDS::DynamicType_ptr type)
const ACE_CDR::ULong DISCRIMINATOR_ID
Implementation specific sentinel for a union discriminator used in DynamicData.
#define OPENDDS_ASSERT(C)
DDS::ReturnCode_t get_keys(DDS::DynamicType_ptr type, MemberPathVec &paths)
DDS::ReturnCode_t copy_member(DDS::DynamicData_ptr dest, DDS::MemberId dest_id, DDS::DynamicData_ptr src, DDS::MemberId src_id)
bool is_sequence_like(TypeKind tk)
DDS::ReturnCode_t compare_members(int &result, DDS::DynamicData_ptr a, DDS::DynamicData_ptr b, DDS::MemberId id)
bool get_index(DDS::UInt32 &index)
const_iterator find(MemberId key) const
const TypeKind TK_BOOLEAN
const char * typekind_to_string(TypeKind tk)
DDS::ReturnCode_t get_enum_value(DDS::Int32 &value, DDS::DynamicType_ptr enum_type, DDS::DynamicData_ptr src, DDS::MemberId id)
const TypeKind TK_BITMASK
MemberPath & id(DDS::MemberId id)
DDS::ReturnCode_t get_bitmask_value(DDS::UInt64 &value, DDS::DynamicType_ptr type, DDS::DynamicData_ptr src, DDS::MemberId id)
const_iterator begin() const
DDS::UInt32 bound_total(DDS::TypeDescriptor_var descriptor)
DDS::ReturnCode_t get_values(DDS::DynamicType_ptr type, MemberPathVec &paths, Filter filter)
const ACE_CDR::ULong MEMBER_ID_INVALID
const ReturnCode_t RETCODE_ILLEGAL_OPERATION
const TypeKind TK_STRUCTURE
DDS::ReturnCode_t less_than(bool &result, DDS::DynamicData_ptr a, DDS::DynamicData_ptr b, Filter filter)
const TypeKind TK_FLOAT32
const TypeKind TK_STRING8
DDS::ReturnCode_t get_member_from_data(DDS::DynamicData_ptr data, DDS::DynamicData_var &container, DDS::MemberId &member_id)
const ReturnCode_t RETCODE_NO_DATA
OpenDDS_Dcps_Export unsigned int DCPS_debug_level
OpenDDS_Dcps_Export LogLevel log_level
DDS::ReturnCode_t enum_bound(DDS::DynamicType_ptr enum_type, DDS::TypeKind &bound_kind)
bool is_scalar(TypeKind tk)
const char * retcode_to_string(DDS::ReturnCode_t value)
DDS::ReturnCode_t copy(DDS::DynamicData_ptr dest, DDS::DynamicData_ptr src)
#define OPENDDS_END_VERSIONED_NAMESPACE_DECL
const TypeKind TK_ANNOTATION
DDS::ReturnCode_t get_enumerator_name(DDS::String8_var &name, DDS::Int32 value, DDS::DynamicType_ptr type)
const ReturnCode_t RETCODE_OK
DDS::ReturnCode_t get_int_value(DDS::Int64 &value, DDS::DynamicData_ptr src, DDS::MemberId id, DDS::TypeKind kind)
const ReturnCode_t RETCODE_UNSUPPORTED
DDS::ReturnCode_t set_enum_value(DDS::DynamicType_ptr enum_type, DDS::DynamicData_ptr dest, DDS::MemberId id, DDS::Int32 value)
DDS::ReturnCode_t get_uint_value(DDS::UInt64 &value, DDS::DynamicData_ptr src, DDS::MemberId id, DDS::TypeKind kind)
const character_type * in(void) const
DDS::ReturnCode_t max_extensibility(DDS::DynamicType_ptr type, DCPS::Extensibility &ext)
DDS::ReturnCode_t set_uint_value(DDS::DynamicData_ptr dest, DDS::MemberId id, DDS::TypeKind kind, DDS::UInt64 value)
DDS::ReturnCode_t bitmask_bound(DDS::DynamicType_ptr type, DDS::TypeKind &bound_kind)
The Internal API and Implementation of OpenDDS.
DDS::ReturnCode_t key_count(DDS::DynamicType_ptr type, size_t &count)
const_iterator end() const
const TypeKind TK_FLOAT64
DDS::ReturnCode_t get_member_from_type(DDS::DynamicType_ptr type, DDS::DynamicTypeMember_var &member)
extensibility(MUTABLE) struct TypeLookup_getTypes_In
bool convertToInteger(const String &s, T &value)
const ReturnCode_t RETCODE_BAD_PARAMETER
MapType::const_iterator const_iterator