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

Function copy_member

dds/DCPS/XTypes/Utils.cpp:1195–1473  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1193}
1194
1195DDS::ReturnCode_t copy_member(
1196 DDS::DynamicData_ptr dest, DDS::MemberId dest_id,
1197 DDS::DynamicData_ptr src, DDS::MemberId src_id)
1198{
1199 DDS::ReturnCode_t rc = DDS::RETCODE_OK;
1200 if (dest == src) {
1201 return rc;
1202 }
1203
1204 const DDS::DynamicType_var dest_type = dest->type();
1205 DDS::DynamicType_var dest_member_type;
1206 if (dest_id != MEMBER_ID_INVALID) {
1207 rc = get_member_type(dest_member_type, dest_type, dest_id);
1208 if (rc != DDS::RETCODE_OK) {
1209 return rc;
1210 }
1211 } else {
1212 dest_member_type = get_base_type(dest_type);
1213 }
1214 const DDS::TypeKind dest_member_tk = dest_member_type->get_kind();
1215
1216 const DDS::DynamicType_var src_type = src->type();
1217 DDS::DynamicType_var src_member_type;
1218 if (src_id != MEMBER_ID_INVALID) {
1219 rc = get_member_type(src_member_type, src_type, src_id);
1220 if (rc != DDS::RETCODE_OK) {
1221 return rc;
1222 }
1223 } else {
1224 src_member_type = get_base_type(src_type);
1225 }
1226 const DDS::TypeKind src_member_tk = src_member_type->get_kind();
1227
1228 const CORBA::String_var src_type_name = src_type->get_name();
1229 const CORBA::String_var dest_type_name = dest_type->get_name();
1230 if (DCPS::DCPS_debug_level >= 8) {
1231 ACE_DEBUG((LM_DEBUG, "(%P|%t) copy_member(DynamicData): "
1232 "type %C from %C id %u to %C id %u\n",
1233 typekind_to_string(src_member_tk), src_type_name.in(), src_id, dest_type_name.in(), dest_id));
1234 }
1235
1236 if (src_member_tk != dest_member_tk) {
1237 if (log_level >= LogLevel::Warning) {
1238 ACE_ERROR((LM_WARNING, "(%P|%t) WARNING: copy_member(DynamicData): "
1239 "Can not copy member type %C id %u to type %C id %u\n",
1240 typekind_to_string(src_member_tk), src_id, typekind_to_string(dest_member_tk), dest_id));
1241 }
1242 return DDS::RETCODE_OK;
1243 }
1244
1245 DDS::ReturnCode_t get_rc = DDS::RETCODE_OK;
1246 DDS::ReturnCode_t set_rc = DDS::RETCODE_OK;
1247 switch (src_member_tk) {
1248 case TK_BOOLEAN:
1249 {
1250 DDS::Boolean value = false;
1251 get_rc = src->get_boolean_value(value, src_id);
1252 if (get_rc == DDS::RETCODE_OK) {

Callers 1

copyFunction · 0.85

Calls 15

get_base_typeFunction · 0.85
typekind_to_stringFunction · 0.85
get_int_valueFunction · 0.85
set_int_valueFunction · 0.85
get_uint_valueFunction · 0.85
set_uint_valueFunction · 0.85
retcode_to_stringFunction · 0.85
get_kindMethod · 0.80
set_boolean_valueMethod · 0.80
set_byte_valueMethod · 0.80
set_float32_valueMethod · 0.80
set_float64_valueMethod · 0.80

Tested by

no test coverage detected