MCPcopy Create free account
hub / github.com/OpenDDS/OpenDDS / enum_bound

Function enum_bound

dds/DCPS/XTypes/Utils.cpp:1072–1106  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1070}
1071
1072DDS::ReturnCode_t enum_bound(DDS::DynamicType_ptr enum_type, DDS::TypeKind& bound_kind)
1073{
1074 const DDS::TypeKind kind = enum_type->get_kind();
1075 if (kind != TK_ENUM) {
1076 if (log_level >= LogLevel::Notice) {
1077 ACE_ERROR((LM_NOTICE, "(%P|%t) NOTICE: enum_bound: "
1078 "expected enum, got %C\n",
1079 typekind_to_string(kind)));
1080 }
1081 return DDS::RETCODE_BAD_PARAMETER;
1082 }
1083
1084 DDS::TypeDescriptor_var td;
1085 const DDS::ReturnCode_t rc = enum_type->get_descriptor(td);
1086 if (rc != DDS::RETCODE_OK) {
1087 return rc;
1088 }
1089
1090 const size_t bound_size = td->bound()[0];
1091 if (bound_size >= 1 && bound_size <= 8) {
1092 bound_kind = TK_INT8;
1093 } else if (bound_size >= 9 && bound_size <= 16) {
1094 bound_kind = TK_INT16;
1095 } else if (bound_size >= 17 && bound_size <= 32) {
1096 bound_kind = TK_INT32;
1097 } else {
1098 if (log_level >= LogLevel::Notice) {
1099 ACE_ERROR((LM_NOTICE, "(%P|%t) NOTICE: enum_bound: "
1100 "Got unexpected bound size %B\n",
1101 bound_size));
1102 }
1103 return DDS::RETCODE_BAD_PARAMETER;
1104 }
1105 return DDS::RETCODE_OK;
1106}
1107
1108DDS::ReturnCode_t get_enum_value(
1109 DDS::Int32& value, DDS::DynamicType_ptr enum_type, DDS::DynamicData_ptr src, DDS::MemberId id)

Callers 15

get_single_valueMethod · 0.85
clear_value_iMethod · 0.85
set_value_to_unionMethod · 0.85
set_single_valueMethod · 0.85
get_value_from_enumMethod · 0.85

Calls 4

typekind_to_stringFunction · 0.85
get_kindMethod · 0.80
boundMethod · 0.80
get_descriptorMethod · 0.45

Tested by

no test coverage detected