OpenDDS  Snapshot(2023/04/07-19:43)
Classes | Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | Friends | List of all members
OpenDDS::XTypes::DynamicDataImpl Class Reference

#include <DynamicDataImpl.h>

Inheritance diagram for OpenDDS::XTypes::DynamicDataImpl:
Inheritance graph
[legend]
Collaboration diagram for OpenDDS::XTypes::DynamicDataImpl:
Collaboration graph
[legend]

Classes

struct  DataContainer
 
struct  SequenceValue
 
struct  SingleValue
 

Public Member Functions

 DynamicDataImpl (DDS::DynamicType_ptr type)
 
 DynamicDataImpl (const DynamicDataImpl &other)
 
DDS::DynamicType_ptr type ()
 
DDS::ReturnCode_t set_descriptor (MemberId id, DDS::MemberDescriptor *value)
 
CORBA::Boolean equals (DDS::DynamicData_ptr other)
 
MemberId get_member_id_at_index (ACE_CDR::ULong index)
 
ACE_CDR::ULong get_item_count ()
 
DDS::ReturnCode_t clear_all_values ()
 
DDS::ReturnCode_t clear_nonkey_values ()
 
DDS::ReturnCode_t clear_value (DDS::MemberId id)
 
DDS::DynamicData_ptr loan_value (DDS::MemberId id)
 
DDS::ReturnCode_t return_loaned_value (DDS::DynamicData_ptr value)
 
DDS::DynamicData_ptr clone ()
 
DDS::ReturnCode_t get_int8_value (CORBA::Int8 &value, DDS::MemberId id)
 
DDS::ReturnCode_t set_int8_value (DDS::MemberId id, CORBA::Int8 value)
 
DDS::ReturnCode_t get_uint8_value (CORBA::UInt8 &value, DDS::MemberId id)
 
DDS::ReturnCode_t set_uint8_value (DDS::MemberId id, CORBA::UInt8 value)
 
DDS::ReturnCode_t get_int16_value (CORBA::Short &value, DDS::MemberId id)
 
DDS::ReturnCode_t set_int16_value (DDS::MemberId id, CORBA::Short value)
 
DDS::ReturnCode_t get_uint16_value (CORBA::UShort &value, DDS::MemberId id)
 
DDS::ReturnCode_t set_uint16_value (DDS::MemberId id, CORBA::UShort value)
 
DDS::ReturnCode_t get_int32_value (CORBA::Long &value, DDS::MemberId id)
 
DDS::ReturnCode_t set_int32_value (DDS::MemberId id, CORBA::Long value)
 
DDS::ReturnCode_t get_uint32_value (CORBA::ULong &value, DDS::MemberId)
 
DDS::ReturnCode_t set_uint32_value (DDS::MemberId id, CORBA::ULong value)
 
DDS::ReturnCode_t get_int64_value (CORBA::LongLong &value, DDS::MemberId id)
 
DDS::ReturnCode_t set_int64_value (DDS::MemberId id, CORBA::LongLong value)
 
DDS::ReturnCode_t get_uint64_value (CORBA::ULongLong &value, DDS::MemberId id)
 
DDS::ReturnCode_t set_uint64_value (DDS::MemberId id, CORBA::ULongLong value)
 
DDS::ReturnCode_t get_float32_value (CORBA::Float &value, DDS::MemberId id)
 
DDS::ReturnCode_t set_float32_value (DDS::MemberId id, CORBA::Float value)
 
DDS::ReturnCode_t get_float64_value (CORBA::Double &value, DDS::MemberId id)
 
DDS::ReturnCode_t set_float64_value (DDS::MemberId id, CORBA::Double value)
 
DDS::ReturnCode_t get_float128_value (CORBA::LongDouble &value, DDS::MemberId id)
 
DDS::ReturnCode_t set_float128_value (DDS::MemberId id, CORBA::LongDouble value)
 
DDS::ReturnCode_t get_char8_value (CORBA::Char &value, DDS::MemberId id)
 
DDS::ReturnCode_t set_char8_value (DDS::MemberId id, CORBA::Char value)
 
DDS::ReturnCode_t get_char16_value (CORBA::WChar &value, DDS::MemberId id)
 
DDS::ReturnCode_t set_char16_value (DDS::MemberId id, CORBA::WChar value)
 
DDS::ReturnCode_t get_byte_value (CORBA::Octet &value, DDS::MemberId id)
 
DDS::ReturnCode_t set_byte_value (DDS::MemberId id, CORBA::Octet value)
 
DDS::ReturnCode_t get_boolean_value (CORBA::Boolean &value, DDS::MemberId id)
 
DDS::ReturnCode_t set_boolean_value (DDS::MemberId id, CORBA::Boolean value)
 
DDS::ReturnCode_t get_string_value (char *&value, DDS::MemberId id)
 
DDS::ReturnCode_t set_string_value (DDS::MemberId id, const char *value)
 
DDS::ReturnCode_t get_wstring_value (CORBA::WChar *&value, DDS::MemberId id)
 
DDS::ReturnCode_t set_wstring_value (DDS::MemberId id, const CORBA::WChar *value)
 
DDS::ReturnCode_t get_complex_value (DDS::DynamicData_ptr &value, DDS::MemberId id)
 
DDS::ReturnCode_t set_complex_value (DDS::MemberId id, DDS::DynamicData_ptr value)
 
DDS::ReturnCode_t get_int32_values (DDS::Int32Seq &value, DDS::MemberId id)
 
DDS::ReturnCode_t set_int32_values (DDS::MemberId id, const DDS::Int32Seq &value)
 
DDS::ReturnCode_t get_uint32_values (DDS::UInt32Seq &value, DDS::MemberId id)
 
DDS::ReturnCode_t set_uint32_values (DDS::MemberId id, const DDS::UInt32Seq &value)
 
DDS::ReturnCode_t get_int8_values (DDS::Int8Seq &value, DDS::MemberId id)
 
DDS::ReturnCode_t set_int8_values (DDS::MemberId id, const DDS::Int8Seq &value)
 
DDS::ReturnCode_t get_uint8_values (DDS::UInt8Seq &value, DDS::MemberId id)
 
DDS::ReturnCode_t set_uint8_values (DDS::MemberId id, const DDS::UInt8Seq &value)
 
DDS::ReturnCode_t get_int16_values (DDS::Int16Seq &value, DDS::MemberId id)
 
DDS::ReturnCode_t set_int16_values (DDS::MemberId id, const DDS::Int16Seq &value)
 
DDS::ReturnCode_t get_uint16_values (DDS::UInt16Seq &value, DDS::MemberId id)
 
DDS::ReturnCode_t set_uint16_values (DDS::MemberId id, const DDS::UInt16Seq &value)
 
DDS::ReturnCode_t get_int64_values (DDS::Int64Seq &value, DDS::MemberId id)
 
DDS::ReturnCode_t set_int64_values (DDS::MemberId id, const DDS::Int64Seq &value)
 
DDS::ReturnCode_t get_uint64_values (DDS::UInt64Seq &value, DDS::MemberId id)
 
DDS::ReturnCode_t set_uint64_values (DDS::MemberId id, const DDS::UInt64Seq &value)
 
DDS::ReturnCode_t get_float32_values (DDS::Float32Seq &value, DDS::MemberId id)
 
DDS::ReturnCode_t set_float32_values (DDS::MemberId id, const DDS::Float32Seq &value)
 
DDS::ReturnCode_t get_float64_values (DDS::Float64Seq &value, DDS::MemberId id)
 
DDS::ReturnCode_t set_float64_values (DDS::MemberId id, const DDS::Float64Seq &value)
 
DDS::ReturnCode_t get_float128_values (DDS::Float128Seq &value, DDS::MemberId id)
 
DDS::ReturnCode_t set_float128_values (DDS::MemberId id, const DDS::Float128Seq &value)
 
DDS::ReturnCode_t get_char8_values (DDS::CharSeq &value, DDS::MemberId id)
 
DDS::ReturnCode_t set_char8_values (DDS::MemberId id, const DDS::CharSeq &value)
 
DDS::ReturnCode_t get_char16_values (DDS::WcharSeq &value, DDS::MemberId id)
 
DDS::ReturnCode_t set_char16_values (DDS::MemberId id, const DDS::WcharSeq &value)
 
DDS::ReturnCode_t get_byte_values (DDS::ByteSeq &value, DDS::MemberId id)
 
DDS::ReturnCode_t set_byte_values (DDS::MemberId id, const DDS::ByteSeq &value)
 
DDS::ReturnCode_t get_boolean_values (DDS::BooleanSeq &value, DDS::MemberId id)
 
DDS::ReturnCode_t set_boolean_values (DDS::MemberId id, const DDS::BooleanSeq &value)
 
DDS::ReturnCode_t get_string_values (DDS::StringSeq &value, DDS::MemberId id)
 
DDS::ReturnCode_t set_string_values (DDS::MemberId id, const DDS::StringSeq &value)
 
DDS::ReturnCode_t get_wstring_values (DDS::WstringSeq &value, DDS::MemberId id)
 
DDS::ReturnCode_t set_wstring_values (DDS::MemberId id, const DDS::WstringSeq &value)
 
DDS::ReturnCode_t get_simple_value (DCPS::Value &value, DDS::MemberId id)
 
template<>
bool read_basic_in_single_map (char *&value, DDS::MemberId id)
 
template<>
bool read_basic_in_single_map (CORBA::WChar *&value, DDS::MemberId id)
 
template<>
bool read_basic_member (char *&value, DDS::MemberId id)
 
template<>
bool read_basic_member (CORBA::WChar *&value, DDS::MemberId id)
 
template<>
bool get_value_from_self (char *&, DDS::MemberId)
 
template<>
bool get_value_from_self (CORBA::WChar *&, DDS::MemberId)
 
- Public Member Functions inherited from OpenDDS::XTypes::DynamicDataBase
 DynamicDataBase ()
 
 DynamicDataBase (DDS::DynamicType_ptr type)
 
DDS::ReturnCode_t get_descriptor (DDS::MemberDescriptor *&value, MemberId id)
 
DDS::MemberId get_member_id_by_name (const char *name)
 
- Public Member Functions inherited from DDS::DynamicData
DDS::ReturnCode_t get_descriptor (inout MemberDescriptor value, in MemberId id)
 
DDS::ReturnCode_t set_descriptor (in MemberId id, in MemberDescriptor value)
 
boolean equals (in DynamicData other)
 
MemberId get_member_id_by_name (in ObjectName name)
 
MemberId get_member_id_at_index (in unsigned long index)
 
DDS::ReturnCode_t clear_value (in MemberId id)
 
DynamicData loan_value (in MemberId id)
 
DDS::ReturnCode_t return_loaned_value (in DynamicData value)
 
DDS::ReturnCode_t get_int32_value (inout long value, in MemberId id)
 
DDS::ReturnCode_t set_int32_value (in MemberId id, in long value)
 
DDS::ReturnCode_t get_uint32_value (inout unsigned long value, in MemberId id)
 
DDS::ReturnCode_t set_uint32_value (in MemberId id, in unsigned long value)
 
DDS::ReturnCode_t get_int8_value (inout int8 value, in MemberId id)
 
DDS::ReturnCode_t set_int8_value (in MemberId id, in int8 value)
 
DDS::ReturnCode_t get_uint8_value (inout uint8 value, in MemberId id)
 
DDS::ReturnCode_t set_uint8_value (in MemberId id, in uint8 value)
 
DDS::ReturnCode_t get_int16_value (inout short value, in MemberId id)
 
DDS::ReturnCode_t set_int16_value (in MemberId id, in short value)
 
DDS::ReturnCode_t get_uint16_value (inout unsigned short value, in MemberId id)
 
DDS::ReturnCode_t set_uint16_value (in MemberId id, in unsigned short value)
 
DDS::ReturnCode_t get_int64_value (inout long long value, in MemberId id)
 
DDS::ReturnCode_t set_int64_value (in MemberId id, in long long value)
 
DDS::ReturnCode_t get_uint64_value (inout unsigned long long value, in MemberId id)
 
DDS::ReturnCode_t set_uint64_value (in MemberId id, in unsigned long long value)
 
DDS::ReturnCode_t get_float32_value (inout float value, in MemberId id)
 
DDS::ReturnCode_t set_float32_value (in MemberId id, in float value)
 
DDS::ReturnCode_t get_float64_value (inout double value, in MemberId id)
 
DDS::ReturnCode_t set_float64_value (in MemberId id, in double value)
 
DDS::ReturnCode_t get_float128_value (inout long double value, in MemberId id)
 
DDS::ReturnCode_t set_float128_value (in MemberId id, in long double value)
 
DDS::ReturnCode_t get_char8_value (inout char value, in MemberId id)
 
DDS::ReturnCode_t set_char8_value (in MemberId id, in char value)
 
DDS::ReturnCode_t get_char16_value (inout wchar value, in MemberId id)
 
DDS::ReturnCode_t set_char16_value (in MemberId id, in wchar value)
 
DDS::ReturnCode_t get_byte_value (inout octet value, in MemberId id)
 
DDS::ReturnCode_t set_byte_value (in MemberId id, in octet value)
 
DDS::ReturnCode_t get_boolean_value (inout boolean value, in MemberId id)
 
DDS::ReturnCode_t set_boolean_value (in MemberId id, in boolean value)
 
DDS::ReturnCode_t get_string_value (inout string value, in MemberId id)
 
DDS::ReturnCode_t set_string_value (in MemberId id, in string value)
 
DDS::ReturnCode_t get_wstring_value (inout wstring value, in MemberId id)
 
DDS::ReturnCode_t set_wstring_value (in MemberId id, in wstring value)
 
DDS::ReturnCode_t get_complex_value (inout DynamicData value, in MemberId id)
 
DDS::ReturnCode_t set_complex_value (in MemberId id, in DynamicData value)
 
DDS::ReturnCode_t get_int32_values (inout Int32Seq value, in MemberId id)
 
DDS::ReturnCode_t set_int32_values (in MemberId id, in Int32Seq value)
 
DDS::ReturnCode_t get_uint32_values (inout UInt32Seq value, in MemberId id)
 
DDS::ReturnCode_t set_uint32_values (in MemberId id, in UInt32Seq value)
 
DDS::ReturnCode_t get_int8_values (inout Int8Seq value, in MemberId id)
 
DDS::ReturnCode_t set_int8_values (in MemberId id, in Int8Seq value)
 
DDS::ReturnCode_t get_uint8_values (inout UInt8Seq value, in MemberId id)
 
DDS::ReturnCode_t set_uint8_values (in MemberId id, in UInt8Seq value)
 
DDS::ReturnCode_t get_int16_values (inout Int16Seq value, in MemberId id)
 
DDS::ReturnCode_t set_int16_values (in MemberId id, in Int16Seq value)
 
DDS::ReturnCode_t get_uint16_values (inout UInt16Seq value, in MemberId id)
 
DDS::ReturnCode_t set_uint16_values (in MemberId id, in UInt16Seq value)
 
DDS::ReturnCode_t get_int64_values (inout Int64Seq value, in MemberId id)
 
DDS::ReturnCode_t set_int64_values (in MemberId id, in Int64Seq value)
 
DDS::ReturnCode_t get_uint64_values (inout UInt64Seq value, in MemberId id)
 
DDS::ReturnCode_t set_uint64_values (in MemberId id, in UInt64Seq value)
 
DDS::ReturnCode_t get_float32_values (inout Float32Seq value, in MemberId id)
 
DDS::ReturnCode_t set_float32_values (in MemberId id, in Float32Seq value)
 
DDS::ReturnCode_t get_float64_values (inout Float64Seq value, in MemberId id)
 
DDS::ReturnCode_t set_float64_values (in MemberId id, in Float64Seq value)
 
DDS::ReturnCode_t get_float128_values (inout Float128Seq value, in MemberId id)
 
DDS::ReturnCode_t set_float128_values (in MemberId id, in Float128Seq value)
 
DDS::ReturnCode_t get_char8_values (inout CharSeq value, in MemberId id)
 
DDS::ReturnCode_t set_char8_values (in MemberId id, in CharSeq value)
 
DDS::ReturnCode_t get_char16_values (inout WcharSeq value, in MemberId id)
 
DDS::ReturnCode_t set_char16_values (in MemberId id, in WcharSeq value)
 
DDS::ReturnCode_t get_byte_values (inout ByteSeq value, in MemberId id)
 
DDS::ReturnCode_t set_byte_values (in MemberId id, in ByteSeq value)
 
DDS::ReturnCode_t get_boolean_values (inout BooleanSeq value, in MemberId id)
 
DDS::ReturnCode_t set_boolean_values (in MemberId id, in BooleanSeq value)
 
DDS::ReturnCode_t get_string_values (inout StringSeq value, in MemberId id)
 
DDS::ReturnCode_t set_string_values (in MemberId id, in StringSeq value)
 
DDS::ReturnCode_t get_wstring_values (inout WstringSeq value, in MemberId id)
 
DDS::ReturnCode_t set_wstring_values (in MemberId id, in WstringSeq value)
 
- Public Member Functions inherited from OpenDDS::DCPS::LocalObjectBase
virtual void _add_ref ()
 
virtual void _remove_ref ()
 
virtual CORBA::ULong _refcount_value () const
 
- Public Member Functions inherited from CORBA::LocalObject
virtual ~LocalObject (void)
 
virtual CORBA::Boolean _non_existent (void)
 
virtual char * _repository_id (void)
 
virtual CORBA::InterfaceDef_ptr _get_interface (void)
 
virtual CORBA::Object_ptr _get_component (void)
 
virtual void _create_request (CORBA::Context_ptr ctx, const char *operation, CORBA::NVList_ptr arg_list, CORBA::NamedValue_ptr result, CORBA::Request_ptr &request, CORBA::Flags req_flags)
 
virtual void _create_request (CORBA::Context_ptr ctx, const char *operation, CORBA::NVList_ptr arg_list, CORBA::NamedValue_ptr result, CORBA::ExceptionList_ptr exclist, CORBA::ContextList_ptr ctxtlist, CORBA::Request_ptr &request, CORBA::Flags req_flags)
 
virtual CORBA::Request_ptr _request (const char *operation)
 
CORBA::Policy_ptr _get_policy (CORBA::PolicyType type)
 
CORBA::Policy_ptr _get_cached_policy (TAO_Cached_Policy_Type type)
 
CORBA::Object_ptr _set_policy_overrides (const CORBA::PolicyList &policies, CORBA::SetOverrideType set_add)
 
CORBA::PolicyList_get_policy_overrides (const CORBA::PolicyTypeSeq &types)
 
CORBA::Boolean _validate_connection (CORBA::PolicyList_out inconsistent_policies)
 
virtual CORBA::ULong _hash (CORBA::ULong maximum)
 
virtual CORBA::Boolean _is_equivalent (CORBA::Object_ptr other_obj)
 
virtual CORBA::ORB_ptr _get_orb (void)
 
virtual TAO::ObjectKey_key (void)
 
- Public Member Functions inherited from CORBA::Object
virtual ~Object (void)
 
virtual TAO_Abstract_ServantBase_servant (void) const
 
virtual CORBA::Boolean _is_collocated (void) const
 
virtual CORBA::Boolean _is_local (void) const
 
 Object (TAO_Stub *p, CORBA::Boolean collocated=false, TAO_Abstract_ServantBase *servant=0, TAO_ORB_Core *orb_core=0)
 
 Object (IOP::IOR *ior, TAO_ORB_Core *orb_core)
 
virtual TAO_Stub_stubobj (void) const
 
virtual TAO_Stub_stubobj (void)
 
virtual void _proxy_broker (TAO::Object_Proxy_Broker *proxy_broker)
 
virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr)
 
CORBA::Boolean is_evaluated (void) const
 
TAO_ORB_Coreorb_core (void) const
 
IOP::IORsteal_ior (void)
 
const IOP::IORior (void) const
 
virtual bool can_convert_to_ior (void) const
 
virtual char * convert_to_ior (bool use_omg_ior_format, const char *ior_prefix) const
 
void _decr_refcount (void)
 
virtual CORBA::Boolean _is_a (const char *logical_type_id)
 
virtual const char * _interface_repository_id (void) const
 
CORBA::Policy_ptr _get_policy (CORBA::PolicyType type)
 
CORBA::Policy_ptr _get_cached_policy (TAO_Cached_Policy_Type type)
 
CORBA::Object_ptr _set_policy_overrides (const CORBA::PolicyList &policies, CORBA::SetOverrideType set_add)
 
CORBA::PolicyList_get_policy_overrides (const CORBA::PolicyTypeSeq &types)
 
CORBA::Boolean _validate_connection (CORBA::PolicyList_out inconsistent_policies)
 
- Public Member Functions inherited from OpenDDS::DCPS::RcObject
virtual ~RcObject ()
 
long ref_count () const
 
WeakObject_get_weak_object () const
 

Private Types

enum  FoundStatus { FOUND_IN_COMPLEX_MAP, FOUND_IN_NON_COMPLEX_MAP, NOT_FOUND }
 

Private Member Functions

DDS::ReturnCode_t get_simple_value_boolean (DCPS::Value &value, DDS::MemberId id) const
 
DDS::ReturnCode_t get_simple_value_char (DCPS::Value &value, DDS::MemberId id) const
 
template<typename ValueType >
DDS::ReturnCode_t get_simple_value_primitive (DCPS::Value &value, DDS::MemberId id) const
 
DDS::ReturnCode_t get_simple_value_string (DCPS::Value &value, DDS::MemberId id) const
 
DDS::ReturnCode_t get_simple_value_enum (DCPS::Value &value, DDS::MemberId id) const
 
CORBA::ULong get_sequence_size () const
 
void erase_member (DDS::MemberId id)
 
bool read_basic_value (ACE_OutputCDR::from_int8 &value)
 Group of functions to read a basic value represented by this DynamicData instance. More...
 
bool read_basic_value (ACE_OutputCDR::from_uint8 &value)
 
bool read_basic_value (CORBA::Short &value)
 
bool read_basic_value (CORBA::UShort &value)
 
bool read_basic_value (CORBA::Long &value)
 
bool read_basic_value (CORBA::ULong &value)
 
bool read_basic_value (CORBA::LongLong &value)
 
bool read_basic_value (CORBA::ULongLong &value)
 
bool read_basic_value (CORBA::Float &value)
 
bool read_basic_value (CORBA::Double &value)
 
bool read_basic_value (CORBA::LongDouble &value)
 
bool read_basic_value (ACE_OutputCDR::from_char &value)
 
bool read_basic_value (ACE_OutputCDR::from_wchar &value)
 
bool read_basic_value (ACE_OutputCDR::from_octet &value)
 
bool read_basic_value (ACE_OutputCDR::from_boolean &value)
 
bool read_basic_value (char *&value) const
 
void cast_to_enum_value (ACE_OutputCDR::from_int8 &dst, CORBA::Long src) const
 
void cast_to_enum_value (CORBA::Short &dst, CORBA::Long src) const
 
void cast_to_enum_value (CORBA::Long &dst, CORBA::Long src) const
 
template<typename ValueType >
void cast_to_enum_value (ValueType &dst, CORBA::Long src) const
 
template<typename ValueType >
bool read_basic_in_single_map (ValueType &value, DDS::MemberId id)
 Read a basic member from a containing type. More...
 
template<typename ValueType >
bool read_basic_in_complex_map (ValueType &value, DDS::MemberId id)
 
template<typename ValueType >
bool read_basic_member (ValueType &value, DDS::MemberId id)
 
template<typename ValueType >
bool get_value_from_self (ValueType &value, DDS::MemberId id)
 
template<TypeKind ValueTypeKind, typename ValueType >
bool get_value_from_enum (ValueType &value, DDS::MemberId id)
 
template<TypeKind ValueTypeKind, typename ValueType >
bool get_value_from_bitmask (ValueType &value, DDS::MemberId id)
 
template<TypeKind ValueTypeKind, typename ValueType >
bool get_value_from_struct (ValueType &value, DDS::MemberId id)
 
template<TypeKind ValueTypeKind, typename ValueType >
bool get_value_from_union (ValueType &value, DDS::MemberId id)
 
template<TypeKind ValueTypeKind, typename ValueType >
bool get_value_from_collection (ValueType &value, DDS::MemberId id)
 
template<TypeKind CharKind, TypeKind StringKind, typename FromCharT , typename CharT >
DDS::ReturnCode_t get_char_common (CharT &value, DDS::MemberId id)
 
template<typename UIntType >
bool get_boolean_from_bitmask (CORBA::ULong index, CORBA::Boolean &value)
 
template<TypeKind MemberTypeKind, typename MemberType >
bool set_value_to_struct (DDS::MemberId id, const MemberType &value)
 
bool cast_to_discriminator_value (CORBA::Long &disc_value, const ACE_OutputCDR::from_boolean &value) const
 
bool cast_to_discriminator_value (CORBA::Long &disc_value, const ACE_OutputCDR::from_octet &value) const
 
bool cast_to_discriminator_value (CORBA::Long &disc_value, const ACE_OutputCDR::from_char &value) const
 
bool cast_to_discriminator_value (CORBA::Long &disc_value, const ACE_OutputCDR::from_int8 &value) const
 
bool cast_to_discriminator_value (CORBA::Long &disc_value, const ACE_OutputCDR::from_uint8 &value) const
 
bool cast_to_discriminator_value (CORBA::Long &disc_value, const CORBA::Short &value) const
 
bool cast_to_discriminator_value (CORBA::Long &disc_value, const CORBA::UShort &value) const
 
bool cast_to_discriminator_value (CORBA::Long &disc_value, const CORBA::Long &value) const
 
bool cast_to_discriminator_value (CORBA::Long &disc_value, const CORBA::ULong &value) const
 
bool cast_to_discriminator_value (CORBA::Long &disc_value, const CORBA::LongLong &value) const
 
bool cast_to_discriminator_value (CORBA::Long &disc_value, const CORBA::ULongLong &value) const
 
template<typename MemberType >
bool cast_to_discriminator_value (CORBA::Long &disc_value, const MemberType &value) const
 
template<TypeKind MemberTypeKind, typename MemberType >
bool set_value_to_union (DDS::MemberId id, const MemberType &value, TypeKind enum_or_bitmask=TK_NONE, LBound lower=0, LBound upper=0)
 
template<TypeKind ElementTypeKind, typename ElementType >
bool set_value_to_collection (DDS::MemberId id, const ElementType &value, TypeKind coll_tk, TypeKind enum_or_bitmask=TK_NONE, LBound lower=0, LBound upper=0)
 
template<TypeKind ValueTypeKind, typename ValueType >
DDS::ReturnCode_t set_single_value (DDS::MemberId id, const ValueType &value, TypeKind enum_or_bitmask=TK_NONE, LBound lower=0, LBound upper=0)
 
template<TypeKind CharKind, TypeKind StringKind, typename FromCharT >
DDS::ReturnCode_t set_char_common (DDS::MemberId id, const FromCharT &value)
 
bool check_index_from_id (TypeKind tk, DDS::MemberId id, CORBA::ULong bound) const
 
bool is_default_member_selected (CORBA::Long disc_val, DDS::MemberId default_id) const
 
bool read_discriminator (CORBA::Long &disc_val) const
 
DDS::MemberId find_selected_member () const
 
bool validate_discriminator (CORBA::Long disc_val, const DDS::MemberDescriptor_var &md) const
 
bool set_complex_to_struct (DDS::MemberId id, DDS::DynamicData_var value)
 
bool set_complex_to_union (DDS::MemberId id, DDS::DynamicData_var value, const DDS::TypeDescriptor_var &descriptor)
 
bool set_complex_to_collection (DDS::MemberId id, DDS::DynamicData_var value, TypeKind tk)
 
bool validate_member_id_collection (const DDS::TypeDescriptor_var &descriptor, DDS::MemberId id, TypeKind collection_tk) const
 
DDS::ReturnCode_t clear_value_i (DDS::MemberId id, const DDS::DynamicType_var &member_type)
 
bool insert_single (DDS::MemberId id, const ACE_OutputCDR::from_int8 &value)
 
bool insert_single (DDS::MemberId id, const ACE_OutputCDR::from_uint8 &value)
 
bool insert_single (DDS::MemberId id, const ACE_OutputCDR::from_char &value)
 
bool insert_single (DDS::MemberId id, const ACE_OutputCDR::from_octet &value)
 
bool insert_single (DDS::MemberId id, const ACE_OutputCDR::from_boolean &value)
 
template<typename SingleType >
bool insert_single (DDS::MemberId id, const SingleType &value)
 
bool insert_complex (DDS::MemberId id, const DDS::DynamicData_var &value)
 
template<typename SequenceType >
bool insert_sequence (DDS::MemberId id, const SequenceType &value)
 
template<TypeKind ElementTypeKind>
bool check_seqmem_in_struct_and_union (DDS::MemberId id, TypeKind enum_or_bitmask, LBound lower, LBound upper) const
 
template<TypeKind ElementTypeKind>
bool check_seqmem_in_sequence_and_array (DDS::MemberId id, CORBA::ULong bound, TypeKind enum_or_bitmask, LBound lower, LBound upper) const
 
template<TypeKind ElementTypeKind, typename SequenceType >
bool set_values_to_struct (DDS::MemberId id, const SequenceType &value, TypeKind enum_or_bitmask, LBound lower, LBound upper)
 
template<TypeKind ElementTypeKind, typename SequenceType >
bool set_values_to_union (DDS::MemberId id, const SequenceType &value, TypeKind enum_or_bitmask, LBound lower, LBound upper)
 
template<TypeKind ElementTypeKind, typename SequenceType >
bool set_values_to_sequence (DDS::MemberId id, const SequenceType &value, TypeKind enum_or_bitmask, LBound lower, LBound upper)
 
template<TypeKind ElementTypeKind, typename SequenceType >
bool set_values_to_array (DDS::MemberId id, const SequenceType &value, TypeKind enum_or_bitmask, LBound lower, LBound upper)
 
template<TypeKind ElementTypeKind, typename SequenceType >
DDS::ReturnCode_t set_sequence_values (DDS::MemberId id, const SequenceType &value, TypeKind enum_or_bitmask=TK_NONE, LBound lower=0, LBound upper=0)
 
template<TypeKind ValueTypeKind, typename ValueType >
DDS::ReturnCode_t get_single_value (ValueType &value, DDS::MemberId id)
 
typedef OPENDDS_VECTOR (CORBA::ULong) IndexToIdMap
 
bool move_single_to_complex (const DataContainer::const_single_iterator &it, DynamicDataImpl *data)
 
bool move_single_to_complex_i (const DataContainer::const_single_iterator &it, DynamicDataImpl *data, const TypeKind treat_as)
 
template<typename SequenceType >
void move_sequence_helper (const DataContainer::const_sequence_iterator &it, DynamicDataImpl *data)
 
bool move_sequence_to_complex (const DataContainer::const_sequence_iterator &it, DynamicDataImpl *data)
 
bool get_complex_from_aggregated (DDS::DynamicData_var &value, DDS::MemberId id, FoundStatus &found_status)
 
bool get_complex_from_struct (DDS::DynamicData_ptr &value, DDS::MemberId id)
 
bool write_discriminator_helper (CORBA::Long value, TypeKind treat_as)
 
bool write_discriminator (CORBA::Long value)
 
bool get_complex_from_union (DDS::DynamicData_ptr &value, DDS::MemberId id)
 
bool get_complex_from_collection (DDS::DynamicData_ptr &value, DDS::MemberId id)
 
bool read_discriminator (CORBA::Long &disc_val, const DDS::DynamicType_var &disc_type, DataContainer::const_single_iterator it) const
 
bool insert_valid_discriminator (DDS::MemberDescriptor *memberSelected)
 
bool insert_discriminator (ACE_CDR::Long value)
 
void clear_container ()
 
bool serialized_size_i (const DCPS::Encoding &encoding, size_t &size, DCPS::Sample::Extent ext) const
 
bool serialize_i (DCPS::Serializer &ser, DCPS::Sample::Extent ext) const
 
template<>
bool get_value_from_enum (char *&, DDS::MemberId)
 
template<>
bool get_value_from_enum (CORBA::WChar *&, DDS::MemberId)
 
template<>
bool get_value_from_bitmask (char *&, DDS::MemberId)
 
template<>
bool get_value_from_bitmask (CORBA::WChar *&, DDS::MemberId)
 

Static Private Member Functions

static bool is_valid_discriminator_type (TypeKind tk)
 

Private Attributes

DataContainer container_
 

Friends

OpenDDS_Dcps_Export bool DCPS::serialized_size (const DCPS::Encoding &encoding, size_t &size, const DynamicDataImpl &data)
 
OpenDDS_Dcps_Export bool DCPS::operator<< (DCPS::Serializer &ser, const DynamicDataImpl &data)
 
OpenDDS_Dcps_Export bool DCPS::serialized_size (const DCPS::Encoding &encoding, size_t &size, const DCPS::KeyOnly< const DynamicDataImpl > &data)
 
OpenDDS_Dcps_Export bool DCPS::operator<< (DCPS::Serializer &ser, const DCPS::KeyOnly< const DynamicDataImpl > &data)
 

Additional Inherited Members

- Public Types inherited from OpenDDS::DCPS::LocalObject< DDS::DynamicData >
typedef DDS::DynamicData ::_ptr_type _ptr_type
 
typedef DDS::DynamicData ::_var_type _var_type
 
- Public Types inherited from CORBA::LocalObject
typedef LocalObject_ptr _ptr_type
 
typedef LocalObject_var _var_type
 
typedef LocalObject_out _out_type
 
- Public Types inherited from CORBA::Object
typedef Object_ptr _ptr_type
 
typedef Object_var _var_type
 
typedef Object_out _out_type
 
- Static Public Member Functions inherited from OpenDDS::XTypes::DynamicDataBase
static bool has_explicit_keys (DDS::DynamicType *dt)
 
static bool exclude_member (DCPS::Sample::Extent ext, bool is_key, bool has_explicit_keys)
 
static DCPS::Sample::Extent nested (DCPS::Sample::Extent ext)
 
- Static Public Member Functions inherited from OpenDDS::DCPS::LocalObject< DDS::DynamicData >
static _ptr_type _narrow (CORBA::Object_ptr obj)
 
- Static Public Member Functions inherited from CORBA::LocalObject
static LocalObject_ptr _duplicate (LocalObject_ptr obj)
 
static LocalObject_ptr _nil (void)
 
static LocalObject_ptr _narrow (CORBA::Object_ptr obj)
 
- Static Public Member Functions inherited from CORBA::Object
static CORBA::Boolean marshal (const Object_ptr x, TAO_OutputCDR &cdr)
 
static void _tao_any_destructor (void *)
 
static CORBA::Boolean is_nil_i (CORBA::Object_ptr obj)
 
static void tao_object_initialize (Object *)
 
static CORBA::Object_ptr _duplicate (CORBA::Object_ptr obj)
 
static CORBA::Object_ptr _nil (void)
 
static CORBA::Object_ptr _narrow (CORBA::Object_ptr obj)
 
- Public Attributes inherited from DDS::DynamicData
readonly attribute DynamicType type
 
- Protected Member Functions inherited from OpenDDS::XTypes::DynamicDataBase
bool is_type_supported (TypeKind tk, const char *func_name)
 
bool is_primitive (TypeKind tk) const
 
bool is_basic (TypeKind tk) const
 
bool is_complex (TypeKind tk) const
 
bool get_index_from_id (DDS::MemberId id, ACE_CDR::ULong &index, ACE_CDR::ULong bound) const
 
bool enum_string_helper (char *&strInOut, MemberId id)
 
DDS::ReturnCode_t check_member (DDS::MemberDescriptor_var &md, DDS::DynamicType_var &type, const char *method, const char *what, DDS::MemberId id, DDS::TypeKind tk)
 
DDS::DynamicDatainterface_from_this () const
 
- Protected Member Functions inherited from CORBA::LocalObject
 LocalObject (void)
 
- Protected Member Functions inherited from CORBA::Object
 Object (int dummy=0)
 
TAO::Object_Proxy_Brokerproxy_broker () const
 
- Protected Member Functions inherited from OpenDDS::DCPS::RcObject
 RcObject ()
 
- Static Protected Member Functions inherited from OpenDDS::XTypes::DynamicDataBase
static CORBA::ULong bound_total (DDS::TypeDescriptor_var descriptor)
 
static DDS::MemberId get_union_default_member (DDS::DynamicType *type)
 
static bool discriminator_selects_no_member (DDS::DynamicType *type, ACE_CDR::Long disc)
 
- Protected Attributes inherited from OpenDDS::XTypes::DynamicDataBase
DDS::DynamicType_var type_
 The actual (i.e., non-alias) DynamicType of the associated type. More...
 
- Protected Attributes inherited from CORBA::Object
ACE_Atomic_Op< TAO_SYNCH_MUTEX, unsigned long > refcount_
 

Detailed Description

Definition at line 36 of file DynamicDataImpl.h.

Member Enumeration Documentation

◆ FoundStatus

Constructor & Destructor Documentation

◆ DynamicDataImpl() [1/2]

OpenDDS::XTypes::DynamicDataImpl::DynamicDataImpl ( DDS::DynamicType_ptr  type)
explicit

◆ DynamicDataImpl() [2/2]

OpenDDS::XTypes::DynamicDataImpl::DynamicDataImpl ( const DynamicDataImpl other)

Definition at line 32 of file DynamicDataImpl.cpp.

33  : CORBA::Object()
34  , DynamicData()
36  , DCPS::RcObject()
37  , DynamicDataBase(other.type_)
38  , container_(other.container_, this)
39 {}

Member Function Documentation

◆ cast_to_discriminator_value() [1/12]

bool OpenDDS::XTypes::DynamicDataImpl::cast_to_discriminator_value ( CORBA::Long disc_value,
const ACE_OutputCDR::from_boolean value 
) const
private

Definition at line 1363 of file DynamicDataImpl.cpp.

References ACE_OutputCDR::from_boolean::val_.

Referenced by cast_to_discriminator_value(), get_value_from_union(), and set_value_to_union().

1365 {
1366  disc_value = static_cast<CORBA::Long>(value.val_);
1367  return true;
1368 }
ACE_CDR::Long Long

◆ cast_to_discriminator_value() [2/12]

bool OpenDDS::XTypes::DynamicDataImpl::cast_to_discriminator_value ( CORBA::Long disc_value,
const ACE_OutputCDR::from_octet value 
) const
private

Definition at line 1370 of file DynamicDataImpl.cpp.

References ACE_OutputCDR::from_octet::val_.

1372 {
1373  disc_value = static_cast<CORBA::Long>(value.val_);
1374  return true;
1375 }
ACE_CDR::Long Long

◆ cast_to_discriminator_value() [3/12]

bool OpenDDS::XTypes::DynamicDataImpl::cast_to_discriminator_value ( CORBA::Long disc_value,
const ACE_OutputCDR::from_char value 
) const
private

Definition at line 1377 of file DynamicDataImpl.cpp.

References cast_to_discriminator_value(), ACE_OutputCDR::from_wchar::val_, and ACE_OutputCDR::from_char::val_.

1379 {
1380  disc_value = static_cast<CORBA::Long>(value.val_);
1381  return true;
1382 }
ACE_CDR::Long Long

◆ cast_to_discriminator_value() [4/12]

bool OpenDDS::XTypes::DynamicDataImpl::cast_to_discriminator_value ( CORBA::Long disc_value,
const ACE_OutputCDR::from_int8 value 
) const
private

Definition at line 1393 of file DynamicDataImpl.cpp.

References ACE_OutputCDR::from_int8::val_.

1395 {
1396  disc_value = static_cast<CORBA::Long>(value.val_);
1397  return true;
1398 }
ACE_CDR::Long Long

◆ cast_to_discriminator_value() [5/12]

bool OpenDDS::XTypes::DynamicDataImpl::cast_to_discriminator_value ( CORBA::Long disc_value,
const ACE_OutputCDR::from_uint8 value 
) const
private

Definition at line 1400 of file DynamicDataImpl.cpp.

References ACE_OutputCDR::from_uint8::val_.

1402 {
1403  disc_value = static_cast<CORBA::Long>(value.val_);
1404  return true;
1405 }
ACE_CDR::Long Long

◆ cast_to_discriminator_value() [6/12]

bool OpenDDS::XTypes::DynamicDataImpl::cast_to_discriminator_value ( CORBA::Long disc_value,
const CORBA::Short value 
) const
private

Definition at line 1407 of file DynamicDataImpl.cpp.

References value.

1409 {
1410  disc_value = static_cast<CORBA::Long>(value);
1411  return true;
1412 }
ACE_CDR::Long Long
const LogLevel::Value value
Definition: debug.cpp:61

◆ cast_to_discriminator_value() [7/12]

bool OpenDDS::XTypes::DynamicDataImpl::cast_to_discriminator_value ( CORBA::Long disc_value,
const CORBA::UShort value 
) const
private

Definition at line 1414 of file DynamicDataImpl.cpp.

References value.

1416 {
1417  disc_value = static_cast<CORBA::Long>(value);
1418  return true;
1419 }
ACE_CDR::Long Long
const LogLevel::Value value
Definition: debug.cpp:61

◆ cast_to_discriminator_value() [8/12]

bool OpenDDS::XTypes::DynamicDataImpl::cast_to_discriminator_value ( CORBA::Long disc_value,
const CORBA::Long value 
) const
private

Definition at line 1421 of file DynamicDataImpl.cpp.

References value.

1423 {
1424  disc_value = value;
1425  return true;
1426 }
const LogLevel::Value value
Definition: debug.cpp:61

◆ cast_to_discriminator_value() [9/12]

bool OpenDDS::XTypes::DynamicDataImpl::cast_to_discriminator_value ( CORBA::Long disc_value,
const CORBA::ULong value 
) const
private

Definition at line 1428 of file DynamicDataImpl.cpp.

References value.

1430 {
1431  disc_value = static_cast<CORBA::Long>(value);
1432  return true;
1433 }
ACE_CDR::Long Long
const LogLevel::Value value
Definition: debug.cpp:61

◆ cast_to_discriminator_value() [10/12]

bool OpenDDS::XTypes::DynamicDataImpl::cast_to_discriminator_value ( CORBA::Long disc_value,
const CORBA::LongLong value 
) const
private

Definition at line 1435 of file DynamicDataImpl.cpp.

References value.

1437 {
1438  disc_value = static_cast<CORBA::Long>(value);
1439  return true;
1440 }
ACE_CDR::Long Long
const LogLevel::Value value
Definition: debug.cpp:61

◆ cast_to_discriminator_value() [11/12]

bool OpenDDS::XTypes::DynamicDataImpl::cast_to_discriminator_value ( CORBA::Long disc_value,
const CORBA::ULongLong value 
) const
private

Definition at line 1442 of file DynamicDataImpl.cpp.

References value.

1444 {
1445  disc_value = static_cast<CORBA::Long>(value);
1446  return true;
1447 }
ACE_CDR::Long Long
const LogLevel::Value value
Definition: debug.cpp:61

◆ cast_to_discriminator_value() [12/12]

template<typename MemberType >
bool OpenDDS::XTypes::DynamicDataImpl::cast_to_discriminator_value ( CORBA::Long disc_value,
const MemberType &  value 
) const
private

Definition at line 1450 of file DynamicDataImpl.cpp.

1452 {
1453  return false;
1454 }

◆ cast_to_enum_value() [1/4]

void OpenDDS::XTypes::DynamicDataImpl::cast_to_enum_value ( ACE_OutputCDR::from_int8 dst,
CORBA::Long  src 
) const
private

Definition at line 2952 of file DynamicDataImpl.cpp.

Referenced by get_value_from_enum().

2953 {
2954  dst = ACE_OutputCDR::from_int8(static_cast<CORBA::Int8>(src));
2955 }

◆ cast_to_enum_value() [2/4]

void OpenDDS::XTypes::DynamicDataImpl::cast_to_enum_value ( CORBA::Short dst,
CORBA::Long  src 
) const
private

Definition at line 2957 of file DynamicDataImpl.cpp.

2958 {
2959  dst = static_cast<CORBA::Short>(src);
2960 }
ACE_CDR::Short Short

◆ cast_to_enum_value() [3/4]

void OpenDDS::XTypes::DynamicDataImpl::cast_to_enum_value ( CORBA::Long dst,
CORBA::Long  src 
) const
private

Definition at line 2962 of file DynamicDataImpl.cpp.

2963 {
2964  dst = src;
2965 }

◆ cast_to_enum_value() [4/4]

template<typename ValueType >
void OpenDDS::XTypes::DynamicDataImpl::cast_to_enum_value ( ValueType &  dst,
CORBA::Long  src 
) const
private

Definition at line 2968 of file DynamicDataImpl.cpp.

2969 {}

◆ check_index_from_id()

bool OpenDDS::XTypes::DynamicDataImpl::check_index_from_id ( TypeKind  tk,
DDS::MemberId  id,
CORBA::ULong  bound 
) const
private

Definition at line 1632 of file DynamicDataImpl.cpp.

References OpenDDS::XTypes::TK_ARRAY, OpenDDS::XTypes::TK_BITMASK, OpenDDS::XTypes::TK_MAP, OpenDDS::XTypes::TK_SEQUENCE, OpenDDS::XTypes::TK_STRING16, and OpenDDS::XTypes::TK_STRING8.

Referenced by check_seqmem_in_sequence_and_array(), set_boolean_value(), set_char_common(), and validate_member_id_collection().

1633 {
1634  // The given Id is treated as index.
1635  switch (tk) {
1636  case TK_STRING8:
1637  case TK_STRING16:
1638  case TK_SEQUENCE:
1639  case TK_MAP:
1640  // Bound of 0 means unbounded.
1641  if (bound == 0 || id < bound) {
1642  return true;
1643  }
1644  break;
1645  case TK_BITMASK:
1646  case TK_ARRAY:
1647  if (id < bound) {
1648  return true;
1649  }
1650  break;
1651  }
1652  return false;
1653 }
const TypeKind TK_STRING16
Definition: TypeObject.h:232
const TypeKind TK_BITMASK
Definition: TypeObject.h:239
const TypeKind TK_STRING8
Definition: TypeObject.h:231
const TypeKind TK_SEQUENCE
Definition: TypeObject.h:248
const TypeKind TK_ARRAY
Definition: TypeObject.h:249
const TypeKind TK_MAP
Definition: TypeObject.h:250

◆ check_seqmem_in_sequence_and_array()

template<TypeKind ElementTypeKind>
bool OpenDDS::XTypes::DynamicDataImpl::check_seqmem_in_sequence_and_array ( DDS::MemberId  id,
CORBA::ULong  bound,
TypeKind  enum_or_bitmask,
LBound  lower,
LBound  upper 
) const
private

Definition at line 2365 of file DynamicDataImpl.cpp.

References check_index_from_id(), OpenDDS::XTypes::get_base_type(), DDS::RETCODE_OK, OpenDDS::XTypes::TK_SEQUENCE, and OpenDDS::XTypes::DynamicDataBase::type_.

2367 {
2368  if (!check_index_from_id(type_->get_kind(), id, bound)) {
2369  return false;
2370  }
2371  DDS::TypeDescriptor_var descriptor;
2372  if (type_->get_descriptor(descriptor) != DDS::RETCODE_OK) {
2373  return false;
2374  }
2375 
2376  const DDS::DynamicType_var elem_type = get_base_type(descriptor->element_type());
2377  const TypeKind elem_tk = elem_type->get_kind();
2378  if (elem_tk != TK_SEQUENCE) {
2379  return false;
2380  }
2381 
2382  DDS::TypeDescriptor_var elem_td;
2383  if (elem_type->get_descriptor(elem_td) != DDS::RETCODE_OK) {
2384  return false;
2385  }
2386 
2387  const DDS::DynamicType_var nested_elem_type = get_base_type(elem_td->element_type());
2388  const TypeKind nested_elem_tk = nested_elem_type->get_kind();
2389  if (nested_elem_tk != ElementTypeKind && nested_elem_tk != enum_or_bitmask) {
2390  return false;
2391  }
2392  if (nested_elem_tk == enum_or_bitmask) {
2393  DDS::TypeDescriptor_var nested_elem_td;
2394  if (nested_elem_type->get_descriptor(nested_elem_td) != DDS::RETCODE_OK) {
2395  return false;
2396  }
2397  const CORBA::ULong bit_bound = nested_elem_td->bound()[0];
2398  if (bit_bound < lower || bit_bound > upper) {
2399  return false;
2400  }
2401  }
2402  return true;
2403 }
DDS::DynamicType_var type_
The actual (i.e., non-alias) DynamicType of the associated type.
const ReturnCode_t RETCODE_OK
DDS::DynamicType_var get_base_type(DDS::DynamicType_ptr type)
ACE_CDR::ULong ULong
bool check_index_from_id(TypeKind tk, DDS::MemberId id, CORBA::ULong bound) const
const TypeKind TK_SEQUENCE
Definition: TypeObject.h:248
ACE_CDR::Octet TypeKind
Definition: TypeObject.h:210

◆ check_seqmem_in_struct_and_union()

template<TypeKind ElementTypeKind>
bool OpenDDS::XTypes::DynamicDataImpl::check_seqmem_in_struct_and_union ( DDS::MemberId  id,
TypeKind  enum_or_bitmask,
LBound  lower,
LBound  upper 
) const
private

Definition at line 2282 of file DynamicDataImpl.cpp.

References OpenDDS::XTypes::get_base_type(), DDS::RETCODE_OK, OpenDDS::XTypes::TK_SEQUENCE, and OpenDDS::XTypes::DynamicDataBase::type_.

2284 {
2285  DDS::DynamicTypeMember_var member;
2286  if (type_->get_member(member, id)) {
2287  return false;
2288  }
2289  DDS::MemberDescriptor_var md;
2290  if (member->get_descriptor(md) != DDS::RETCODE_OK) {
2291  return false;
2292  }
2293 
2294  const DDS::DynamicType_var member_type = get_base_type(md->type());
2295  const TypeKind member_tk = member_type->get_kind();
2296  if (member_tk != TK_SEQUENCE) {
2297  return false;
2298  }
2299 
2300  DDS::TypeDescriptor_var member_td;
2301  if (member_type->get_descriptor(member_td) != DDS::RETCODE_OK) {
2302  return false;
2303  }
2304 
2305  const DDS::DynamicType_var elem_type = get_base_type(member_td->element_type());
2306  const TypeKind elem_tk = elem_type->get_kind();
2307  if (elem_tk != ElementTypeKind && elem_tk != enum_or_bitmask) {
2308  return false;
2309  }
2310 
2311  if (elem_tk == enum_or_bitmask) {
2312  DDS::TypeDescriptor_var elem_td;
2313  if (elem_type->get_descriptor(elem_td) != DDS::RETCODE_OK) {
2314  return false;
2315  }
2316  const CORBA::ULong bit_bound = elem_td->bound()[0];
2317  if (bit_bound < lower || bit_bound > upper) {
2318  return false;
2319  }
2320  }
2321  return true;
2322 }
DDS::DynamicType_var type_
The actual (i.e., non-alias) DynamicType of the associated type.
const ReturnCode_t RETCODE_OK
DDS::DynamicType_var get_base_type(DDS::DynamicType_ptr type)
ACE_CDR::ULong ULong
const TypeKind TK_SEQUENCE
Definition: TypeObject.h:248
ACE_CDR::Octet TypeKind
Definition: TypeObject.h:210

◆ clear_all_values()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::clear_all_values ( )

Implements DDS::DynamicData.

Definition at line 328 of file DynamicDataImpl.cpp.

References ACE_ERROR, clear_container(), clear_value_i(), OpenDDS::XTypes::DynamicDataBase::is_primitive(), LM_NOTICE, OpenDDS::DCPS::log_level, OpenDDS::XTypes::MEMBER_ID_INVALID, OpenDDS::DCPS::LogLevel::Notice, DDS::RETCODE_ERROR, DDS::RETCODE_OK, OpenDDS::XTypes::TK_ALIAS, OpenDDS::XTypes::TK_ANNOTATION, OpenDDS::XTypes::TK_ARRAY, OpenDDS::XTypes::TK_BITMASK, OpenDDS::XTypes::TK_BITSET, OpenDDS::XTypes::TK_ENUM, OpenDDS::XTypes::TK_MAP, OpenDDS::XTypes::TK_SEQUENCE, OpenDDS::XTypes::TK_STRING16, OpenDDS::XTypes::TK_STRING8, OpenDDS::XTypes::TK_STRUCTURE, OpenDDS::XTypes::TK_UNION, OpenDDS::XTypes::DynamicDataBase::type_, and OpenDDS::XTypes::typekind_to_string().

329 {
330  const TypeKind tk = type_->get_kind();
331  if (is_primitive(tk) || tk == TK_ENUM) {
333  }
334 
335  switch (tk) {
336  case TK_BITMASK:
337  case TK_ARRAY:
338  case TK_STRING8:
339 #ifdef DDS_HAS_WCHAR
340  case TK_STRING16:
341 #endif
342  case TK_SEQUENCE:
343  case TK_STRUCTURE:
344  case TK_UNION:
345  clear_container();
346  break;
347  case TK_MAP:
348  case TK_BITSET:
349  case TK_ALIAS:
350  case TK_ANNOTATION:
351  default:
352  if (log_level >= LogLevel::Notice) {
353  ACE_ERROR((LM_NOTICE, "(%P|%t) NOTICE: DynamicDataImpl::clear_all_values:"
354  " Encounter unexpected type kind %C\n", typekind_to_string(tk)));
355  }
356  return DDS::RETCODE_ERROR;
357  }
358  return DDS::RETCODE_OK;
359 }
OpenDDS_Dcps_Export LogLevel log_level
#define ACE_ERROR(X)
const TypeKind TK_ANNOTATION
Definition: TypeObject.h:242
DDS::DynamicType_var type_
The actual (i.e., non-alias) DynamicType of the associated type.
const ReturnCode_t RETCODE_OK
const TypeKind TK_ALIAS
Definition: TypeObject.h:235
const TypeKind TK_STRING16
Definition: TypeObject.h:232
const TypeKind TK_STRUCTURE
Definition: TypeObject.h:243
const ACE_CDR::ULong MEMBER_ID_INVALID
Definition: TypeObject.h:911
const TypeKind TK_BITMASK
Definition: TypeObject.h:239
const ReturnCode_t RETCODE_ERROR
const TypeKind TK_STRING8
Definition: TypeObject.h:231
const TypeKind TK_SEQUENCE
Definition: TypeObject.h:248
const TypeKind TK_ENUM
Definition: TypeObject.h:238
bool is_primitive(TypeKind tk) const
const char * typekind_to_string(TypeKind tk)
const TypeKind TK_UNION
Definition: TypeObject.h:244
const TypeKind TK_BITSET
Definition: TypeObject.h:245
DDS::ReturnCode_t clear_value_i(DDS::MemberId id, const DDS::DynamicType_var &member_type)
const TypeKind TK_ARRAY
Definition: TypeObject.h:249
const TypeKind TK_MAP
Definition: TypeObject.h:250
ACE_CDR::Octet TypeKind
Definition: TypeObject.h:210

◆ clear_container()

void OpenDDS::XTypes::DynamicDataImpl::clear_container ( )
private

◆ clear_nonkey_values()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::clear_nonkey_values ( )

Implements DDS::DynamicData.

Definition at line 368 of file DynamicDataImpl.cpp.

References DDS::RETCODE_UNSUPPORTED.

369 {
371 }
const ReturnCode_t RETCODE_UNSUPPORTED

◆ clear_value()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::clear_value ( DDS::MemberId  id)

Definition at line 373 of file DynamicDataImpl.cpp.

References ACE_ERROR, OpenDDS::XTypes::DynamicDataBase::bound_total(), clear_value_i(), container_, erase_member(), OpenDDS::XTypes::get_base_type(), get_sequence_size(), OpenDDS::XTypes::DynamicDataBase::is_primitive(), LM_WARNING, OpenDDS::DCPS::log_level, OpenDDS::XTypes::MEMBER_ID_INVALID, DDS::RETCODE_BAD_PARAMETER, DDS::RETCODE_ERROR, DDS::RETCODE_OK, set_boolean_value(), OpenDDS::XTypes::TK_ALIAS, OpenDDS::XTypes::TK_ANNOTATION, OpenDDS::XTypes::TK_ARRAY, OpenDDS::XTypes::TK_BITMASK, OpenDDS::XTypes::TK_BITSET, OpenDDS::XTypes::TK_ENUM, OpenDDS::XTypes::TK_MAP, OpenDDS::XTypes::TK_SEQUENCE, OpenDDS::XTypes::TK_STRING16, OpenDDS::XTypes::TK_STRING8, OpenDDS::XTypes::TK_STRUCTURE, OpenDDS::XTypes::TK_UNION, OpenDDS::XTypes::DynamicDataBase::type_, OpenDDS::XTypes::typekind_to_string(), and OpenDDS::DCPS::LogLevel::Warning.

374 {
375  const TypeKind this_tk = type_->get_kind();
376  if (is_primitive(this_tk) || this_tk == TK_ENUM) {
377  if (id != MEMBER_ID_INVALID) {
379  }
380  return clear_value_i(id, type_);
381  }
382 
383  switch (this_tk) {
384  case TK_BITMASK:
385  return set_boolean_value(id, false);
386  case TK_ARRAY: {
387  DDS::TypeDescriptor_var td;
388  if (type_->get_descriptor(td) != DDS::RETCODE_OK) {
389  return DDS::RETCODE_ERROR;
390  }
391  const CORBA::ULong bound = bound_total(td);
392  if (id >= bound) {
394  }
395  DDS::DynamicType_var elem_type = get_base_type(td->element_type());
396  return clear_value_i(id, elem_type);
397  }
398  case TK_STRING8:
399 #ifdef DDS_HAS_WCHAR
400  case TK_STRING16:
401 #endif
402  case TK_SEQUENCE: {
403  // Shift subsequent elements to the left (XTypes spec 7.5.2.11.3).
404  const CORBA::ULong size = get_sequence_size();
405  if (id >= size) {
406  return DDS::RETCODE_ERROR;
407  }
408 
409  // At the begin of each iterator, member with the current id is not present
410  // in any of the maps. Copy over the next member to the current id.
411  erase_member(id);
412  for (CORBA::ULong i = id; i < size - 1; ++i) {
413  const DDS::MemberId next_id = i + 1;
414  DataContainer::const_single_iterator single_it = container_.single_map_.find(next_id);
415  if (single_it != container_.single_map_.end()) {
416  container_.single_map_.insert(std::make_pair(i, single_it->second));
417  container_.single_map_.erase(next_id);
418  continue;
419  }
420  DataContainer::const_sequence_iterator seq_it = container_.sequence_map_.find(next_id);
421  if (seq_it != container_.sequence_map_.end()) {
422  container_.sequence_map_.insert(std::make_pair(i, seq_it->second));
423  container_.sequence_map_.erase(next_id);
424  continue;
425  }
426  DataContainer::const_complex_iterator complex_it = container_.complex_map_.find(next_id);
427  if (complex_it != container_.complex_map_.end()) {
428  container_.complex_map_.insert(std::make_pair(i, complex_it->second));
429  container_.complex_map_.erase(next_id);
430  continue;
431  }
432  }
433  break;
434  }
435  case TK_STRUCTURE:
436  case TK_UNION: {
437  DDS::DynamicTypeMember_var dtm;
438  if (type_->get_member(dtm, id) != DDS::RETCODE_OK) {
439  return DDS::RETCODE_ERROR;
440  }
441  DDS::MemberDescriptor_var md;
442  if (dtm->get_descriptor(md) != DDS::RETCODE_OK) {
443  return DDS::RETCODE_ERROR;
444  }
445  if (md->is_optional()) {
446  erase_member(id);
447  break;
448  }
449  DDS::DynamicType_var member_type = get_base_type(md->type());
450  return clear_value_i(id, member_type);
451  }
452  case TK_MAP:
453  case TK_BITSET:
454  case TK_ALIAS:
455  case TK_ANNOTATION:
456  default:
457  if (log_level >= LogLevel::Warning) {
458  ACE_ERROR((LM_WARNING, "(%P|%t) WARNING: DynamicDataImpl::clear_value:"
459  " Encounter unexpected type kind %C\n", typekind_to_string(this_tk)));
460  }
461  return DDS::RETCODE_ERROR;
462  }
463  return DDS::RETCODE_OK;
464 }
OpenDDS_Dcps_Export LogLevel log_level
#define ACE_ERROR(X)
ACE_CDR::ULong MemberId
Definition: TypeObject.h:910
const TypeKind TK_ANNOTATION
Definition: TypeObject.h:242
DDS::DynamicType_var type_
The actual (i.e., non-alias) DynamicType of the associated type.
CORBA::ULong get_sequence_size() const
const ReturnCode_t RETCODE_OK
DDS::DynamicType_var get_base_type(DDS::DynamicType_ptr type)
const ReturnCode_t RETCODE_BAD_PARAMETER
const TypeKind TK_ALIAS
Definition: TypeObject.h:235
const TypeKind TK_STRING16
Definition: TypeObject.h:232
const TypeKind TK_STRUCTURE
Definition: TypeObject.h:243
static CORBA::ULong bound_total(DDS::TypeDescriptor_var descriptor)
const ACE_CDR::ULong MEMBER_ID_INVALID
Definition: TypeObject.h:911
ACE_CDR::ULong ULong
void erase_member(DDS::MemberId id)
const TypeKind TK_BITMASK
Definition: TypeObject.h:239
const ReturnCode_t RETCODE_ERROR
const TypeKind TK_STRING8
Definition: TypeObject.h:231
const TypeKind TK_SEQUENCE
Definition: TypeObject.h:248
const TypeKind TK_ENUM
Definition: TypeObject.h:238
bool is_primitive(TypeKind tk) const
DDS::ReturnCode_t set_boolean_value(DDS::MemberId id, CORBA::Boolean value)
const char * typekind_to_string(TypeKind tk)
const TypeKind TK_UNION
Definition: TypeObject.h:244
const TypeKind TK_BITSET
Definition: TypeObject.h:245
DDS::ReturnCode_t clear_value_i(DDS::MemberId id, const DDS::DynamicType_var &member_type)
const TypeKind TK_ARRAY
Definition: TypeObject.h:249
const TypeKind TK_MAP
Definition: TypeObject.h:250
ACE_CDR::Octet TypeKind
Definition: TypeObject.h:210

◆ clear_value_i()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::clear_value_i ( DDS::MemberId  id,
const DDS::DynamicType_var &  member_type 
)
private

Definition at line 466 of file DynamicDataImpl.cpp.

References ACE_ERROR, OpenDDS::XTypes::bitmask_bound(), container_, DynamicDataImpl(), OpenDDS::XTypes::enum_bound(), insert_complex(), insert_single(), LM_WARNING, OpenDDS::DCPS::log_level, DDS::RETCODE_ERROR, DDS::RETCODE_OK, OpenDDS::XTypes::DynamicDataImpl::DataContainer::set_default_basic_value(), OpenDDS::XTypes::DynamicDataImpl::DataContainer::set_default_bitmask_value(), OpenDDS::XTypes::DynamicDataImpl::DataContainer::set_default_enum_value(), OpenDDS::XTypes::TK_ALIAS, OpenDDS::XTypes::TK_ANNOTATION, OpenDDS::XTypes::TK_ARRAY, OpenDDS::XTypes::TK_BITMASK, OpenDDS::XTypes::TK_BITSET, OpenDDS::XTypes::TK_BOOLEAN, OpenDDS::XTypes::TK_BYTE, OpenDDS::XTypes::TK_CHAR16, OpenDDS::XTypes::TK_CHAR8, OpenDDS::XTypes::TK_ENUM, OpenDDS::XTypes::TK_FLOAT128, OpenDDS::XTypes::TK_FLOAT32, OpenDDS::XTypes::TK_FLOAT64, OpenDDS::XTypes::TK_INT16, OpenDDS::XTypes::TK_INT32, OpenDDS::XTypes::TK_INT64, OpenDDS::XTypes::TK_INT8, OpenDDS::XTypes::TK_MAP, OpenDDS::XTypes::TK_SEQUENCE, OpenDDS::XTypes::TK_STRING16, OpenDDS::XTypes::TK_STRING8, OpenDDS::XTypes::TK_STRUCTURE, OpenDDS::XTypes::TK_UINT16, OpenDDS::XTypes::TK_UINT32, OpenDDS::XTypes::TK_UINT64, OpenDDS::XTypes::TK_UINT8, OpenDDS::XTypes::TK_UNION, OpenDDS::XTypes::typekind_to_string(), value, and OpenDDS::DCPS::LogLevel::Warning.

Referenced by clear_all_values(), clear_value(), get_complex_from_union(), and get_value_from_union().

467 {
468  const TypeKind tk = member_type->get_kind();
469  switch (tk) {
470  case TK_BOOLEAN: {
471  ACE_OutputCDR::from_boolean val(false);
473  insert_single(id, val);
474  break;
475  }
476  case TK_BYTE: {
479  insert_single(id, val);
480  break;
481  }
482  case TK_UINT8: {
485  insert_single(id, val);
486  break;
487  }
488  case TK_UINT16: {
489  CORBA::UInt16 val(0);
491  insert_single(id, val);
492  break;
493  }
494  case TK_UINT32: {
495  CORBA::UInt32 val(0);
497  insert_single(id, val);
498  break;
499  }
500  case TK_UINT64: {
501  CORBA::UInt64 val(0);
503  insert_single(id, val);
504  break;
505  }
506  case TK_INT8: {
509  insert_single(id, val);
510  break;
511  }
512  case TK_INT16: {
513  CORBA::Int16 val(0);
515  insert_single(id, val);
516  break;
517  }
518  case TK_INT32: {
519  CORBA::Int32 val(0);
521  insert_single(id, val);
522  break;
523  }
524  case TK_INT64: {
525  CORBA::Int64 val(0);
527  insert_single(id, val);
528  break;
529  }
530  case TK_FLOAT32: {
531  CORBA::Float val(0.0f);
533  insert_single(id, val);
534  break;
535  }
536  case TK_FLOAT64: {
537  CORBA::Double val(0.0);
539  insert_single(id, val);
540  break;
541  }
542  case TK_FLOAT128: {
543  CORBA::LongDouble val;
545  insert_single(id, val);
546  break;
547  }
548  case TK_CHAR8: {
549  ACE_OutputCDR::from_char val('\0');
551  insert_single(id, val);
552  break;
553  }
554  case TK_STRING8: {
555  const char* val = 0;
557  insert_single(id, val);
558  break;
559  }
560 #ifdef DDS_HAS_WCHAR
561  case TK_CHAR16: {
562  ACE_OutputCDR::from_wchar val(L'\0');
564  insert_single(id, val);
565  break;
566  }
567  case TK_STRING16: {
568  const CORBA::WChar* val = 0;
570  insert_single(id, val);
571  break;
572  }
573 #endif
574  case TK_ENUM: {
575  // Set to first enumerator
577  if (!container_.set_default_enum_value(member_type, value)) {
578  return DDS::RETCODE_ERROR;
579  }
580  TypeKind treat_as = tk;
581  if (enum_bound(member_type, treat_as) != DDS::RETCODE_OK) {
582  return DDS::RETCODE_ERROR;
583  }
584  if (treat_as == TK_INT8) {
585  ACE_OutputCDR::from_int8 val(static_cast<CORBA::Int8>(value));
586  insert_single(id, val);
587  } else if (treat_as == TK_INT16) {
588  insert_single(id, static_cast<CORBA::Short>(value));
589  } else {
590  insert_single(id, value);
591  }
592  break;
593  }
594  case TK_BITMASK: {
595  // Set to default bitmask value
596  TypeKind treat_as = tk;
597  if (bitmask_bound(member_type, treat_as) != DDS::RETCODE_OK) {
598  return DDS::RETCODE_ERROR;
599  }
600  if (treat_as == TK_UINT8) {
603  insert_single(id, val);
604  } else if (treat_as == TK_UINT16) {
605  CORBA::UShort val;
607  insert_single(id, val);
608  } else if (treat_as == TK_UINT32) {
609  CORBA::ULong val;
611  insert_single(id, val);
612  } else {
613  CORBA::ULongLong val;
615  insert_single(id, val);
616  }
617  break;
618  }
619  case TK_ARRAY:
620  case TK_SEQUENCE:
621  case TK_STRUCTURE:
622  case TK_UNION: {
623  DDS::DynamicData_var dd = new DynamicDataImpl(member_type);
624  insert_complex(id, dd);
625  break;
626  }
627  case TK_MAP:
628  case TK_BITSET:
629  case TK_ALIAS:
630  case TK_ANNOTATION:
631  default:
632  if (log_level >= LogLevel::Warning) {
633  ACE_ERROR((LM_WARNING, "(%P|%t) WARNING: DynamicDataImpl::clear_value_i:"
634  " Member %u has unexpected type kind %C\n", id, typekind_to_string(tk)));
635  }
636  return DDS::RETCODE_ERROR;
637  }
638  return DDS::RETCODE_OK;
639 }
OpenDDS_Dcps_Export LogLevel log_level
ACE_CDR::Long Long
bool set_default_enum_value(const DDS::DynamicType_var &dt, CORBA::Long &value) const
#define ACE_ERROR(X)
const TypeKind TK_INT8
Definition: TypeObject.h:225
const LogLevel::Value value
Definition: debug.cpp:61
bool insert_single(DDS::MemberId id, const ACE_OutputCDR::from_int8 &value)
ACE_CDR::Int32 Int32
const TypeKind TK_ANNOTATION
Definition: TypeObject.h:242
const TypeKind TK_FLOAT128
Definition: TypeObject.h:224
const ReturnCode_t RETCODE_OK
const TypeKind TK_CHAR16
Definition: TypeObject.h:228
const TypeKind TK_ALIAS
Definition: TypeObject.h:235
const TypeKind TK_INT32
Definition: TypeObject.h:217
const TypeKind TK_CHAR8
Definition: TypeObject.h:227
const TypeKind TK_STRING16
Definition: TypeObject.h:232
const TypeKind TK_STRUCTURE
Definition: TypeObject.h:243
ACE_CDR::ULongLong ULongLong
const TypeKind TK_UINT16
Definition: TypeObject.h:219
ACE_CDR::ULong ULong
const TypeKind TK_INT64
Definition: TypeObject.h:218
DDS::ReturnCode_t bitmask_bound(DDS::DynamicType_ptr type, DDS::TypeKind &bound_kind)
const TypeKind TK_BITMASK
Definition: TypeObject.h:239
const TypeKind TK_UINT8
Definition: TypeObject.h:226
const TypeKind TK_FLOAT32
Definition: TypeObject.h:222
const ReturnCode_t RETCODE_ERROR
ACE_CDR::UInt64 UInt64
const TypeKind TK_BOOLEAN
Definition: TypeObject.h:214
DDS::ReturnCode_t enum_bound(DDS::DynamicType_ptr type, DDS::TypeKind &bound_kind)
const TypeKind TK_INT16
Definition: TypeObject.h:216
DynamicDataImpl(DDS::DynamicType_ptr type)
ACE_CDR::UShort UShort
const TypeKind TK_FLOAT64
Definition: TypeObject.h:223
const TypeKind TK_STRING8
Definition: TypeObject.h:231
void set_default_basic_value(CORBA::Long &value) const
ACE_CDR::Int64 Int64
const TypeKind TK_SEQUENCE
Definition: TypeObject.h:248
const TypeKind TK_ENUM
Definition: TypeObject.h:238
const TypeKind TK_UINT32
Definition: TypeObject.h:220
void set_default_bitmask_value(ACE_OutputCDR::from_uint8 &value) const
const char * typekind_to_string(TypeKind tk)
const TypeKind TK_BYTE
Definition: TypeObject.h:215
const TypeKind TK_UNION
Definition: TypeObject.h:244
const TypeKind TK_UINT64
Definition: TypeObject.h:221
ACE_CDR::Int16 Int16
const TypeKind TK_BITSET
Definition: TypeObject.h:245
ACE_CDR::WChar WChar
const TypeKind TK_ARRAY
Definition: TypeObject.h:249
const TypeKind TK_MAP
Definition: TypeObject.h:250
bool insert_complex(DDS::MemberId id, const DDS::DynamicData_var &value)
ACE_CDR::UInt32 UInt32
ACE_CDR::Octet TypeKind
Definition: TypeObject.h:210
ACE_CDR::UInt16 UInt16

◆ clone()

DDS::DynamicData_ptr OpenDDS::XTypes::DynamicDataImpl::clone ( void  )

Implements DDS::DynamicData.

Definition at line 653 of file DynamicDataImpl.cpp.

References DynamicDataImpl().

654 {
655  return new DynamicDataImpl(*this);
656 }
DynamicDataImpl(DDS::DynamicType_ptr type)

◆ equals()

CORBA::Boolean OpenDDS::XTypes::DynamicDataImpl::equals ( DDS::DynamicData_ptr  other)

Definition at line 51 of file DynamicDataImpl.cpp.

References ACE_ERROR, and LM_ERROR.

Referenced by set_complex_to_union().

52 {
53  // FUTURE: Implement this.
54  ACE_ERROR((LM_ERROR, "(%P|%t) ERROR: DynamicDataImpl::equals: Not implemented\n"));
55  return false;
56 }
#define ACE_ERROR(X)

◆ erase_member()

void OpenDDS::XTypes::DynamicDataImpl::erase_member ( DDS::MemberId  id)
private

Definition at line 208 of file DynamicDataImpl.cpp.

References container_.

Referenced by clear_value().

209 {
210  if (container_.single_map_.erase(id) == 0) {
211  if (container_.sequence_map_.erase(id) == 0) {
212  container_.complex_map_.erase(id);
213  }
214  }
215 }

◆ find_selected_member()

DDS::MemberId OpenDDS::XTypes::DynamicDataImpl::find_selected_member ( ) const
private

Definition at line 1310 of file DynamicDataImpl.cpp.

References container_, OpenDDS::XTypes::DISCRIMINATOR_ID, OpenDDS::XTypes::MEMBER_ID_INVALID, and OPENDDS_ASSERT.

Referenced by set_complex_to_union(), and set_value_to_union().

1311 {
1312  // There can be at most 2 entries in total in all three maps,
1313  // one for the discriminator, one for a selected member.
1314  for (DataContainer::const_single_iterator single_it = container_.single_map_.begin();
1315  single_it != container_.single_map_.end(); ++single_it) {
1316  if (single_it->first != DISCRIMINATOR_ID) {
1317  return single_it->first;
1318  }
1319  }
1320 
1321  // If there is any entry in sequence_map_, that must be for a selected member
1322  // since discriminator cannot be sequence.
1323  if (container_.sequence_map_.size() > 0) {
1324  OPENDDS_ASSERT(container_.sequence_map_.size() == 1);
1325  return container_.sequence_map_.begin()->first;
1326  }
1327 
1328  for (DataContainer::const_complex_iterator cmpl_it = container_.complex_map_.begin();
1329  cmpl_it != container_.complex_map_.end(); ++cmpl_it) {
1330  if (cmpl_it->first != DISCRIMINATOR_ID) {
1331  return cmpl_it->first;
1332  }
1333  }
1334 
1335  // There was no selected member written.
1336  return MEMBER_ID_INVALID;
1337 }
const ACE_CDR::ULong DISCRIMINATOR_ID
Implementation specific sentinel for a union discriminator used in DynamicData.
Definition: TypeObject.h:913
#define OPENDDS_ASSERT(C)
Definition: Definitions.h:66
const ACE_CDR::ULong MEMBER_ID_INVALID
Definition: TypeObject.h:911

◆ get_boolean_from_bitmask()

template<typename UIntType >
bool OpenDDS::XTypes::DynamicDataImpl::get_boolean_from_bitmask ( CORBA::ULong  index,
CORBA::Boolean value 
)
private

Definition at line 3227 of file DynamicDataImpl.cpp.

References read_basic_value().

3228 {
3229  UIntType bitmask;
3230  if (!read_basic_value(bitmask)) {
3231  return false;
3232  }
3233  value = (1ULL << index) & bitmask;
3234  return true;
3235 }
const LogLevel::Value value
Definition: debug.cpp:61
bool read_basic_value(ACE_OutputCDR::from_int8 &value)
Group of functions to read a basic value represented by this DynamicData instance.

◆ get_boolean_value()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::get_boolean_value ( CORBA::Boolean value,
DDS::MemberId  id 
)

Definition at line 3248 of file DynamicDataImpl.cpp.

References ACE_ERROR, container_, OpenDDS::XTypes::DynamicDataBase::get_index_from_id(), LM_NOTICE, OpenDDS::DCPS::log_level, OpenDDS::XTypes::MEMBER_ID_INVALID, OpenDDS::DCPS::LogLevel::Notice, DDS::RETCODE_ERROR, DDS::RETCODE_OK, OpenDDS::XTypes::DynamicDataImpl::DataContainer::set_default_basic_value(), OpenDDS::XTypes::TK_ARRAY, OpenDDS::XTypes::TK_BITMASK, OpenDDS::XTypes::TK_BOOLEAN, OpenDDS::XTypes::TK_MAP, OpenDDS::XTypes::TK_SEQUENCE, OpenDDS::XTypes::TK_STRUCTURE, OpenDDS::XTypes::TK_UNION, OpenDDS::XTypes::DynamicDataBase::type_, OpenDDS::XTypes::typekind_to_string(), ACE_OutputCDR::from_boolean::val_, and value.

Referenced by read_basic_value().

3249 {
3250  const TypeKind tk = type_->get_kind();
3251  bool good = true;
3252  switch (tk) {
3253  case TK_BOOLEAN: {
3254  if (id != MEMBER_ID_INVALID) {
3255  good = false;
3256  break;
3257  }
3258  DataContainer::const_single_iterator it = container_.single_map_.find(id);
3259  if (it != container_.single_map_.end()) {
3260  ACE_OutputCDR::from_boolean from_bool = it->second.get<ACE_OutputCDR::from_boolean>();
3261  value = from_bool.val_;
3262  } else {
3263  ACE_OutputCDR::from_boolean from_bool(false);
3265  value = from_bool.val_;
3266  }
3267  break;
3268  }
3269  case TK_BITMASK: {
3270  DDS::TypeDescriptor_var descriptor;
3271  if (type_->get_descriptor(descriptor) != DDS::RETCODE_OK) {
3272  good = false;
3273  break;
3274  }
3275  const LBound bitbound = descriptor->bound()[0];
3276  ACE_CDR::ULong index;
3277  if (!get_index_from_id(id, index, bitbound)) {
3278  good = false;
3279  break;
3280  }
3281  if (bitbound >= 1 && bitbound <= 8) {
3282  good = get_boolean_from_bitmask<CORBA::UInt8>(index, value);
3283  } else if (bitbound >= 9 && bitbound <= 16) {
3284  good = get_boolean_from_bitmask<CORBA::UShort>(index, value);
3285  } else if (bitbound >= 17 && bitbound <= 32) {
3286  good = get_boolean_from_bitmask<CORBA::ULong>(index, value);
3287  } else {
3288  good = get_boolean_from_bitmask<CORBA::ULongLong>(index, value);
3289  }
3290  break;
3291  }
3292  case TK_STRUCTURE: {
3293  ACE_OutputCDR::from_boolean from_bool(false);
3294  good = get_value_from_struct<TK_BOOLEAN>(from_bool, id);
3295  if (good) {
3296  value = from_bool.val_;
3297  }
3298  break;
3299  }
3300  case TK_UNION: {
3301  ACE_OutputCDR::from_boolean from_bool(false);
3302  good = get_value_from_union<TK_BOOLEAN>(from_bool, id);
3303  if (good) {
3304  value = from_bool.val_;
3305  }
3306  break;
3307  }
3308  case TK_SEQUENCE:
3309  case TK_ARRAY: {
3310  ACE_OutputCDR::from_boolean from_bool(false);
3311  good = get_value_from_collection<TK_BOOLEAN>(from_bool, id);
3312  if (good) {
3313  value = from_bool.val_;
3314  }
3315  break;
3316  }
3317  case TK_MAP:
3319  ACE_ERROR((LM_NOTICE, "(%P|%t) NOTICE: DynamicDataImpl::get_boolean_value:"
3320  " Map is currently not supported\n"));
3321  }
3322  good = false;
3323  break;
3324  default:
3325  good = false;
3326  break;
3327  }
3328 
3329  if (!good && DCPS::log_level >= DCPS::LogLevel::Notice) {
3330  ACE_ERROR((LM_NOTICE, "(%P|%t) NOTICE: DynamicDataImpl::get_boolean_value:"
3331  " Failed to read a boolean value from a DynamicData object of type %C\n",
3332  typekind_to_string(tk)));
3333  }
3334  return good ? DDS::RETCODE_OK : DDS::RETCODE_ERROR;
3335 }
OpenDDS_Dcps_Export LogLevel log_level
#define ACE_ERROR(X)
const LogLevel::Value value
Definition: debug.cpp:61
ACE_CDR::ULong LBound
Definition: TypeObject.h:312
DDS::DynamicType_var type_
The actual (i.e., non-alias) DynamicType of the associated type.
const ReturnCode_t RETCODE_OK
const TypeKind TK_STRUCTURE
Definition: TypeObject.h:243
const ACE_CDR::ULong MEMBER_ID_INVALID
Definition: TypeObject.h:911
const TypeKind TK_BITMASK
Definition: TypeObject.h:239
const ReturnCode_t RETCODE_ERROR
const TypeKind TK_BOOLEAN
Definition: TypeObject.h:214
ACE_UINT32 ULong
void set_default_basic_value(CORBA::Long &value) const
const TypeKind TK_SEQUENCE
Definition: TypeObject.h:248
const char * typekind_to_string(TypeKind tk)
const TypeKind TK_UNION
Definition: TypeObject.h:244
const TypeKind TK_ARRAY
Definition: TypeObject.h:249
const TypeKind TK_MAP
Definition: TypeObject.h:250
ACE_CDR::Octet TypeKind
Definition: TypeObject.h:210
bool get_index_from_id(DDS::MemberId id, ACE_CDR::ULong &index, ACE_CDR::ULong bound) const

◆ get_boolean_values()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::get_boolean_values ( DDS::BooleanSeq value,
DDS::MemberId  id 
)

Definition at line 4012 of file DynamicDataImpl.cpp.

References DDS::RETCODE_UNSUPPORTED.

4013 {
4014  ACE_UNUSED_ARG(value);
4015  ACE_UNUSED_ARG(id);
4016  return DDS::RETCODE_UNSUPPORTED;
4017 }
const LogLevel::Value value
Definition: debug.cpp:61
const ReturnCode_t RETCODE_UNSUPPORTED

◆ get_byte_value()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::get_byte_value ( CORBA::Octet value,
DDS::MemberId  id 
)

Definition at line 3216 of file DynamicDataImpl.cpp.

References DDS::RETCODE_OK.

Referenced by read_basic_value().

3217 {
3218  ACE_OutputCDR::from_octet from_octet(0);
3219  const DDS::ReturnCode_t rc = get_single_value<TK_BYTE>(from_octet, id);
3220  if (rc == DDS::RETCODE_OK) {
3221  value = from_octet.val_;
3222  }
3223  return rc;
3224 }
const LogLevel::Value value
Definition: debug.cpp:61
const ReturnCode_t RETCODE_OK

◆ get_byte_values()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::get_byte_values ( DDS::ByteSeq value,
DDS::MemberId  id 
)

Definition at line 4005 of file DynamicDataImpl.cpp.

References DDS::RETCODE_UNSUPPORTED.

4006 {
4007  ACE_UNUSED_ARG(value);
4008  ACE_UNUSED_ARG(id);
4009  return DDS::RETCODE_UNSUPPORTED;
4010 }
const LogLevel::Value value
Definition: debug.cpp:61
const ReturnCode_t RETCODE_UNSUPPORTED

◆ get_char16_value()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::get_char16_value ( CORBA::WChar value,
DDS::MemberId  id 
)

Definition at line 3207 of file DynamicDataImpl.cpp.

References DDS::RETCODE_UNSUPPORTED, and value.

Referenced by read_basic_value().

3208 {
3209 #ifdef DDS_HAS_WCHAR
3210  return get_char_common<TK_CHAR16, TK_STRING16, ACE_OutputCDR::from_wchar>(value, id);
3211 #else
3212  return DDS::RETCODE_UNSUPPORTED;
3213 #endif
3214 }
const LogLevel::Value value
Definition: debug.cpp:61
const ReturnCode_t RETCODE_UNSUPPORTED

◆ get_char16_values()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::get_char16_values ( DDS::WcharSeq value,
DDS::MemberId  id 
)

Definition at line 3998 of file DynamicDataImpl.cpp.

References DDS::RETCODE_UNSUPPORTED.

3999 {
4000  ACE_UNUSED_ARG(value);
4001  ACE_UNUSED_ARG(id);
4002  return DDS::RETCODE_UNSUPPORTED;
4003 }
const LogLevel::Value value
Definition: debug.cpp:61
const ReturnCode_t RETCODE_UNSUPPORTED

◆ get_char8_value()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::get_char8_value ( CORBA::Char value,
DDS::MemberId  id 
)

Definition at line 3202 of file DynamicDataImpl.cpp.

References value.

Referenced by read_basic_value().

3203 {
3204  return get_char_common<TK_CHAR8, TK_STRING8, ACE_OutputCDR::from_char>(value, id);
3205 }
const LogLevel::Value value
Definition: debug.cpp:61

◆ get_char8_values()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::get_char8_values ( DDS::CharSeq value,
DDS::MemberId  id 
)

Definition at line 3991 of file DynamicDataImpl.cpp.

References DDS::RETCODE_UNSUPPORTED.

3992 {
3993  ACE_UNUSED_ARG(value);
3994  ACE_UNUSED_ARG(id);
3995  return DDS::RETCODE_UNSUPPORTED;
3996 }
const LogLevel::Value value
Definition: debug.cpp:61
const ReturnCode_t RETCODE_UNSUPPORTED

◆ get_char_common()

template<TypeKind CharKind, TypeKind StringKind, typename FromCharT , typename CharT >
DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::get_char_common ( CharT &  value,
DDS::MemberId  id 
)
private

Definition at line 3128 of file DynamicDataImpl.cpp.

References ACE_ERROR, container_, LM_NOTICE, OpenDDS::DCPS::log_level, OpenDDS::XTypes::MEMBER_ID_INVALID, OpenDDS::DCPS::LogLevel::Notice, read_basic_member(), DDS::RETCODE_ERROR, DDS::RETCODE_OK, OpenDDS::XTypes::DynamicDataImpl::DataContainer::set_default_basic_value(), OpenDDS::XTypes::TK_ARRAY, OpenDDS::XTypes::TK_MAP, OpenDDS::XTypes::TK_SEQUENCE, OpenDDS::XTypes::TK_STRUCTURE, OpenDDS::XTypes::TK_UNION, OpenDDS::XTypes::DynamicDataBase::type_, and OpenDDS::XTypes::typekind_to_string().

3129 {
3130  const TypeKind tk = type_->get_kind();
3131  bool good = true;
3132  switch (tk) {
3133  case CharKind: {
3134  if (id != MEMBER_ID_INVALID) {
3135  good = false;
3136  break;
3137  }
3138  DataContainer::const_single_iterator it = container_.single_map_.find(id);
3139  if (it != container_.single_map_.end()) {
3140  FromCharT from_char = it->second.get<FromCharT>();
3141  value = from_char.val_;
3142  } else {
3143  FromCharT from_char('\0');
3145  value = from_char.val_;
3146  }
3147  break;
3148  }
3149  case StringKind: {
3150  FromCharT from_char('\0');
3151  good = read_basic_member(from_char, id);
3152  if (good) {
3153  value = from_char.val_;
3154  }
3155  break;
3156  }
3157  case TK_STRUCTURE: {
3158  FromCharT from_char('\0');
3159  good = get_value_from_struct<CharKind>(from_char, id);
3160  if (good) {
3161  value = from_char.val_;
3162  }
3163  break;
3164  }
3165  case TK_UNION: {
3166  FromCharT from_char('\0');
3167  good = get_value_from_union<CharKind>(from_char, id);
3168  if (good) {
3169  value = from_char.val_;
3170  }
3171  break;
3172  }
3173  case TK_SEQUENCE:
3174  case TK_ARRAY: {
3175  FromCharT from_char('\0');
3176  good = get_value_from_collection<CharKind>(from_char, id);
3177  if (good) {
3178  value = from_char.val_;
3179  }
3180  break;
3181  }
3182  case TK_MAP:
3184  ACE_ERROR((LM_NOTICE, "(%P|%t) NOTICE: DynamicDataImpl::get_char_common:"
3185  " Map is currently not supported\n"));
3186  }
3187  good = false;
3188  break;
3189  default:
3190  good = false;
3191  break;
3192  }
3193 
3194  if (!good && DCPS::log_level >= DCPS::LogLevel::Notice) {
3195  ACE_ERROR((LM_NOTICE, "(%P|%t) NOTICE: DynamicDataImpl::get_char_common::"
3196  " Failed to read a value of type %C from a DynamicData object of type %C\n",
3197  typekind_to_string(CharKind), typekind_to_string(tk)));
3198  }
3199  return good ? DDS::RETCODE_OK : DDS::RETCODE_ERROR;
3200 }
OpenDDS_Dcps_Export LogLevel log_level
#define ACE_ERROR(X)
const LogLevel::Value value
Definition: debug.cpp:61
DDS::DynamicType_var type_
The actual (i.e., non-alias) DynamicType of the associated type.
const ReturnCode_t RETCODE_OK
bool read_basic_member(ValueType &value, DDS::MemberId id)
const TypeKind TK_STRUCTURE
Definition: TypeObject.h:243
const ACE_CDR::ULong MEMBER_ID_INVALID
Definition: TypeObject.h:911
const ReturnCode_t RETCODE_ERROR
void set_default_basic_value(CORBA::Long &value) const
const TypeKind TK_SEQUENCE
Definition: TypeObject.h:248
const char * typekind_to_string(TypeKind tk)
const TypeKind TK_UNION
Definition: TypeObject.h:244
const TypeKind TK_ARRAY
Definition: TypeObject.h:249
const TypeKind TK_MAP
Definition: TypeObject.h:250
ACE_CDR::Octet TypeKind
Definition: TypeObject.h:210

◆ get_complex_from_aggregated()

bool OpenDDS::XTypes::DynamicDataImpl::get_complex_from_aggregated ( DDS::DynamicData_var &  value,
DDS::MemberId  id,
FoundStatus found_status 
)
private

Definition at line 3658 of file DynamicDataImpl.cpp.

References container_, DynamicDataImpl(), FOUND_IN_COMPLEX_MAP, FOUND_IN_NON_COMPLEX_MAP, OpenDDS::XTypes::get_base_type(), move_sequence_to_complex(), move_single_to_complex(), NOT_FOUND, DDS::RETCODE_OK, and OpenDDS::XTypes::DynamicDataBase::type_.

Referenced by get_complex_from_struct(), and get_complex_from_union().

3660 {
3661  DataContainer::const_complex_iterator complex_it = container_.complex_map_.find(id);
3662  if (complex_it != container_.complex_map_.end()) {
3663  value = DDS::DynamicData::_duplicate(complex_it->second);
3664  found_status = FOUND_IN_COMPLEX_MAP;
3665  return true;
3666  }
3667 
3668  DDS::DynamicTypeMember_var dtm;
3669  if (type_->get_member(dtm, id) != DDS::RETCODE_OK) {
3670  return false;
3671  }
3672  DDS::MemberDescriptor_var md;
3673  if (dtm->get_descriptor(md) != DDS::RETCODE_OK) {
3674  return false;
3675  }
3676  DDS::DynamicType_var member_type = get_base_type(md->type());
3677  DynamicDataImpl* dd_impl = new DynamicDataImpl(member_type);
3678  DDS::DynamicData_var dd_var = dd_impl;
3679 
3680  DataContainer::const_single_iterator single_it = container_.single_map_.find(id);
3681  if (single_it != container_.single_map_.end()) {
3682  if (!move_single_to_complex(single_it, dd_impl)) {
3683  return false;
3684  }
3685  found_status = FOUND_IN_NON_COMPLEX_MAP;
3686  } else {
3687  DataContainer::const_sequence_iterator sequence_it = container_.sequence_map_.find(id);
3688  if (sequence_it != container_.sequence_map_.end()) {
3689  if (!move_sequence_to_complex(sequence_it, dd_impl)) {
3690  return false;
3691  }
3692  found_status = FOUND_IN_NON_COMPLEX_MAP;
3693  } else {
3694  found_status = NOT_FOUND;
3695  }
3696  }
3697  value = dd_var;
3698  return true;
3699 }
const LogLevel::Value value
Definition: debug.cpp:61
DDS::DynamicType_var type_
The actual (i.e., non-alias) DynamicType of the associated type.
const ReturnCode_t RETCODE_OK
DDS::DynamicType_var get_base_type(DDS::DynamicType_ptr type)
DynamicDataImpl(DDS::DynamicType_ptr type)
bool move_sequence_to_complex(const DataContainer::const_sequence_iterator &it, DynamicDataImpl *data)
bool move_single_to_complex(const DataContainer::const_single_iterator &it, DynamicDataImpl *data)

◆ get_complex_from_collection()

bool OpenDDS::XTypes::DynamicDataImpl::get_complex_from_collection ( DDS::DynamicData_ptr &  value,
DDS::MemberId  id 
)
private

Definition at line 3840 of file DynamicDataImpl.cpp.

References OpenDDS::XTypes::DynamicDataBase::bound_total(), container_, DynamicDataImpl(), insert_complex(), move_sequence_to_complex(), move_single_to_complex(), CORBA::release(), DDS::RETCODE_OK, OpenDDS::XTypes::TK_ARRAY, and OpenDDS::XTypes::DynamicDataBase::type_.

Referenced by get_complex_value().

3841 {
3842  DataContainer::const_complex_iterator complex_it = container_.complex_map_.find(id);
3843  if (complex_it != container_.complex_map_.end()) {
3845  value = DDS::DynamicData::_duplicate(complex_it->second);
3846  return true;
3847  }
3848 
3849  DDS::TypeDescriptor_var td;
3850  if (type_->get_descriptor(td) != DDS::RETCODE_OK) {
3851  return false;
3852  }
3853  if (type_->get_kind() == TK_ARRAY && id >= bound_total(td)) {
3854  return false;
3855  }
3856 
3857  DynamicDataImpl* dd_impl = new DynamicDataImpl(td->element_type());
3858  DDS::DynamicData_var dd_var = dd_impl;
3859 
3860  DataContainer::const_single_iterator single_it = container_.single_map_.find(id);
3861  if (single_it != container_.single_map_.end()) {
3862  if (!move_single_to_complex(single_it, dd_impl)) {
3863  return false;
3864  }
3865  } else {
3866  DataContainer::const_sequence_iterator sequence_it = container_.sequence_map_.find(id);
3867  if (sequence_it != container_.sequence_map_.end()) {
3868  if (!move_sequence_to_complex(sequence_it, dd_impl)) {
3869  return false;
3870  }
3871  }
3872  }
3873  insert_complex(id, dd_var);
3875  value = DDS::DynamicData::_duplicate(dd_var);
3876  return true;
3877 }
const LogLevel::Value value
Definition: debug.cpp:61
void release(T x)
DDS::DynamicType_var type_
The actual (i.e., non-alias) DynamicType of the associated type.
const ReturnCode_t RETCODE_OK
static CORBA::ULong bound_total(DDS::TypeDescriptor_var descriptor)
DynamicDataImpl(DDS::DynamicType_ptr type)
bool move_sequence_to_complex(const DataContainer::const_sequence_iterator &it, DynamicDataImpl *data)
bool move_single_to_complex(const DataContainer::const_single_iterator &it, DynamicDataImpl *data)
const TypeKind TK_ARRAY
Definition: TypeObject.h:249
bool insert_complex(DDS::MemberId id, const DDS::DynamicData_var &value)

◆ get_complex_from_struct()

bool OpenDDS::XTypes::DynamicDataImpl::get_complex_from_struct ( DDS::DynamicData_ptr &  value,
DDS::MemberId  id 
)
private

Definition at line 3701 of file DynamicDataImpl.cpp.

References FOUND_IN_NON_COMPLEX_MAP, get_complex_from_aggregated(), insert_complex(), NOT_FOUND, and CORBA::release().

Referenced by get_complex_value().

3702 {
3703  FoundStatus found_status = NOT_FOUND;
3704  DDS::DynamicData_var dd_var;
3705  if (!get_complex_from_aggregated(dd_var, id, found_status)) {
3706  return false;
3707  }
3708 
3709  if (found_status == FOUND_IN_NON_COMPLEX_MAP || found_status == NOT_FOUND) {
3710  insert_complex(id, dd_var);
3711  }
3713  value = DDS::DynamicData::_duplicate(dd_var);
3714  return true;
3715 }
const LogLevel::Value value
Definition: debug.cpp:61
void release(T x)
bool get_complex_from_aggregated(DDS::DynamicData_var &value, DDS::MemberId id, FoundStatus &found_status)
bool insert_complex(DDS::MemberId id, const DDS::DynamicData_var &value)

◆ get_complex_from_union()

bool OpenDDS::XTypes::DynamicDataImpl::get_complex_from_union ( DDS::DynamicData_ptr &  value,
DDS::MemberId  id 
)
private

Definition at line 3763 of file DynamicDataImpl.cpp.

References ACE_ERROR, clear_value_i(), container_, OpenDDS::XTypes::DISCRIMINATOR_ID, DynamicDataImpl(), FOUND_IN_NON_COMPLEX_MAP, OpenDDS::XTypes::get_base_type(), get_complex_from_aggregated(), insert_complex(), insert_valid_discriminator(), LM_NOTICE, OpenDDS::DCPS::log_level, NOT_FOUND, OpenDDS::DCPS::LogLevel::Notice, CORBA::release(), DDS::RETCODE_OK, OpenDDS::XTypes::DynamicDataImpl::DataContainer::select_union_member(), OpenDDS::XTypes::DynamicDataImpl::DataContainer::set_default_discriminator_value(), OpenDDS::XTypes::DynamicDataBase::type_, and write_discriminator().

Referenced by get_complex_value().

3764 {
3765  FoundStatus found_status = NOT_FOUND;
3766  DDS::DynamicData_var dd_var;
3767  if (!get_complex_from_aggregated(dd_var, id, found_status)) {
3768  return false;
3769  }
3770  if (found_status != NOT_FOUND) {
3771  if (found_status == FOUND_IN_NON_COMPLEX_MAP) {
3772  insert_complex(id, dd_var);
3773  }
3775  value = DDS::DynamicData::_duplicate(dd_var);
3776  return true;
3777  }
3778 
3779  // Requested member with the given Id is not present in the container.
3780  if (id == DISCRIMINATOR_ID) {
3781  DDS::TypeDescriptor_var td;
3782  if (type_->get_descriptor(td) != DDS::RETCODE_OK) {
3783  return false;
3784  }
3785  DDS::DynamicType_var disc_type = get_base_type(td->discriminator_type());
3786  CORBA::Long disc_value;
3787  if (!container_.set_default_discriminator_value(disc_value, disc_type)) {
3788  return false;
3789  }
3790  bool found_selected_member = false;
3791  DDS::MemberDescriptor_var selected_md;
3792  if (!container_.select_union_member(disc_value, found_selected_member, selected_md)) {
3793  return false;
3794  }
3795  DynamicDataImpl* dd_impl = new DynamicDataImpl(disc_type);
3796  DDS::DynamicData_var dd_var = dd_impl;
3797  dd_impl->write_discriminator(disc_value);
3799  if (found_selected_member && !selected_md->is_optional()) {
3800  DDS::DynamicType_var selected_type = get_base_type(selected_md->type());
3801  if (clear_value_i(selected_md->id(), selected_type) != DDS::RETCODE_OK) {
3802  return false;
3803  }
3804  }
3806  value = DDS::DynamicData::_duplicate(dd_var);
3807  } else {
3808  DataContainer::const_single_iterator single_it = container_.single_map_.find(DISCRIMINATOR_ID);
3809  DataContainer::const_complex_iterator complex_it = container_.complex_map_.find(DISCRIMINATOR_ID);
3810  const bool has_disc = single_it != container_.single_map_.end() ||
3811  complex_it != container_.complex_map_.end();
3812  if (has_disc) {
3814  ACE_ERROR((LM_NOTICE, "(%P|%t) NOTICE: DynamicDataImpl::get_complex_from_union:"
3815  " Branch Id %u is not the active branch in the union\n", id));
3816  }
3817  return false;
3818  }
3819  DDS::DynamicTypeMember_var dtm;
3820  if (type_->get_member(dtm, id) != DDS::RETCODE_OK) {
3821  return false;
3822  }
3823  DDS::MemberDescriptor_var md;
3824  if (dtm->get_descriptor(md) != DDS::RETCODE_OK) {
3825  return false;
3826  }
3827  // An empty DynamicData object implicitly contains default value of the associated type.
3828  DynamicDataImpl* dd_impl = new DynamicDataImpl(md->type());
3829  DDS::DynamicData_var dd_var = dd_impl;
3830  if (!insert_valid_discriminator(md)) {
3831  return false;
3832  }
3833  insert_complex(id, dd_var);
3835  value = DDS::DynamicData::_duplicate(dd_var);
3836  }
3837  return true;
3838 }
OpenDDS_Dcps_Export LogLevel log_level
ACE_CDR::Long Long
#define ACE_ERROR(X)
const LogLevel::Value value
Definition: debug.cpp:61
void release(T x)
DDS::DynamicType_var type_
The actual (i.e., non-alias) DynamicType of the associated type.
const ReturnCode_t RETCODE_OK
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.
Definition: TypeObject.h:913
bool get_complex_from_aggregated(DDS::DynamicData_var &value, DDS::MemberId id, FoundStatus &found_status)
bool select_union_member(CORBA::Long disc_value, bool &found_selected_member, DDS::MemberDescriptor_var &selected_md) const
DynamicDataImpl(DDS::DynamicType_ptr type)
bool set_default_discriminator_value(CORBA::Long &value, const DDS::DynamicType_var &disc_type) const
bool insert_valid_discriminator(DDS::MemberDescriptor *memberSelected)
DDS::ReturnCode_t clear_value_i(DDS::MemberId id, const DDS::DynamicType_var &member_type)
bool insert_complex(DDS::MemberId id, const DDS::DynamicData_var &value)

◆ get_complex_value()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::get_complex_value ( DDS::DynamicData_ptr &  value,
DDS::MemberId  id 
)

Definition at line 3879 of file DynamicDataImpl.cpp.

References ACE_ERROR, get_complex_from_collection(), get_complex_from_struct(), get_complex_from_union(), LM_NOTICE, OpenDDS::DCPS::log_level, OpenDDS::DCPS::LogLevel::Notice, DDS::RETCODE_ERROR, DDS::RETCODE_OK, OpenDDS::XTypes::TK_ARRAY, OpenDDS::XTypes::TK_MAP, OpenDDS::XTypes::TK_SEQUENCE, OpenDDS::XTypes::TK_STRUCTURE, OpenDDS::XTypes::TK_UNION, OpenDDS::XTypes::DynamicDataBase::type_, and OpenDDS::XTypes::typekind_to_string().

3880 {
3881  const TypeKind tk = type_->get_kind();
3882  bool good = true;
3883  switch (tk) {
3884  case TK_STRUCTURE:
3885  good = get_complex_from_struct(value, id);
3886  break;
3887  case TK_UNION:
3888  good = get_complex_from_union(value, id);
3889  break;
3890  case TK_SEQUENCE:
3891  case TK_ARRAY:
3892  good = get_complex_from_collection(value, id);
3893  break;
3894  case TK_MAP:
3896  ACE_ERROR((LM_NOTICE, "(%P|%t) NOTICE: DynamicDataImpl::get_complex_value:"
3897  " Map is currently not supported\n"));
3898  }
3899  good = false;
3900  break;
3901  default:
3902  good = false;
3903  break;
3904  }
3905 
3906  if (!good && DCPS::log_level >= DCPS::LogLevel::Notice) {
3907  ACE_ERROR((LM_NOTICE, "(%P|%t) NOTICE: DynamicDataImpl::get_complex_value:"
3908  " Failed to read a complex value from a DynamicData object of type %C\n",
3909  typekind_to_string(tk)));
3910  }
3911  return good ? DDS::RETCODE_OK : DDS::RETCODE_ERROR;
3912 }
OpenDDS_Dcps_Export LogLevel log_level
bool get_complex_from_struct(DDS::DynamicData_ptr &value, DDS::MemberId id)
#define ACE_ERROR(X)
const LogLevel::Value value
Definition: debug.cpp:61
bool get_complex_from_collection(DDS::DynamicData_ptr &value, DDS::MemberId id)
DDS::DynamicType_var type_
The actual (i.e., non-alias) DynamicType of the associated type.
const ReturnCode_t RETCODE_OK
const TypeKind TK_STRUCTURE
Definition: TypeObject.h:243
bool get_complex_from_union(DDS::DynamicData_ptr &value, DDS::MemberId id)
const ReturnCode_t RETCODE_ERROR
const TypeKind TK_SEQUENCE
Definition: TypeObject.h:248
const char * typekind_to_string(TypeKind tk)
const TypeKind TK_UNION
Definition: TypeObject.h:244
const TypeKind TK_ARRAY
Definition: TypeObject.h:249
const TypeKind TK_MAP
Definition: TypeObject.h:250
ACE_CDR::Octet TypeKind
Definition: TypeObject.h:210

◆ get_float128_value()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::get_float128_value ( CORBA::LongDouble value,
DDS::MemberId  id 
)

Definition at line 3122 of file DynamicDataImpl.cpp.

References value.

Referenced by read_basic_value().

3123 {
3124  return get_single_value<TK_FLOAT128>(value, id);
3125 }
const LogLevel::Value value
Definition: debug.cpp:61

◆ get_float128_values()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::get_float128_values ( DDS::Float128Seq value,
DDS::MemberId  id 
)

Definition at line 3984 of file DynamicDataImpl.cpp.

References DDS::RETCODE_UNSUPPORTED.

3985 {
3986  ACE_UNUSED_ARG(value);
3987  ACE_UNUSED_ARG(id);
3988  return DDS::RETCODE_UNSUPPORTED;
3989 }
const LogLevel::Value value
Definition: debug.cpp:61
const ReturnCode_t RETCODE_UNSUPPORTED

◆ get_float32_value()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::get_float32_value ( CORBA::Float value,
DDS::MemberId  id 
)

Definition at line 3112 of file DynamicDataImpl.cpp.

References value.

Referenced by read_basic_value().

3113 {
3114  return get_single_value<TK_FLOAT32>(value, id);
3115 }
const LogLevel::Value value
Definition: debug.cpp:61

◆ get_float32_values()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::get_float32_values ( DDS::Float32Seq value,
DDS::MemberId  id 
)

Definition at line 3970 of file DynamicDataImpl.cpp.

References DDS::RETCODE_UNSUPPORTED.

3971 {
3972  ACE_UNUSED_ARG(value);
3973  ACE_UNUSED_ARG(id);
3974  return DDS::RETCODE_UNSUPPORTED;
3975 }
const LogLevel::Value value
Definition: debug.cpp:61
const ReturnCode_t RETCODE_UNSUPPORTED

◆ get_float64_value()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::get_float64_value ( CORBA::Double value,
DDS::MemberId  id 
)

Definition at line 3117 of file DynamicDataImpl.cpp.

References value.

Referenced by read_basic_value().

3118 {
3119  return get_single_value<TK_FLOAT64>(value, id);
3120 }
const LogLevel::Value value
Definition: debug.cpp:61

◆ get_float64_values()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::get_float64_values ( DDS::Float64Seq value,
DDS::MemberId  id 
)

Definition at line 3977 of file DynamicDataImpl.cpp.

References DDS::RETCODE_UNSUPPORTED.

3978 {
3979  ACE_UNUSED_ARG(value);
3980  ACE_UNUSED_ARG(id);
3981  return DDS::RETCODE_UNSUPPORTED;
3982 }
const LogLevel::Value value
Definition: debug.cpp:61
const ReturnCode_t RETCODE_UNSUPPORTED

◆ get_int16_value()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::get_int16_value ( CORBA::Short value,
DDS::MemberId  id 
)

Definition at line 3082 of file DynamicDataImpl.cpp.

References value.

Referenced by read_basic_value().

3083 {
3084  return get_single_value<TK_INT16>(value, id);
3085 }
const LogLevel::Value value
Definition: debug.cpp:61

◆ get_int16_values()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::get_int16_values ( DDS::Int16Seq value,
DDS::MemberId  id 
)

Definition at line 3942 of file DynamicDataImpl.cpp.

References DDS::RETCODE_UNSUPPORTED.

3943 {
3944  ACE_UNUSED_ARG(value);
3945  ACE_UNUSED_ARG(id);
3946  return DDS::RETCODE_UNSUPPORTED;
3947 }
const LogLevel::Value value
Definition: debug.cpp:61
const ReturnCode_t RETCODE_UNSUPPORTED

◆ get_int32_value()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::get_int32_value ( CORBA::Long value,
DDS::MemberId  id 
)

Definition at line 3092 of file DynamicDataImpl.cpp.

References value.

Referenced by read_basic_value().

3093 {
3094  return get_single_value<TK_INT32>(value, id);
3095 }
const LogLevel::Value value
Definition: debug.cpp:61

◆ get_int32_values()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::get_int32_values ( DDS::Int32Seq value,
DDS::MemberId  id 
)

Definition at line 3914 of file DynamicDataImpl.cpp.

References DDS::RETCODE_UNSUPPORTED.

3915 {
3916  ACE_UNUSED_ARG(value);
3917  ACE_UNUSED_ARG(id);
3918  return DDS::RETCODE_UNSUPPORTED;
3919 }
const LogLevel::Value value
Definition: debug.cpp:61
const ReturnCode_t RETCODE_UNSUPPORTED

◆ get_int64_value()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::get_int64_value ( CORBA::LongLong value,
DDS::MemberId  id 
)

Definition at line 3102 of file DynamicDataImpl.cpp.

References value.

Referenced by read_basic_value().

3103 {
3104  return get_single_value<TK_INT64>(value, id);
3105 }
const LogLevel::Value value
Definition: debug.cpp:61

◆ get_int64_values()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::get_int64_values ( DDS::Int64Seq value,
DDS::MemberId  id 
)

Definition at line 3956 of file DynamicDataImpl.cpp.

References DDS::RETCODE_UNSUPPORTED.

3957 {
3958  ACE_UNUSED_ARG(value);
3959  ACE_UNUSED_ARG(id);
3960  return DDS::RETCODE_UNSUPPORTED;
3961 }
const LogLevel::Value value
Definition: debug.cpp:61
const ReturnCode_t RETCODE_UNSUPPORTED

◆ get_int8_value()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::get_int8_value ( CORBA::Int8 value,
DDS::MemberId  id 
)

Definition at line 3062 of file DynamicDataImpl.cpp.

References DDS::RETCODE_OK.

Referenced by read_basic_value().

3063 {
3064  ACE_OutputCDR::from_int8 from_int8(0);
3065  const DDS::ReturnCode_t rc = get_single_value<TK_INT8>(from_int8, id);
3066  if (rc == DDS::RETCODE_OK) {
3067  value = from_int8.val_;
3068  }
3069  return rc;
3070 }
const LogLevel::Value value
Definition: debug.cpp:61
const ReturnCode_t RETCODE_OK

◆ get_int8_values()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::get_int8_values ( DDS::Int8Seq value,
DDS::MemberId  id 
)

Definition at line 3928 of file DynamicDataImpl.cpp.

References DDS::RETCODE_UNSUPPORTED.

3929 {
3930  ACE_UNUSED_ARG(value);
3931  ACE_UNUSED_ARG(id);
3932  return DDS::RETCODE_UNSUPPORTED;
3933 }
const LogLevel::Value value
Definition: debug.cpp:61
const ReturnCode_t RETCODE_UNSUPPORTED

◆ get_item_count()

ACE_CDR::ULong OpenDDS::XTypes::DynamicDataImpl::get_item_count ( )

Implements DDS::DynamicData.

Definition at line 217 of file DynamicDataImpl.cpp.

References ACE_ERROR, OpenDDS::XTypes::DynamicDataBase::bound_total(), container_, OpenDDS::XTypes::get_base_type(), OpenDDS::XTypes::DynamicDataImpl::DataContainer::get_largest_index_basic(), get_sequence_size(), LM_WARNING, OpenDDS::DCPS::log_level, DDS::RETCODE_OK, OpenDDS::XTypes::DynamicDataImpl::DataContainer::select_union_member(), OpenDDS::XTypes::DynamicDataImpl::DataContainer::set_default_discriminator_value(), OpenDDS::XTypes::TK_ALIAS, OpenDDS::XTypes::TK_ANNOTATION, OpenDDS::XTypes::TK_ARRAY, OpenDDS::XTypes::TK_BITMASK, OpenDDS::XTypes::TK_BITSET, OpenDDS::XTypes::TK_BOOLEAN, OpenDDS::XTypes::TK_BYTE, OpenDDS::XTypes::TK_CHAR16, OpenDDS::XTypes::TK_CHAR8, OpenDDS::XTypes::TK_ENUM, OpenDDS::XTypes::TK_FLOAT128, OpenDDS::XTypes::TK_FLOAT32, OpenDDS::XTypes::TK_FLOAT64, OpenDDS::XTypes::TK_INT16, OpenDDS::XTypes::TK_INT32, OpenDDS::XTypes::TK_INT64, OpenDDS::XTypes::TK_INT8, OpenDDS::XTypes::TK_MAP, OpenDDS::XTypes::TK_SEQUENCE, OpenDDS::XTypes::TK_STRING16, OpenDDS::XTypes::TK_STRING8, OpenDDS::XTypes::TK_STRUCTURE, OpenDDS::XTypes::TK_UINT16, OpenDDS::XTypes::TK_UINT32, OpenDDS::XTypes::TK_UINT64, OpenDDS::XTypes::TK_UINT8, OpenDDS::XTypes::TK_UNION, OpenDDS::XTypes::DynamicDataBase::type_, OpenDDS::XTypes::typekind_to_string(), and OpenDDS::DCPS::LogLevel::Warning.

Referenced by get_member_id_at_index().

218 {
219  const TypeKind tk = type_->get_kind();
220  switch (tk) {
221  case TK_BOOLEAN:
222  case TK_BYTE:
223  case TK_UINT8:
224  case TK_UINT16:
225  case TK_UINT32:
226  case TK_UINT64:
227  case TK_INT8:
228  case TK_INT16:
229  case TK_INT32:
230  case TK_INT64:
231  case TK_FLOAT32:
232  case TK_FLOAT64:
233  case TK_FLOAT128:
234  case TK_CHAR8:
235 #ifdef DDS_HAS_WCHAR
236  case TK_CHAR16:
237 #endif
238  case TK_ENUM:
239  return 1;
240  case TK_STRING8:
241 #ifdef DDS_HAS_WCHAR
242  case TK_STRING16:
243 #endif
244  {
245  if (!container_.single_map_.empty() || !container_.complex_map_.empty()) {
246  CORBA::ULong largest_index;
247  if (!container_.get_largest_index_basic(largest_index)) {
248  return 0;
249  }
250  return largest_index + 1;
251  }
252  return 0;
253  }
254  case TK_SEQUENCE:
255  return get_sequence_size();
256  case TK_BITMASK:
257  return static_cast<ACE_CDR::ULong>(container_.single_map_.size() +
258  container_.complex_map_.size());
259  case TK_ARRAY: {
260  DDS::TypeDescriptor_var descriptor;
261  if (type_->get_descriptor(descriptor) != DDS::RETCODE_OK) {
262  return 0;
263  }
264  return bound_total(descriptor);
265  }
266  case TK_STRUCTURE: {
267  const CORBA::ULong member_count = type_->get_member_count();
268  CORBA::ULong count = member_count;
269  // An optional member that hasn't been set is considered missing.
270  // All non-optional members are counted since they either are set directly
271  // or hold default values (XTypes spec 7.5.2.11.6).
272  for (CORBA::ULong i = 0; i < member_count; ++i) {
273  DDS::DynamicTypeMember_var dtm;
274  if (type_->get_member_by_index(dtm, i) != DDS::RETCODE_OK) {
275  return 0;
276  }
277  DDS::MemberDescriptor_var md;
278  if (dtm->get_descriptor(md) != DDS::RETCODE_OK) {
279  return 0;
280  }
281  if (md->is_optional()) {
282  const DDS::MemberId id = md->id();
283  if (container_.single_map_.find(id) == container_.single_map_.end() &&
284  container_.sequence_map_.find(id) == container_.sequence_map_.end() &&
285  container_.complex_map_.find(id) == container_.complex_map_.end()) {
286  --count;
287  }
288  }
289  }
290  return count;
291  }
292  case TK_UNION: {
293  CORBA::ULong count = static_cast<CORBA::ULong>(container_.single_map_.size() +
294  container_.sequence_map_.size() +
295  container_.complex_map_.size());
296  if (count > 0) {
297  return count;
298  }
299  DDS::TypeDescriptor_var td;
300  if (type_->get_descriptor(td) != DDS::RETCODE_OK) {
301  return 0;
302  }
303  DDS::DynamicType_var disc_type = get_base_type(td->discriminator_type());
304  CORBA::Long disc_val;
305  if (!container_.set_default_discriminator_value(disc_val, disc_type)) {
306  return 0;
307  }
308  bool select_a_member;
309  DDS::MemberDescriptor_var selected_md;
310  if (!container_.select_union_member(disc_val, select_a_member, selected_md)) {
311  return 0;
312  }
313  return select_a_member ? 2 : 1;
314  }
315  case TK_MAP:
316  case TK_BITSET:
317  case TK_ALIAS:
318  case TK_ANNOTATION:
319  default:
320  if (log_level >= LogLevel::Warning) {
321  ACE_ERROR((LM_WARNING, "(%P|%t) WARNING: DynamicDataImpl::get_item_count:"
322  " Encounter unexpected type kind %C\n", typekind_to_string(tk)));
323  }
324  return 0;
325  }
326 }
OpenDDS_Dcps_Export LogLevel log_level
ACE_CDR::Long Long
#define ACE_ERROR(X)
ACE_CDR::ULong MemberId
Definition: TypeObject.h:910
const TypeKind TK_INT8
Definition: TypeObject.h:225
const TypeKind TK_ANNOTATION
Definition: TypeObject.h:242
DDS::DynamicType_var type_
The actual (i.e., non-alias) DynamicType of the associated type.
const TypeKind TK_FLOAT128
Definition: TypeObject.h:224
CORBA::ULong get_sequence_size() const
const ReturnCode_t RETCODE_OK
DDS::DynamicType_var get_base_type(DDS::DynamicType_ptr type)
const TypeKind TK_CHAR16
Definition: TypeObject.h:228
const TypeKind TK_ALIAS
Definition: TypeObject.h:235
bool get_largest_index_basic(CORBA::ULong &index) const
const TypeKind TK_INT32
Definition: TypeObject.h:217
const TypeKind TK_CHAR8
Definition: TypeObject.h:227
const TypeKind TK_STRING16
Definition: TypeObject.h:232
const TypeKind TK_STRUCTURE
Definition: TypeObject.h:243
static CORBA::ULong bound_total(DDS::TypeDescriptor_var descriptor)
const TypeKind TK_UINT16
Definition: TypeObject.h:219
bool select_union_member(CORBA::Long disc_value, bool &found_selected_member, DDS::MemberDescriptor_var &selected_md) const
ACE_CDR::ULong ULong
const TypeKind TK_INT64
Definition: TypeObject.h:218
const TypeKind TK_BITMASK
Definition: TypeObject.h:239
const TypeKind TK_UINT8
Definition: TypeObject.h:226
const TypeKind TK_FLOAT32
Definition: TypeObject.h:222
const TypeKind TK_BOOLEAN
Definition: TypeObject.h:214
const TypeKind TK_INT16
Definition: TypeObject.h:216
bool set_default_discriminator_value(CORBA::Long &value, const DDS::DynamicType_var &disc_type) const
const TypeKind TK_FLOAT64
Definition: TypeObject.h:223
const TypeKind TK_STRING8
Definition: TypeObject.h:231
ACE_UINT32 ULong
const TypeKind TK_SEQUENCE
Definition: TypeObject.h:248
const TypeKind TK_ENUM
Definition: TypeObject.h:238
const TypeKind TK_UINT32
Definition: TypeObject.h:220
const char * typekind_to_string(TypeKind tk)
const TypeKind TK_BYTE
Definition: TypeObject.h:215
const TypeKind TK_UNION
Definition: TypeObject.h:244
const TypeKind TK_UINT64
Definition: TypeObject.h:221
const TypeKind TK_BITSET
Definition: TypeObject.h:245
const TypeKind TK_ARRAY
Definition: TypeObject.h:249
const TypeKind TK_MAP
Definition: TypeObject.h:250
ACE_CDR::Octet TypeKind
Definition: TypeObject.h:210

◆ get_member_id_at_index()

DDS::MemberId OpenDDS::XTypes::DynamicDataImpl::get_member_id_at_index ( ACE_CDR::ULong  index)

Definition at line 58 of file DynamicDataImpl.cpp.

References ACE_ERROR, OpenDDS::XTypes::DynamicDataBase::bound_total(), container_, OpenDDS::XTypes::DISCRIMINATOR_ID, get_item_count(), LM_NOTICE, OpenDDS::DCPS::log_level, OpenDDS::XTypes::MEMBER_ID_INVALID, OpenDDS::DCPS::LogLevel::Notice, DDS::RETCODE_OK, OpenDDS::XTypes::TK_ARRAY, OpenDDS::XTypes::TK_BITMASK, OpenDDS::XTypes::TK_BOOLEAN, OpenDDS::XTypes::TK_BYTE, OpenDDS::XTypes::TK_CHAR16, OpenDDS::XTypes::TK_CHAR8, OpenDDS::XTypes::TK_ENUM, OpenDDS::XTypes::TK_FLOAT128, OpenDDS::XTypes::TK_FLOAT32, OpenDDS::XTypes::TK_FLOAT64, OpenDDS::XTypes::TK_INT16, OpenDDS::XTypes::TK_INT32, OpenDDS::XTypes::TK_INT64, OpenDDS::XTypes::TK_INT8, OpenDDS::XTypes::TK_MAP, OpenDDS::XTypes::TK_SEQUENCE, OpenDDS::XTypes::TK_STRING16, OpenDDS::XTypes::TK_STRING8, OpenDDS::XTypes::TK_STRUCTURE, OpenDDS::XTypes::TK_UINT16, OpenDDS::XTypes::TK_UINT32, OpenDDS::XTypes::TK_UINT64, OpenDDS::XTypes::TK_UINT8, OpenDDS::XTypes::TK_UNION, OpenDDS::XTypes::DynamicDataBase::type_, and OpenDDS::XTypes::typekind_to_string().

59 {
60  const TypeKind tk = type_->get_kind();
61  switch (tk) {
62  case TK_BOOLEAN:
63  case TK_BYTE:
64  case TK_INT16:
65  case TK_INT32:
66  case TK_INT64:
67  case TK_UINT16:
68  case TK_UINT32:
69  case TK_UINT64:
70  case TK_FLOAT32:
71  case TK_FLOAT64:
72  case TK_FLOAT128:
73  case TK_INT8:
74  case TK_UINT8:
75  case TK_CHAR8:
76 #ifdef DDS_HAS_WCHAR
77  case TK_CHAR16:
78 #endif
79  case TK_ENUM:
80  // Value of enum or primitive types can be indicated by Id MEMBER_ID_INVALID
81  // or by index 0 (Section 7.5.2.11.1).
82  if (index != 0 && DCPS::log_level >= DCPS::LogLevel::Notice) {
83  ACE_ERROR((LM_NOTICE, "(%P|%t) NOTICE: DynamicDataImpl::get_member_id_at_index:"
84  " Received invalid index (%u) for type %C\n", index, typekind_to_string(tk)));
85  }
86  return MEMBER_ID_INVALID;
87  case TK_BITMASK:
88  // TODO: Bitmask type needs improvement. See comments in set_single_value method.
89  return MEMBER_ID_INVALID;
90  case TK_STRING8:
91 #ifdef DDS_HAS_WCHAR
92  case TK_STRING16:
93 #endif
94  case TK_SEQUENCE: {
95  DDS::TypeDescriptor_var descriptor;
96  if (type_->get_descriptor(descriptor) != DDS::RETCODE_OK) {
97  return MEMBER_ID_INVALID;
98  }
99  const CORBA::ULong bound = descriptor->bound()[0];
100  if (bound > 0 && index >= bound) {
102  ACE_ERROR((LM_NOTICE, "(%P|%t) NOTICE: DynamicDataImpl::get_member_id_at_index:"
103  " Input index (%u) is out-of-bound (bound is %u)\n", index, bound));
104  }
105  return MEMBER_ID_INVALID;
106  }
107  return index;
108  }
109  case TK_ARRAY: {
110  DDS::TypeDescriptor_var descriptor;
111  if (type_->get_descriptor(descriptor) != DDS::RETCODE_OK) {
112  return MEMBER_ID_INVALID;
113  }
114  const CORBA::ULong length = bound_total(descriptor);
115  if (index >= length) {
117  ACE_ERROR((LM_NOTICE, "(%P|%t) NOTICE: DynamicDataImpl::get_member_id_at_index:"
118  " Input index (%u) is out-of-bound (array length is %u)\n", index, length));
119  }
120  return MEMBER_ID_INVALID;
121  }
122  return index;
123  }
124  case TK_MAP:
126  ACE_ERROR((LM_NOTICE, "(%P|%t) NOTICE: DynamicDataImpl::get_member_id_at_index:"
127  " Map is currently not supported\n"));
128  }
129  return MEMBER_ID_INVALID;
130  case TK_STRUCTURE:
131  if (index < container_.single_map_.size()) {
132  DataContainer::const_single_iterator it = container_.single_map_.begin();
133  std::advance(it, index);
134  return it->first;
135  }
136  if (index - container_.single_map_.size() < container_.sequence_map_.size()) {
137  DataContainer::const_sequence_iterator it = container_.sequence_map_.begin();
138  std::advance(it, index - container_.single_map_.size());
139  return it->first;
140  }
141  if (index - container_.single_map_.size() - container_.sequence_map_.size() < container_.complex_map_.size()) {
142  DataContainer::const_complex_iterator it = container_.complex_map_.begin();
143  std::advance(it, index - container_.single_map_.size() - container_.sequence_map_.size());
144  return it->first;
145  }
146  return MEMBER_ID_INVALID;
147  case TK_UNION:
148  if (index == 0) {
149  return DISCRIMINATOR_ID;
150  }
151  if (index >= get_item_count()) {
152  return MEMBER_ID_INVALID;
153  }
154  if (!container_.sequence_map_.empty()) {
155  return container_.sequence_map_.begin()->first;
156  }
157  for (DataContainer::const_complex_iterator iter = container_.complex_map_.begin();
158  iter != container_.complex_map_.end(); ++iter) {
159  if (iter->first != DISCRIMINATOR_ID) {
160  return iter->first;
161  }
162  }
163  for (DataContainer::const_single_iterator iter = container_.single_map_.begin();
164  iter != container_.single_map_.end(); ++iter) {
165  if (iter->first != DISCRIMINATOR_ID) {
166  return iter->first;
167  }
168  }
169  return MEMBER_ID_INVALID;
170  }
171 
173  ACE_ERROR((LM_NOTICE, "(%P|%t) NOTICE: DynamicDataImpl::get_member_id_at_index:"
174  " Calling on an unexpected type %C\n", typekind_to_string(tk)));
175  }
176  return MEMBER_ID_INVALID;
177 }
OpenDDS_Dcps_Export LogLevel log_level
#define ACE_ERROR(X)
const TypeKind TK_INT8
Definition: TypeObject.h:225
DDS::DynamicType_var type_
The actual (i.e., non-alias) DynamicType of the associated type.
const TypeKind TK_FLOAT128
Definition: TypeObject.h:224
const ReturnCode_t RETCODE_OK
const TypeKind TK_CHAR16
Definition: TypeObject.h:228
const ACE_CDR::ULong DISCRIMINATOR_ID
Implementation specific sentinel for a union discriminator used in DynamicData.
Definition: TypeObject.h:913
const TypeKind TK_INT32
Definition: TypeObject.h:217
const TypeKind TK_CHAR8
Definition: TypeObject.h:227
const TypeKind TK_STRING16
Definition: TypeObject.h:232
const TypeKind TK_STRUCTURE
Definition: TypeObject.h:243
static CORBA::ULong bound_total(DDS::TypeDescriptor_var descriptor)
const TypeKind TK_UINT16
Definition: TypeObject.h:219
const ACE_CDR::ULong MEMBER_ID_INVALID
Definition: TypeObject.h:911
ACE_CDR::ULong ULong
const TypeKind TK_INT64
Definition: TypeObject.h:218
const TypeKind TK_BITMASK
Definition: TypeObject.h:239
const TypeKind TK_UINT8
Definition: TypeObject.h:226
const TypeKind TK_FLOAT32
Definition: TypeObject.h:222
const TypeKind TK_BOOLEAN
Definition: TypeObject.h:214
const TypeKind TK_INT16
Definition: TypeObject.h:216
const TypeKind TK_FLOAT64
Definition: TypeObject.h:223
const TypeKind TK_STRING8
Definition: TypeObject.h:231
const TypeKind TK_SEQUENCE
Definition: TypeObject.h:248
const TypeKind TK_ENUM
Definition: TypeObject.h:238
const TypeKind TK_UINT32
Definition: TypeObject.h:220
const char * typekind_to_string(TypeKind tk)
const TypeKind TK_BYTE
Definition: TypeObject.h:215
const TypeKind TK_UNION
Definition: TypeObject.h:244
const TypeKind TK_UINT64
Definition: TypeObject.h:221
const TypeKind TK_ARRAY
Definition: TypeObject.h:249
const TypeKind TK_MAP
Definition: TypeObject.h:250
ACE_CDR::Octet TypeKind
Definition: TypeObject.h:210

◆ get_sequence_size()

CORBA::ULong OpenDDS::XTypes::DynamicDataImpl::get_sequence_size ( ) const
private

Definition at line 179 of file DynamicDataImpl.cpp.

References container_, OpenDDS::XTypes::DynamicDataImpl::DataContainer::get_largest_index_basic(), OpenDDS::XTypes::DynamicDataImpl::DataContainer::get_largest_sequence_index(), OpenDDS::XTypes::TK_SEQUENCE, and OpenDDS::XTypes::DynamicDataBase::type_.

Referenced by clear_value(), and get_item_count().

180 {
181  if (type_->get_kind() != TK_SEQUENCE) {
182  return 0;
183  }
184 
185  if (!container_.single_map_.empty() || !container_.complex_map_.empty()) {
186  CORBA::ULong largest_index;
187  if (!container_.get_largest_index_basic(largest_index)) {
188  return 0;
189  }
190  if (!container_.sequence_map_.empty()) {
191  CORBA::ULong largest_seq_index;
192  if (!container_.get_largest_sequence_index(largest_seq_index)) {
193  return 0;
194  }
195  largest_index = std::max(largest_index, largest_seq_index);
196  }
197  return largest_index + 1;
198  } else if (!container_.sequence_map_.empty()) {
199  CORBA::ULong largest_index;
200  if (!container_.get_largest_sequence_index(largest_index)) {
201  return 0;
202  }
203  return largest_index + 1;
204  }
205  return 0;
206 }
DDS::DynamicType_var type_
The actual (i.e., non-alias) DynamicType of the associated type.
bool get_largest_index_basic(CORBA::ULong &index) const
ACE_CDR::ULong ULong
const TypeKind TK_SEQUENCE
Definition: TypeObject.h:248
bool get_largest_sequence_index(CORBA::ULong &index) const

◆ get_simple_value()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::get_simple_value ( DCPS::Value value,
DDS::MemberId  id 
)
virtual

Implements OpenDDS::XTypes::DynamicDataBase.

Definition at line 2064 of file DynamicDataImpl.cpp.

References ACE_ERROR, OpenDDS::XTypes::get_base_type(), get_simple_value_boolean(), get_simple_value_char(), get_simple_value_enum(), get_simple_value_string(), LM_NOTICE, OpenDDS::DCPS::log_level, OpenDDS::DCPS::LogLevel::Notice, DDS::RETCODE_ERROR, DDS::RETCODE_OK, OpenDDS::XTypes::TK_BOOLEAN, OpenDDS::XTypes::TK_CHAR8, OpenDDS::XTypes::TK_ENUM, OpenDDS::XTypes::TK_FLOAT128, OpenDDS::XTypes::TK_FLOAT64, OpenDDS::XTypes::TK_INT32, OpenDDS::XTypes::TK_INT64, OpenDDS::XTypes::TK_STRING8, OpenDDS::XTypes::TK_UINT32, OpenDDS::XTypes::TK_UINT64, OpenDDS::XTypes::DynamicDataBase::type_, OpenDDS::XTypes::typekind_to_string(), and value.

2065 {
2066  DDS::DynamicTypeMember_var dtm;
2067  if (type_->get_member(dtm, id) != DDS::RETCODE_OK) {
2068  return DDS::RETCODE_ERROR;
2069  }
2070  DDS::MemberDescriptor_var md;
2071  if (dtm->get_descriptor(md) != DDS::RETCODE_OK) {
2072  return DDS::RETCODE_ERROR;
2073  }
2074  DDS::DynamicType_var member_type = get_base_type(md->type());
2075  const TypeKind member_kind = member_type->get_kind();
2076  switch (member_kind) {
2077  case TK_BOOLEAN:
2078  return get_simple_value_boolean(value, id);
2079  case TK_INT32:
2080  return get_simple_value_primitive<CORBA::Long>(value, id);
2081  case TK_UINT32:
2082  return get_simple_value_primitive<CORBA::ULong>(value, id);
2083  case TK_INT64:
2084  return get_simple_value_primitive<CORBA::LongLong>(value, id);
2085  case TK_UINT64:
2086  return get_simple_value_primitive<CORBA::ULongLong>(value, id);
2087  case TK_CHAR8:
2088  return get_simple_value_char(value, id);
2089  case TK_FLOAT64:
2090  return get_simple_value_primitive<CORBA::Double>(value, id);
2091  case TK_FLOAT128:
2092  return get_simple_value_primitive<CORBA::LongDouble>(value, id);
2093  case TK_STRING8:
2094  return get_simple_value_string(value, id);
2095  case TK_ENUM:
2096  return get_simple_value_enum(value, id);
2097  default:
2099  ACE_ERROR((LM_NOTICE, "(%P|%t) NOTICE: DynamicDataImpl::get_simple_value:"
2100  " Member type %C is not supported by DCPS::Value\n",
2101  typekind_to_string(member_kind)));
2102  }
2103  }
2104  return DDS::RETCODE_ERROR;
2105 }
OpenDDS_Dcps_Export LogLevel log_level
#define ACE_ERROR(X)
const LogLevel::Value value
Definition: debug.cpp:61
DDS::DynamicType_var type_
The actual (i.e., non-alias) DynamicType of the associated type.
const TypeKind TK_FLOAT128
Definition: TypeObject.h:224
DDS::ReturnCode_t get_simple_value_string(DCPS::Value &value, DDS::MemberId id) const
const ReturnCode_t RETCODE_OK
DDS::DynamicType_var get_base_type(DDS::DynamicType_ptr type)
const TypeKind TK_INT32
Definition: TypeObject.h:217
const TypeKind TK_CHAR8
Definition: TypeObject.h:227
DDS::ReturnCode_t get_simple_value_enum(DCPS::Value &value, DDS::MemberId id) const
const TypeKind TK_INT64
Definition: TypeObject.h:218
const ReturnCode_t RETCODE_ERROR
const TypeKind TK_BOOLEAN
Definition: TypeObject.h:214
const TypeKind TK_FLOAT64
Definition: TypeObject.h:223
const TypeKind TK_STRING8
Definition: TypeObject.h:231
const TypeKind TK_ENUM
Definition: TypeObject.h:238
const TypeKind TK_UINT32
Definition: TypeObject.h:220
const char * typekind_to_string(TypeKind tk)
DDS::ReturnCode_t get_simple_value_boolean(DCPS::Value &value, DDS::MemberId id) const
const TypeKind TK_UINT64
Definition: TypeObject.h:221
ACE_CDR::Octet TypeKind
Definition: TypeObject.h:210
DDS::ReturnCode_t get_simple_value_char(DCPS::Value &value, DDS::MemberId id) const

◆ get_simple_value_boolean()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::get_simple_value_boolean ( DCPS::Value value,
DDS::MemberId  id 
) const
private

Definition at line 1943 of file DynamicDataImpl.cpp.

References container_, OpenDDS::DCPS::Value::get(), OpenDDS::XTypes::MEMBER_ID_INVALID, DDS::RETCODE_ERROR, and DDS::RETCODE_OK.

Referenced by get_simple_value().

1945 {
1946  DataContainer::const_single_iterator single_it = container_.single_map_.find(id);
1947  if (single_it != container_.single_map_.end()) {
1948  value = single_it->second.get<ACE_OutputCDR::from_boolean>().val_;
1949  return DDS::RETCODE_OK;
1950  }
1951  DataContainer::const_complex_iterator complex_it = container_.complex_map_.find(id);
1952  if (complex_it != container_.complex_map_.end()) {
1953  const DynamicDataImpl* inner_dd = dynamic_cast<DynamicDataImpl*>(complex_it->second.in());
1954  if (!inner_dd) {
1955  return DDS::RETCODE_ERROR;
1956  }
1957  DataContainer::const_single_iterator inner_it =
1958  inner_dd->container_.single_map_.find(MEMBER_ID_INVALID);
1959  if (inner_it != inner_dd->container_.single_map_.end()) {
1960  value = inner_it->second.get<ACE_OutputCDR::from_boolean>().val_;
1961  return DDS::RETCODE_OK;
1962  }
1963  }
1964  return DDS::RETCODE_ERROR;
1965 }
const LogLevel::Value value
Definition: debug.cpp:61
const ReturnCode_t RETCODE_OK
const ACE_CDR::ULong MEMBER_ID_INVALID
Definition: TypeObject.h:911
const ReturnCode_t RETCODE_ERROR
DynamicDataImpl(DDS::DynamicType_ptr type)

◆ get_simple_value_char()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::get_simple_value_char ( DCPS::Value value,
DDS::MemberId  id 
) const
private

Definition at line 1967 of file DynamicDataImpl.cpp.

References container_, OpenDDS::DCPS::Value::get(), OpenDDS::XTypes::MEMBER_ID_INVALID, DDS::RETCODE_ERROR, and DDS::RETCODE_OK.

Referenced by get_simple_value().

1969 {
1970  DataContainer::const_single_iterator single_it = container_.single_map_.find(id);
1971  if (single_it != container_.single_map_.end()) {
1972  value = single_it->second.get<ACE_OutputCDR::from_char>().val_;
1973  return DDS::RETCODE_OK;
1974  }
1975  DataContainer::const_complex_iterator complex_it = container_.complex_map_.find(id);
1976  if (complex_it != container_.complex_map_.end()) {
1977  const DynamicDataImpl* inner_dd = dynamic_cast<DynamicDataImpl*>(complex_it->second.in());
1978  if (!inner_dd) {
1979  return DDS::RETCODE_ERROR;
1980  }
1981  DataContainer::const_single_iterator inner_it =
1982  inner_dd->container_.single_map_.find(MEMBER_ID_INVALID);
1983  if (inner_it != inner_dd->container_.single_map_.end()) {
1984  value = inner_it->second.get<ACE_OutputCDR::from_char>().val_;
1985  return DDS::RETCODE_OK;
1986  }
1987  }
1988  return DDS::RETCODE_ERROR;
1989 }
const LogLevel::Value value
Definition: debug.cpp:61
const ReturnCode_t RETCODE_OK
const ACE_CDR::ULong MEMBER_ID_INVALID
Definition: TypeObject.h:911
const ReturnCode_t RETCODE_ERROR
DynamicDataImpl(DDS::DynamicType_ptr type)

◆ get_simple_value_enum()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::get_simple_value_enum ( DCPS::Value value,
DDS::MemberId  id 
) const
private

Definition at line 2039 of file DynamicDataImpl.cpp.

References OpenDDS::XTypes::get_enum_value(), OpenDDS::XTypes::get_enumerator_name(), OpenDDS::XTypes::get_member_type(), OpenDDS::XTypes::DynamicDataBase::interface_from_this(), DDS::RETCODE_OK, and OpenDDS::XTypes::DynamicDataBase::type_.

Referenced by get_simple_value().

2041 {
2042  DDS::DynamicType_var mtype;
2043  DDS::ReturnCode_t ret = get_member_type(mtype, type_, id);
2044  if (ret != DDS::RETCODE_OK) {
2045  return ret;
2046  }
2047 
2048  DDS::Int32 enumAsInteger;
2049  ret = get_enum_value(enumAsInteger, mtype, interface_from_this(), id);
2050  if (ret != DDS::RETCODE_OK) {
2051  return ret;
2052  }
2053 
2054  DDS::String8_var str;
2055  ret = get_enumerator_name(str, enumAsInteger, mtype);
2056  if (ret != DDS::RETCODE_OK) {
2057  return ret;
2058  }
2059 
2060  value = str.in();
2061  return DDS::RETCODE_OK;
2062 }
const LogLevel::Value value
Definition: debug.cpp:61
DDS::DynamicType_var type_
The actual (i.e., non-alias) DynamicType of the associated type.
DDS::ReturnCode_t get_member_type(DDS::DynamicType_var &member_type, DDS::DynamicType_ptr container_type, DDS::MemberId id)
const ReturnCode_t RETCODE_OK
DDS::DynamicData * interface_from_this() const
DDS::ReturnCode_t get_enum_value(CORBA::Int32 &value, DDS::DynamicType_ptr type, DDS::DynamicData_ptr src, DDS::MemberId id)
DDS::ReturnCode_t get_enumerator_name(DDS::String8_var &name, DDS::Int32 value, DDS::DynamicType_ptr type)

◆ get_simple_value_primitive()

template<typename ValueType >
DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::get_simple_value_primitive ( DCPS::Value value,
DDS::MemberId  id 
) const
private

Definition at line 1992 of file DynamicDataImpl.cpp.

References container_, OpenDDS::DCPS::Value::get(), OpenDDS::XTypes::MEMBER_ID_INVALID, DDS::RETCODE_ERROR, and DDS::RETCODE_OK.

1994 {
1995  DataContainer::const_single_iterator single_it = container_.single_map_.find(id);
1996  if (single_it != container_.single_map_.end()) {
1997  value = single_it->second.get<ValueType>();
1998  return DDS::RETCODE_OK;
1999  }
2000  DataContainer::const_complex_iterator complex_it = container_.complex_map_.find(id);
2001  if (complex_it != container_.complex_map_.end()) {
2002  const DynamicDataImpl* inner_dd = dynamic_cast<DynamicDataImpl*>(complex_it->second.in());
2003  if (!inner_dd) {
2004  return DDS::RETCODE_ERROR;
2005  }
2006  DataContainer::const_single_iterator inner_it =
2007  inner_dd->container_.single_map_.find(MEMBER_ID_INVALID);
2008  if (inner_it != inner_dd->container_.single_map_.end()) {
2009  value = inner_it->second.get<ValueType>();
2010  return DDS::RETCODE_OK;
2011  }
2012  }
2013  return DDS::RETCODE_ERROR;
2014 }
const LogLevel::Value value
Definition: debug.cpp:61
const ReturnCode_t RETCODE_OK
const ACE_CDR::ULong MEMBER_ID_INVALID
Definition: TypeObject.h:911
const ReturnCode_t RETCODE_ERROR
DynamicDataImpl(DDS::DynamicType_ptr type)

◆ get_simple_value_string()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::get_simple_value_string ( DCPS::Value value,
DDS::MemberId  id 
) const
private

Definition at line 2016 of file DynamicDataImpl.cpp.

References container_, OpenDDS::DCPS::Value::get(), read_basic_value(), DDS::RETCODE_ERROR, and DDS::RETCODE_OK.

Referenced by get_simple_value().

2018 {
2019  DataContainer::const_single_iterator single_it = container_.single_map_.find(id);
2020  if (single_it != container_.single_map_.end()) {
2021  value = single_it->second.get<const char*>();
2022  return DDS::RETCODE_OK;
2023  }
2024 
2025  DataContainer::const_complex_iterator complex_it = container_.complex_map_.find(id);
2026  if (complex_it != container_.complex_map_.end()) {
2027  // The string member has its own DynamicData object.
2028  const DynamicDataImpl* str_dd = dynamic_cast<DynamicDataImpl*>(complex_it->second.in());
2029  char* str = 0;
2030  if (!str_dd || !str_dd->read_basic_value(str)) {
2031  return DDS::RETCODE_ERROR;
2032  }
2033  value = str;
2034  return DDS::RETCODE_OK;
2035  }
2036  return DDS::RETCODE_ERROR;
2037 }
const LogLevel::Value value
Definition: debug.cpp:61
const ReturnCode_t RETCODE_OK
const ReturnCode_t RETCODE_ERROR
DynamicDataImpl(DDS::DynamicType_ptr type)

◆ get_single_value()

template<TypeKind ValueTypeKind, typename ValueType >
DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::get_single_value ( ValueType &  value,
DDS::MemberId  id 
)
private

Definition at line 3014 of file DynamicDataImpl.cpp.

References ACE_ERROR, get_value_from_self(), OpenDDS::XTypes::DynamicDataBase::is_type_supported(), LM_NOTICE, OpenDDS::DCPS::log_level, OpenDDS::DCPS::LogLevel::Notice, DDS::RETCODE_ERROR, DDS::RETCODE_OK, OpenDDS::XTypes::TK_ARRAY, OpenDDS::XTypes::TK_BITMASK, OpenDDS::XTypes::TK_ENUM, OpenDDS::XTypes::TK_MAP, OpenDDS::XTypes::TK_SEQUENCE, OpenDDS::XTypes::TK_STRUCTURE, OpenDDS::XTypes::TK_UNION, OpenDDS::XTypes::DynamicDataBase::type_, OpenDDS::XTypes::typekind_to_string(), and value.

3015 {
3016  if (!is_type_supported(ValueTypeKind, "get_single_value")) {
3017  return DDS::RETCODE_ERROR;
3018  }
3019  const TypeKind tk = type_->get_kind();
3020  bool good = true;
3021 
3022  switch (tk) {
3023  case ValueTypeKind:
3024  good = get_value_from_self(value, id);
3025  break;
3026  case TK_ENUM:
3027  good = get_value_from_enum<ValueTypeKind>(value, id);
3028  break;
3029  case TK_BITMASK:
3030  good = get_value_from_bitmask<ValueTypeKind>(value, id);
3031  break;
3032  case TK_STRUCTURE:
3033  good = get_value_from_struct<ValueTypeKind>(value, id);
3034  break;
3035  case TK_UNION:
3036  good = get_value_from_union<ValueTypeKind>(value, id);
3037  break;
3038  case TK_SEQUENCE:
3039  case TK_ARRAY:
3040  good = get_value_from_collection<ValueTypeKind>(value, id);
3041  break;
3042  case TK_MAP:
3044  ACE_ERROR((LM_NOTICE, "(%P|%t) NOTICE: DynamicDataImpl::get_single_value:"
3045  " Map is currently not supported\n"));
3046  }
3047  good = false;
3048  break;
3049  default:
3050  good = false;
3051  break;
3052  }
3053 
3054  if (!good && DCPS::log_level >= DCPS::LogLevel::Notice) {
3055  ACE_ERROR((LM_NOTICE, "(%P|%t) NOTICE: DynamicDataImpl::get_single_value:"
3056  " Failed to read a value of type %C from a DynamicData object of type %C\n",
3057  typekind_to_string(ValueTypeKind), typekind_to_string(tk)));
3058  }
3059  return good ? DDS::RETCODE_OK : DDS::RETCODE_ERROR;
3060 }
OpenDDS_Dcps_Export LogLevel log_level
#define ACE_ERROR(X)
const LogLevel::Value value
Definition: debug.cpp:61
DDS::DynamicType_var type_
The actual (i.e., non-alias) DynamicType of the associated type.
const ReturnCode_t RETCODE_OK
const TypeKind TK_STRUCTURE
Definition: TypeObject.h:243
bool get_value_from_self(ValueType &value, DDS::MemberId id)
const TypeKind TK_BITMASK
Definition: TypeObject.h:239
const ReturnCode_t RETCODE_ERROR
const TypeKind TK_SEQUENCE
Definition: TypeObject.h:248
const TypeKind TK_ENUM
Definition: TypeObject.h:238
const char * typekind_to_string(TypeKind tk)
const TypeKind TK_UNION
Definition: TypeObject.h:244
const TypeKind TK_ARRAY
Definition: TypeObject.h:249
const TypeKind TK_MAP
Definition: TypeObject.h:250
ACE_CDR::Octet TypeKind
Definition: TypeObject.h:210
bool is_type_supported(TypeKind tk, const char *func_name)

◆ get_string_value()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::get_string_value ( char *&  value,
DDS::MemberId  id 
)

Definition at line 3337 of file DynamicDataImpl.cpp.

References OpenDDS::XTypes::DynamicDataBase::enum_string_helper(), DDS::RETCODE_OK, and value.

3338 {
3339  if (enum_string_helper(value, id)) {
3340  return DDS::RETCODE_OK;
3341  }
3342 
3343  return get_single_value<TK_STRING8>(value, id);
3344 }
const LogLevel::Value value
Definition: debug.cpp:61
const ReturnCode_t RETCODE_OK
bool enum_string_helper(char *&strInOut, MemberId id)

◆ get_string_values()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::get_string_values ( DDS::StringSeq value,
DDS::MemberId  id 
)

Definition at line 4019 of file DynamicDataImpl.cpp.

References DDS::RETCODE_UNSUPPORTED.

4020 {
4021  ACE_UNUSED_ARG(value);
4022  ACE_UNUSED_ARG(id);
4023  return DDS::RETCODE_UNSUPPORTED;
4024 }
const LogLevel::Value value
Definition: debug.cpp:61
const ReturnCode_t RETCODE_UNSUPPORTED

◆ get_uint16_value()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::get_uint16_value ( CORBA::UShort value,
DDS::MemberId  id 
)

Definition at line 3087 of file DynamicDataImpl.cpp.

References value.

Referenced by read_basic_value().

3088 {
3089  return get_single_value<TK_UINT16>(value, id);
3090 }
const LogLevel::Value value
Definition: debug.cpp:61

◆ get_uint16_values()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::get_uint16_values ( DDS::UInt16Seq value,
DDS::MemberId  id 
)

Definition at line 3949 of file DynamicDataImpl.cpp.

References DDS::RETCODE_UNSUPPORTED.

3950 {
3951  ACE_UNUSED_ARG(value);
3952  ACE_UNUSED_ARG(id);
3953  return DDS::RETCODE_UNSUPPORTED;
3954 }
const LogLevel::Value value
Definition: debug.cpp:61
const ReturnCode_t RETCODE_UNSUPPORTED

◆ get_uint32_value()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::get_uint32_value ( CORBA::ULong value,
DDS::MemberId  id 
)

Definition at line 3097 of file DynamicDataImpl.cpp.

References value.

Referenced by read_basic_value().

3098 {
3099  return get_single_value<TK_UINT32>(value, id);
3100 }
const LogLevel::Value value
Definition: debug.cpp:61

◆ get_uint32_values()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::get_uint32_values ( DDS::UInt32Seq value,
DDS::MemberId  id 
)

Definition at line 3921 of file DynamicDataImpl.cpp.

References DDS::RETCODE_UNSUPPORTED.

3922 {
3923  ACE_UNUSED_ARG(value);
3924  ACE_UNUSED_ARG(id);
3925  return DDS::RETCODE_UNSUPPORTED;
3926 }
const LogLevel::Value value
Definition: debug.cpp:61
const ReturnCode_t RETCODE_UNSUPPORTED

◆ get_uint64_value()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::get_uint64_value ( CORBA::ULongLong value,
DDS::MemberId  id 
)

Definition at line 3107 of file DynamicDataImpl.cpp.

References value.

Referenced by read_basic_value().

3108 {
3109  return get_single_value<TK_UINT64>(value, id);
3110 }
const LogLevel::Value value
Definition: debug.cpp:61

◆ get_uint64_values()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::get_uint64_values ( DDS::UInt64Seq value,
DDS::MemberId  id 
)

Definition at line 3963 of file DynamicDataImpl.cpp.

References DDS::RETCODE_UNSUPPORTED.

3964 {
3965  ACE_UNUSED_ARG(value);
3966  ACE_UNUSED_ARG(id);
3967  return DDS::RETCODE_UNSUPPORTED;
3968 }
const LogLevel::Value value
Definition: debug.cpp:61
const ReturnCode_t RETCODE_UNSUPPORTED

◆ get_uint8_value()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::get_uint8_value ( CORBA::UInt8 value,
DDS::MemberId  id 
)

Definition at line 3072 of file DynamicDataImpl.cpp.

References DDS::RETCODE_OK.

Referenced by read_basic_value().

3073 {
3074  ACE_OutputCDR::from_uint8 from_uint8(0);
3075  const DDS::ReturnCode_t rc = get_single_value<TK_UINT8>(from_uint8, id);
3076  if (rc == DDS::RETCODE_OK) {
3077  value = from_uint8.val_;
3078  }
3079  return rc;
3080 }
const LogLevel::Value value
Definition: debug.cpp:61
const ReturnCode_t RETCODE_OK

◆ get_uint8_values()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::get_uint8_values ( DDS::UInt8Seq value,
DDS::MemberId  id 
)

Definition at line 3935 of file DynamicDataImpl.cpp.

References DDS::RETCODE_UNSUPPORTED.

3936 {
3937  ACE_UNUSED_ARG(value);
3938  ACE_UNUSED_ARG(id);
3939  return DDS::RETCODE_UNSUPPORTED;
3940 }
const LogLevel::Value value
Definition: debug.cpp:61
const ReturnCode_t RETCODE_UNSUPPORTED

◆ get_value_from_bitmask() [1/3]

template<TypeKind ValueTypeKind, typename ValueType >
bool OpenDDS::XTypes::DynamicDataImpl::get_value_from_bitmask ( ValueType &  value,
DDS::MemberId  id 
)
private

Definition at line 2829 of file DynamicDataImpl.cpp.

References OpenDDS::XTypes::bitmask_bound(), container_, OpenDDS::XTypes::MEMBER_ID_INVALID, DDS::RETCODE_OK, OpenDDS::XTypes::DynamicDataImpl::DataContainer::set_default_bitmask_value(), and OpenDDS::XTypes::DynamicDataBase::type_.

2830 {
2831  // Allow bitmask to be read as an unsigned integer.
2832  TypeKind treat_as_tk;
2833  const DDS::ReturnCode_t rc = bitmask_bound(type_, treat_as_tk);
2834  if (rc != DDS::RETCODE_OK || treat_as_tk != ValueTypeKind || id != MEMBER_ID_INVALID) {
2835  return false;
2836  }
2837  DataContainer::const_single_iterator it = container_.single_map_.find(MEMBER_ID_INVALID);
2838  if (it != container_.single_map_.end()) {
2839  value = it->second.get<ValueType>();
2840  } else {
2842  }
2843  return true;
2844 }
const LogLevel::Value value
Definition: debug.cpp:61
DDS::DynamicType_var type_
The actual (i.e., non-alias) DynamicType of the associated type.
const ReturnCode_t RETCODE_OK
const ACE_CDR::ULong MEMBER_ID_INVALID
Definition: TypeObject.h:911
DDS::ReturnCode_t bitmask_bound(DDS::DynamicType_ptr type, DDS::TypeKind &bound_kind)
void set_default_bitmask_value(ACE_OutputCDR::from_uint8 &value) const
ACE_CDR::Octet TypeKind
Definition: TypeObject.h:210

◆ get_value_from_bitmask() [2/3]

template<>
bool OpenDDS::XTypes::DynamicDataImpl::get_value_from_bitmask ( char *&  ,
DDS::MemberId   
)
private

Definition at line 2847 of file DynamicDataImpl.cpp.

2848 {
2849  return false;
2850 }

◆ get_value_from_bitmask() [3/3]

template<>
bool OpenDDS::XTypes::DynamicDataImpl::get_value_from_bitmask ( CORBA::WChar *&  ,
DDS::MemberId   
)
private

Definition at line 2852 of file DynamicDataImpl.cpp.

2853 {
2854  return false;
2855 }

◆ get_value_from_collection()

template<TypeKind ValueTypeKind, typename ValueType >
bool OpenDDS::XTypes::DynamicDataImpl::get_value_from_collection ( ValueType &  value,
DDS::MemberId  id 
)
private

Definition at line 2972 of file DynamicDataImpl.cpp.

References OpenDDS::XTypes::bitmask_bound(), OpenDDS::XTypes::DynamicDataBase::bound_total(), container_, OpenDDS::XTypes::enum_bound(), OpenDDS::XTypes::get_base_type(), insert_single(), read_basic_member(), DDS::RETCODE_OK, OpenDDS::XTypes::DynamicDataImpl::DataContainer::set_default_basic_value(), OpenDDS::XTypes::TK_ARRAY, OpenDDS::XTypes::TK_BITMASK, OpenDDS::XTypes::TK_ENUM, and OpenDDS::XTypes::DynamicDataBase::type_.

2973 {
2974  DDS::TypeDescriptor_var descriptor;
2975  if (type_->get_descriptor(descriptor) != DDS::RETCODE_OK) {
2976  return false;
2977  }
2978  if (type_->get_kind() == TK_ARRAY && id >= bound_total(descriptor)) {
2979  return false;
2980  }
2981 
2982  DDS::DynamicType_var elem_type = get_base_type(descriptor->element_type());
2983  const TypeKind elem_tk = elem_type->get_kind();
2984  TypeKind treat_as_tk = elem_tk;
2985  switch (elem_tk) {
2986  case TK_ENUM:
2987  if (enum_bound(elem_type, treat_as_tk) != DDS::RETCODE_OK) {
2988  return false;
2989  }
2990  break;
2991  case TK_BITMASK: {
2992  if (bitmask_bound(elem_type, treat_as_tk) != DDS::RETCODE_OK) {
2993  return false;
2994  }
2995  break;
2996  }
2997  }
2998  if (treat_as_tk != ValueTypeKind) {
2999  return false;
3000  }
3001  if (read_basic_member(value, id)) {
3002  return true;
3003  }
3005 
3006  // Must insert this member in case it's index is larger than the current largest index,
3007  // so that all new members up to this member are serialized. Otherwise, we would be returning
3008  // a value that wouldn't be in the serialized data.
3009  insert_single(id, value);
3010  return true;
3011 }
const LogLevel::Value value
Definition: debug.cpp:61
bool insert_single(DDS::MemberId id, const ACE_OutputCDR::from_int8 &value)
DDS::DynamicType_var type_
The actual (i.e., non-alias) DynamicType of the associated type.
const ReturnCode_t RETCODE_OK
DDS::DynamicType_var get_base_type(DDS::DynamicType_ptr type)
bool read_basic_member(ValueType &value, DDS::MemberId id)
static CORBA::ULong bound_total(DDS::TypeDescriptor_var descriptor)
DDS::ReturnCode_t bitmask_bound(DDS::DynamicType_ptr type, DDS::TypeKind &bound_kind)
const TypeKind TK_BITMASK
Definition: TypeObject.h:239
DDS::ReturnCode_t enum_bound(DDS::DynamicType_ptr type, DDS::TypeKind &bound_kind)
void set_default_basic_value(CORBA::Long &value) const
const TypeKind TK_ENUM
Definition: TypeObject.h:238
const TypeKind TK_ARRAY
Definition: TypeObject.h:249
ACE_CDR::Octet TypeKind
Definition: TypeObject.h:210

◆ get_value_from_enum() [1/3]

template<TypeKind ValueTypeKind, typename ValueType >
bool OpenDDS::XTypes::DynamicDataImpl::get_value_from_enum ( ValueType &  value,
DDS::MemberId  id 
)
private

Definition at line 2797 of file DynamicDataImpl.cpp.

References cast_to_enum_value(), container_, OpenDDS::XTypes::enum_bound(), OpenDDS::XTypes::MEMBER_ID_INVALID, DDS::RETCODE_OK, OpenDDS::XTypes::DynamicDataImpl::DataContainer::set_default_enum_value(), and OpenDDS::XTypes::DynamicDataBase::type_.

2798 {
2799  TypeKind treat_as_tk;
2800  const DDS::ReturnCode_t rc = enum_bound(type_, treat_as_tk);
2801  if (rc != DDS::RETCODE_OK || treat_as_tk != ValueTypeKind || id != MEMBER_ID_INVALID) {
2802  return false;
2803  }
2804  DataContainer::const_single_iterator it = container_.single_map_.find(MEMBER_ID_INVALID);
2805  if (it != container_.single_map_.end()) {
2806  value = it->second.get<ValueType>();
2807  } else {
2808  CORBA::Long enum_default_val;
2809  if (!container_.set_default_enum_value(type_, enum_default_val)) {
2810  return false;
2811  }
2812  cast_to_enum_value(value, enum_default_val);
2813  }
2814  return true;
2815 }
ACE_CDR::Long Long
bool set_default_enum_value(const DDS::DynamicType_var &dt, CORBA::Long &value) const
const LogLevel::Value value
Definition: debug.cpp:61
void cast_to_enum_value(ACE_OutputCDR::from_int8 &dst, CORBA::Long src) const
DDS::DynamicType_var type_
The actual (i.e., non-alias) DynamicType of the associated type.
const ReturnCode_t RETCODE_OK
const ACE_CDR::ULong MEMBER_ID_INVALID
Definition: TypeObject.h:911
DDS::ReturnCode_t enum_bound(DDS::DynamicType_ptr type, DDS::TypeKind &bound_kind)
ACE_CDR::Octet TypeKind
Definition: TypeObject.h:210

◆ get_value_from_enum() [2/3]

template<>
bool OpenDDS::XTypes::DynamicDataImpl::get_value_from_enum ( char *&  ,
DDS::MemberId   
)
private

Definition at line 2818 of file DynamicDataImpl.cpp.

2819 {
2820  return false;
2821 }

◆ get_value_from_enum() [3/3]

template<>
bool OpenDDS::XTypes::DynamicDataImpl::get_value_from_enum ( CORBA::WChar *&  ,
DDS::MemberId   
)
private

Definition at line 2823 of file DynamicDataImpl.cpp.

2824 {
2825  return false;
2826 }

◆ get_value_from_self() [1/3]

template<typename ValueType >
bool OpenDDS::XTypes::DynamicDataImpl::get_value_from_self ( ValueType &  value,
DDS::MemberId  id 
)
private

Definition at line 2767 of file DynamicDataImpl.cpp.

References container_, OpenDDS::XTypes::DynamicDataBase::is_primitive(), OpenDDS::XTypes::MEMBER_ID_INVALID, OpenDDS::XTypes::DynamicDataImpl::DataContainer::set_default_basic_value(), and OpenDDS::XTypes::DynamicDataBase::type_.

Referenced by get_single_value().

2768 {
2769  // Primitive or enum value can be read using MEMBER_ID_INVALID.
2770  if (!is_primitive(type_->get_kind()) || id != MEMBER_ID_INVALID) {
2771  return false;
2772  }
2773  DataContainer::const_single_iterator it = container_.single_map_.find(MEMBER_ID_INVALID);
2774  if (it != container_.single_map_.end()) {
2775  value = it->second.get<ValueType>();
2776  } else {
2778  }
2779  return true;
2780 }
const LogLevel::Value value
Definition: debug.cpp:61
DDS::DynamicType_var type_
The actual (i.e., non-alias) DynamicType of the associated type.
const ACE_CDR::ULong MEMBER_ID_INVALID
Definition: TypeObject.h:911
void set_default_basic_value(CORBA::Long &value) const
bool is_primitive(TypeKind tk) const

◆ get_value_from_self() [2/3]

template<>
bool OpenDDS::XTypes::DynamicDataImpl::get_value_from_self ( char *&  ,
DDS::MemberId   
)

Definition at line 2783 of file DynamicDataImpl.cpp.

2784 {
2785  // Can't read a string from a DynamicData instance representing a string.
2786  return false;
2787 }

◆ get_value_from_self() [3/3]

template<>
bool OpenDDS::XTypes::DynamicDataImpl::get_value_from_self ( CORBA::WChar *&  ,
DDS::MemberId   
)

Definition at line 2790 of file DynamicDataImpl.cpp.

2791 {
2792  // Can't read a wstring from a DynamicData instance representing a wstring.
2793  return false;
2794 }

◆ get_value_from_struct()

template<TypeKind ValueTypeKind, typename ValueType >
bool OpenDDS::XTypes::DynamicDataImpl::get_value_from_struct ( ValueType &  value,
DDS::MemberId  id 
)
private

Definition at line 2858 of file DynamicDataImpl.cpp.

References ACE_ERROR, OpenDDS::XTypes::DynamicDataBase::check_member(), container_, LM_NOTICE, OpenDDS::DCPS::log_level, OpenDDS::DCPS::LogLevel::Notice, read_basic_member(), DDS::RETCODE_OK, and OpenDDS::XTypes::DynamicDataImpl::DataContainer::set_default_basic_value().

2859 {
2860  DDS::MemberDescriptor_var md;
2861  DDS::DynamicType_var member_type;
2863  md, member_type, "DynamicDataImpl::get_value_from_struct", "get", id, ValueTypeKind);
2864  if (rc != DDS::RETCODE_OK) {
2865  return false;
2866  }
2867  if (read_basic_member(value, id)) {
2868  return true;
2869  }
2870 
2871  // Not returning a default value for a missing optional member.
2872  if (md->is_optional()) {
2873  if (log_level >= LogLevel::Notice) {
2874  ACE_ERROR((LM_NOTICE, "(%P|%t) NOTICE: DynamicDataImpl::get_value_from_struct:"
2875  " Optional member Id %u is not present\n", id));
2876  }
2877  return false;
2878  }
2880  return true;
2881 }
OpenDDS_Dcps_Export LogLevel log_level
#define ACE_ERROR(X)
const LogLevel::Value value
Definition: debug.cpp:61
const ReturnCode_t RETCODE_OK
DDS::ReturnCode_t check_member(DDS::MemberDescriptor_var &md, DDS::DynamicType_var &type, const char *method, const char *what, DDS::MemberId id, DDS::TypeKind tk)
bool read_basic_member(ValueType &value, DDS::MemberId id)
void set_default_basic_value(CORBA::Long &value) const

◆ get_value_from_union()

template<TypeKind ValueTypeKind, typename ValueType >
bool OpenDDS::XTypes::DynamicDataImpl::get_value_from_union ( ValueType &  value,
DDS::MemberId  id 
)
private

Definition at line 2884 of file DynamicDataImpl.cpp.

References ACE_ERROR, cast_to_discriminator_value(), OpenDDS::XTypes::DynamicDataBase::check_member(), clear_value_i(), container_, OpenDDS::XTypes::DISCRIMINATOR_ID, OpenDDS::XTypes::get_base_type(), insert_single(), insert_valid_discriminator(), LM_NOTICE, OpenDDS::DCPS::log_level, OpenDDS::DCPS::LogLevel::Notice, OPENDDS_ASSERT, read_basic_in_single_map(), read_basic_member(), DDS::RETCODE_OK, OpenDDS::XTypes::DynamicDataImpl::DataContainer::select_union_member(), OpenDDS::XTypes::DynamicDataImpl::DataContainer::set_default_basic_value(), and OpenDDS::XTypes::DynamicDataBase::type_.

2885 {
2886  DDS::MemberDescriptor_var md;
2887  DDS::DynamicType_var member_type;
2889  md, member_type, "DynamicDataImpl::get_value_from_union", "get", id, ValueTypeKind);
2890  if (rc != DDS::RETCODE_OK) {
2891  return false;
2892  }
2893 
2894  // Return the member if it is in the container.
2895  if (read_basic_member(value, id)) {
2896  return true;
2897  }
2898 
2899  if (id == DISCRIMINATOR_ID) {
2900  // Set the discriminator to default value.
2901  // If it selects a branch, set the branch to default value.
2903  CORBA::Long disc_value;
2904  if (!cast_to_discriminator_value(disc_value, value)) {
2905  return false;
2906  }
2907  bool found_selected_member = false;
2908  DDS::MemberDescriptor_var selected_md;
2909  if (!container_.select_union_member(disc_value, found_selected_member, selected_md)) {
2910  return false;
2911  }
2912  insert_single(id, value);
2913  if (found_selected_member && !selected_md->is_optional()) {
2914  DDS::DynamicType_var selected_type = get_base_type(selected_md->type());
2915  if (clear_value_i(selected_md->id(), selected_type) != DDS::RETCODE_OK) {
2916  return false;
2917  }
2918  }
2919  } else {
2920  DataContainer::const_single_iterator single_it = container_.single_map_.find(DISCRIMINATOR_ID);
2921  DataContainer::const_complex_iterator complex_it = container_.complex_map_.find(DISCRIMINATOR_ID);
2922  const bool has_disc = single_it != container_.single_map_.end() ||
2923  complex_it != container_.complex_map_.end();
2924  if (has_disc) {
2926  ACE_ERROR((LM_NOTICE, "(%P|%t) NOTICE: DynamicDataImpl::get_value_from_union:"
2927  " Branch Id %u is not the active branch in the union\n", id));
2928  }
2929  return false;
2930  }
2931  // Set the branch to default value and set the discriminator to a value that selects this branch.
2932  DDS::DynamicTypeMember_var dtm;
2933  if (type_->get_member(dtm, id) != DDS::RETCODE_OK) {
2934  return false;
2935  }
2936  DDS::MemberDescriptor_var md;
2937  if (dtm->get_descriptor(md) != DDS::RETCODE_OK) {
2938  return false;
2939  }
2940  DDS::DynamicType_var dt = get_base_type(md->type());
2941  if (clear_value_i(id, dt) != DDS::RETCODE_OK) {
2942  return false;
2943  }
2944  if (!insert_valid_discriminator(md)) {
2945  return false;
2946  }
2948  }
2949  return true;
2950 }
OpenDDS_Dcps_Export LogLevel log_level
ACE_CDR::Long Long
#define ACE_ERROR(X)
const LogLevel::Value value
Definition: debug.cpp:61
bool insert_single(DDS::MemberId id, const ACE_OutputCDR::from_int8 &value)
bool read_basic_in_single_map(ValueType &value, DDS::MemberId id)
Read a basic member from a containing type.
DDS::DynamicType_var type_
The actual (i.e., non-alias) DynamicType of the associated type.
const ReturnCode_t RETCODE_OK
DDS::DynamicType_var get_base_type(DDS::DynamicType_ptr type)
DDS::ReturnCode_t check_member(DDS::MemberDescriptor_var &md, DDS::DynamicType_var &type, const char *method, const char *what, DDS::MemberId id, DDS::TypeKind tk)
bool read_basic_member(ValueType &value, DDS::MemberId id)
const ACE_CDR::ULong DISCRIMINATOR_ID
Implementation specific sentinel for a union discriminator used in DynamicData.
Definition: TypeObject.h:913
#define OPENDDS_ASSERT(C)
Definition: Definitions.h:66
bool select_union_member(CORBA::Long disc_value, bool &found_selected_member, DDS::MemberDescriptor_var &selected_md) const
bool cast_to_discriminator_value(CORBA::Long &disc_value, const ACE_OutputCDR::from_boolean &value) const
void set_default_basic_value(CORBA::Long &value) const
bool insert_valid_discriminator(DDS::MemberDescriptor *memberSelected)
DDS::ReturnCode_t clear_value_i(DDS::MemberId id, const DDS::DynamicType_var &member_type)

◆ get_wstring_value()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::get_wstring_value ( CORBA::WChar *&  value,
DDS::MemberId  id 
)

Definition at line 3346 of file DynamicDataImpl.cpp.

References DDS::RETCODE_UNSUPPORTED, and value.

3347 {
3348 #ifdef DDS_HAS_WCHAR
3349  return get_single_value<TK_STRING16>(value, id);
3350 #else
3351  return DDS::RETCODE_UNSUPPORTED;
3352 #endif
3353 }
const LogLevel::Value value
Definition: debug.cpp:61
const ReturnCode_t RETCODE_UNSUPPORTED

◆ get_wstring_values()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::get_wstring_values ( DDS::WstringSeq value,
DDS::MemberId  id 
)

Definition at line 4026 of file DynamicDataImpl.cpp.

References DDS::RETCODE_UNSUPPORTED.

4027 {
4028  ACE_UNUSED_ARG(value);
4029  ACE_UNUSED_ARG(id);
4030  return DDS::RETCODE_UNSUPPORTED;
4031 }
const LogLevel::Value value
Definition: debug.cpp:61
const ReturnCode_t RETCODE_UNSUPPORTED

◆ insert_complex()

bool OpenDDS::XTypes::DynamicDataImpl::insert_complex ( DDS::MemberId  id,
const DDS::DynamicData_var &  value 
)
private

Definition at line 719 of file DynamicDataImpl.cpp.

References container_.

Referenced by clear_value_i(), get_complex_from_collection(), get_complex_from_struct(), get_complex_from_union(), set_complex_to_collection(), set_complex_to_struct(), and set_complex_to_union().

720 {
721  if (container_.single_map_.erase(id) == 0) {
722  if (container_.sequence_map_.erase(id) == 0) {
723  container_.complex_map_.erase(id);
724  }
725  }
726  return container_.complex_map_.insert(std::make_pair(id, value)).second;
727 }
const LogLevel::Value value
Definition: debug.cpp:61

◆ insert_discriminator()

bool OpenDDS::XTypes::DynamicDataImpl::insert_discriminator ( ACE_CDR::Long  value)
private

Definition at line 1587 of file DynamicDataImpl.cpp.

References OpenDDS::XTypes::DISCRIMINATOR_ID, OpenDDS::XTypes::get_base_type(), insert_single(), DDS::RETCODE_OK, OpenDDS::XTypes::TK_BOOLEAN, OpenDDS::XTypes::TK_BYTE, OpenDDS::XTypes::TK_CHAR16, OpenDDS::XTypes::TK_CHAR8, OpenDDS::XTypes::TK_ENUM, OpenDDS::XTypes::TK_INT16, OpenDDS::XTypes::TK_INT32, OpenDDS::XTypes::TK_INT64, OpenDDS::XTypes::TK_INT8, OpenDDS::XTypes::TK_NONE, OpenDDS::XTypes::TK_UINT16, OpenDDS::XTypes::TK_UINT32, OpenDDS::XTypes::TK_UINT64, OpenDDS::XTypes::TK_UINT8, and OpenDDS::XTypes::DynamicDataBase::type_.

Referenced by insert_valid_discriminator().

1588 {
1589  DDS::DynamicTypeMember_var member;
1590  if (type_->get_member(member, DISCRIMINATOR_ID) != DDS::RETCODE_OK) {
1591  return false;
1592  }
1593  DDS::MemberDescriptor_var descriptor;
1594  if (member->get_descriptor(descriptor) != DDS::RETCODE_OK) {
1595  return false;
1596  }
1597  DDS::DynamicType_var discType = get_base_type(descriptor->type());
1598  switch (discType ? discType->get_kind() : TK_NONE) {
1599  case TK_BOOLEAN:
1601  case TK_BYTE:
1603  case TK_CHAR8:
1605 #ifdef DDS_HAS_WCHAR
1606  case TK_CHAR16:
1608 #endif
1609  case TK_INT8:
1611  case TK_UINT8:
1613  case TK_INT16:
1614  return insert_single(DISCRIMINATOR_ID, static_cast<ACE_CDR::Short>(value));
1615  case TK_UINT16:
1616  return insert_single(DISCRIMINATOR_ID, static_cast<ACE_CDR::UShort>(value));
1617  case TK_ENUM:
1618  case TK_INT32:
1620  case TK_UINT32:
1621  return insert_single(DISCRIMINATOR_ID, static_cast<ACE_CDR::ULong>(value));
1622  case TK_INT64:
1623  return insert_single(DISCRIMINATOR_ID, static_cast<ACE_CDR::LongLong>(value));
1624  case TK_UINT64:
1625  return insert_single(DISCRIMINATOR_ID, static_cast<ACE_CDR::ULongLong>(value));
1626  default:
1627  return false;
1628  }
1629 }
const TypeKind TK_INT8
Definition: TypeObject.h:225
const LogLevel::Value value
Definition: debug.cpp:61
bool insert_single(DDS::MemberId id, const ACE_OutputCDR::from_int8 &value)
DDS::DynamicType_var type_
The actual (i.e., non-alias) DynamicType of the associated type.
const ReturnCode_t RETCODE_OK
DDS::DynamicType_var get_base_type(DDS::DynamicType_ptr type)
const TypeKind TK_CHAR16
Definition: TypeObject.h:228
const ACE_CDR::ULong DISCRIMINATOR_ID
Implementation specific sentinel for a union discriminator used in DynamicData.
Definition: TypeObject.h:913
const TypeKind TK_INT32
Definition: TypeObject.h:217
const TypeKind TK_CHAR8
Definition: TypeObject.h:227
const TypeKind TK_NONE
Definition: TypeObject.h:213
const TypeKind TK_UINT16
Definition: TypeObject.h:219
const TypeKind TK_INT64
Definition: TypeObject.h:218
const TypeKind TK_UINT8
Definition: TypeObject.h:226
const TypeKind TK_BOOLEAN
Definition: TypeObject.h:214
const TypeKind TK_INT16
Definition: TypeObject.h:216
const TypeKind TK_ENUM
Definition: TypeObject.h:238
const TypeKind TK_UINT32
Definition: TypeObject.h:220
const TypeKind TK_BYTE
Definition: TypeObject.h:215
const TypeKind TK_UINT64
Definition: TypeObject.h:221

◆ insert_sequence()

template<typename SequenceType >
bool OpenDDS::XTypes::DynamicDataImpl::insert_sequence ( DDS::MemberId  id,
const SequenceType &  value 
)
private

Definition at line 2273 of file DynamicDataImpl.cpp.

References container_.

Referenced by set_values_to_array(), set_values_to_sequence(), set_values_to_struct(), and set_values_to_union().

2274 {
2275  if (container_.complex_map_.erase(id) == 0) {
2276  container_.sequence_map_.erase(id);
2277  }
2278  return container_.sequence_map_.insert(std::make_pair(id, value)).second;
2279 }
const LogLevel::Value value
Definition: debug.cpp:61

◆ insert_single() [1/6]

bool OpenDDS::XTypes::DynamicDataImpl::insert_single ( DDS::MemberId  id,
const ACE_OutputCDR::from_int8 value 
)
private

Definition at line 658 of file DynamicDataImpl.cpp.

References container_.

Referenced by clear_value_i(), get_value_from_collection(), get_value_from_union(), insert_discriminator(), insert_single(), move_sequence_helper(), move_single_to_complex_i(), set_boolean_value(), set_char_common(), set_single_value(), set_value_to_collection(), set_value_to_struct(), set_value_to_union(), and write_discriminator_helper().

659 {
660  // The same member might be already written to complex_map_.
661  // Make sure there is only one entry for each member.
662  if (container_.complex_map_.erase(id) == 0) {
663  container_.single_map_.erase(id);
664  }
665  return container_.single_map_.insert(std::make_pair(id, value)).second;
666 }

◆ insert_single() [2/6]

bool OpenDDS::XTypes::DynamicDataImpl::insert_single ( DDS::MemberId  id,
const ACE_OutputCDR::from_uint8 value 
)
private

Definition at line 668 of file DynamicDataImpl.cpp.

References container_.

669 {
670  if (container_.complex_map_.erase(id) == 0) {
671  container_.single_map_.erase(id);
672  }
673  return container_.single_map_.insert(std::make_pair(id, value)).second;
674 }

◆ insert_single() [3/6]

bool OpenDDS::XTypes::DynamicDataImpl::insert_single ( DDS::MemberId  id,
const ACE_OutputCDR::from_char value 
)
private

Definition at line 676 of file DynamicDataImpl.cpp.

References container_.

677 {
678  if (container_.complex_map_.erase(id) == 0) {
679  container_.single_map_.erase(id);
680  }
681  return container_.single_map_.insert(std::make_pair(id, value)).second;
682 }

◆ insert_single() [4/6]

bool OpenDDS::XTypes::DynamicDataImpl::insert_single ( DDS::MemberId  id,
const ACE_OutputCDR::from_octet value 
)
private

Definition at line 684 of file DynamicDataImpl.cpp.

References container_.

685 {
686  if (container_.complex_map_.erase(id) == 0) {
687  container_.single_map_.erase(id);
688  }
689  return container_.single_map_.insert(std::make_pair(id, value)).second;
690 }

◆ insert_single() [5/6]

bool OpenDDS::XTypes::DynamicDataImpl::insert_single ( DDS::MemberId  id,
const ACE_OutputCDR::from_boolean value 
)
private

Definition at line 692 of file DynamicDataImpl.cpp.

References container_, insert_single(), and value.

693 {
694  if (container_.complex_map_.erase(id) == 0) {
695  container_.single_map_.erase(id);
696  }
697  return container_.single_map_.insert(std::make_pair(id, value)).second;
698 }

◆ insert_single() [6/6]

template<typename SingleType >
bool OpenDDS::XTypes::DynamicDataImpl::insert_single ( DDS::MemberId  id,
const SingleType &  value 
)
private

Definition at line 711 of file DynamicDataImpl.cpp.

References container_.

712 {
713  if (container_.complex_map_.erase(id) == 0) {
714  container_.single_map_.erase(id);
715  }
716  return container_.single_map_.insert(std::make_pair(id, value)).second;
717 }
const LogLevel::Value value
Definition: debug.cpp:61

◆ insert_valid_discriminator()

bool OpenDDS::XTypes::DynamicDataImpl::insert_valid_discriminator ( DDS::MemberDescriptor memberSelected)
private

Definition at line 1558 of file DynamicDataImpl.cpp.

References OpenDDS::DCPS::DisjointSequence::OrderedRanges< T >::add(), OpenDDS::DCPS::DisjointSequence::OrderedRanges< T >::begin(), OpenDDS::XTypes::DISCRIMINATOR_ID, OpenDDS::DCPS::DisjointSequence::OrderedRanges< T >::empty(), DDS::MemberDescriptor::id, insert_discriminator(), DDS::MemberDescriptor::is_default_label, DDS::MemberDescriptor::label, OpenDDS::XTypes::Sequence< T >::length(), DDS::RETCODE_OK, and OpenDDS::XTypes::DynamicDataBase::type_.

Referenced by get_complex_from_union(), get_value_from_union(), set_complex_to_union(), set_value_to_union(), and set_values_to_union().

1559 {
1560  if (memberSelected->is_default_label()) {
1561  DCPS::DisjointSequence::OrderedRanges<ACE_CDR::Long> used;
1562  const ACE_CDR::ULong members = type_->get_member_count();
1563  for (ACE_CDR::ULong i = 0; i < members; ++i) {
1564  DDS::DynamicTypeMember_var member;
1565  if (type_->get_member_by_index(member, i) != DDS::RETCODE_OK) {
1566  return false;
1567  }
1568  if (member->get_id() == DISCRIMINATOR_ID || member->get_id() == memberSelected->id()) {
1569  continue;
1570  }
1571  DDS::MemberDescriptor_var mdesc;
1572  if (member->get_descriptor(mdesc) != DDS::RETCODE_OK) {
1573  return false;
1574  }
1575  const DDS::UnionCaseLabelSeq& lseq = mdesc->label();
1576  for (ACE_CDR::ULong lbl = 0; lbl < lseq.length(); ++lbl) {
1577  used.add(lseq[lbl]);
1578  }
1579  }
1580  const ACE_CDR::Long disc = used.empty() ? 0 : used.begin()->second + 1;
1581  return insert_discriminator(disc);
1582  }
1583  const DDS::UnionCaseLabelSeq& lseq = memberSelected->label();
1584  return lseq.length() && insert_discriminator(lseq[0]);
1585 }
DDS::DynamicType_var type_
The actual (i.e., non-alias) DynamicType of the associated type.
const ReturnCode_t RETCODE_OK
bool insert_discriminator(ACE_CDR::Long value)
const ACE_CDR::ULong DISCRIMINATOR_ID
Implementation specific sentinel for a union discriminator used in DynamicData.
Definition: TypeObject.h:913
ACE_CDR::ULong length() const
Definition: TypeObject.h:167
const_iterator begin() const
Definition: TypeObject.h:195
public boolean is_default_label
ACE_UINT32 ULong
ACE_INT32 Long
public UnionCaseLabelSeq label

◆ is_default_member_selected()

bool OpenDDS::XTypes::DynamicDataImpl::is_default_member_selected ( CORBA::Long  disc_val,
DDS::MemberId  default_id 
) const
private

Definition at line 769 of file DynamicDataImpl.cpp.

References OpenDDS::XTypes::DynamicTypeMembersByIdImpl::begin(), OpenDDS::XTypes::DynamicTypeMembersByIdImpl::end(), OpenDDS::XTypes::Sequence< T >::length(), DDS::RETCODE_OK, OpenDDS::XTypes::TK_UNION, and OpenDDS::XTypes::DynamicDataBase::type_.

Referenced by validate_discriminator().

770 {
771  if (type_->get_kind() != TK_UNION) {
772  return false;
773  }
774 
775  DDS::DynamicTypeMembersById_var members_var;
776  if (type_->get_all_members(members_var) != DDS::RETCODE_OK) {
777  return false;
778  }
779  DynamicTypeMembersByIdImpl* members = dynamic_cast<DynamicTypeMembersByIdImpl*>(members_var.in());
780  if (!members) {
781  return false;
782  }
783 
784  for (DynamicTypeMembersByIdImpl::const_iterator it = members->begin(); it != members->end(); ++it) {
785  if (it->first == default_id) continue;
786 
787  DDS::MemberDescriptor_var md;
788  if (it->second->get_descriptor(md) != DDS::RETCODE_OK) {
789  return false;
790  }
791  const DDS::UnionCaseLabelSeq& labels = md->label();
792  for (CORBA::ULong i = 0; i < labels.length(); ++i) {
793  if (disc_val == labels[i]) {
794  return false;
795  }
796  }
797  }
798  return true;
799 }
DDS::DynamicType_var type_
The actual (i.e., non-alias) DynamicType of the associated type.
const ReturnCode_t RETCODE_OK
ACE_CDR::ULong length() const
Definition: TypeObject.h:167
ACE_CDR::ULong ULong
const TypeKind TK_UNION
Definition: TypeObject.h:244

◆ is_valid_discriminator_type()

bool OpenDDS::XTypes::DynamicDataImpl::is_valid_discriminator_type ( TypeKind  tk)
staticprivate

Definition at line 744 of file DynamicDataImpl.cpp.

References OpenDDS::XTypes::TK_BOOLEAN, OpenDDS::XTypes::TK_BYTE, OpenDDS::XTypes::TK_CHAR16, OpenDDS::XTypes::TK_CHAR8, OpenDDS::XTypes::TK_ENUM, OpenDDS::XTypes::TK_INT16, OpenDDS::XTypes::TK_INT32, OpenDDS::XTypes::TK_INT64, OpenDDS::XTypes::TK_INT8, OpenDDS::XTypes::TK_UINT16, OpenDDS::XTypes::TK_UINT32, OpenDDS::XTypes::TK_UINT64, and OpenDDS::XTypes::TK_UINT8.

Referenced by read_discriminator(), and set_value_to_union().

745 {
746  switch (tk) {
747  case TK_BOOLEAN:
748  case TK_BYTE:
749  case TK_CHAR8:
750 #ifdef DDS_HAS_WCHAR
751  case TK_CHAR16:
752 #endif
753  case TK_INT8:
754  case TK_UINT8:
755  case TK_INT16:
756  case TK_UINT16:
757  case TK_INT32:
758  case TK_UINT32:
759  case TK_INT64:
760  case TK_UINT64:
761  case TK_ENUM:
762  return true;
763  default:
764  return false;
765  }
766 }
const TypeKind TK_INT8
Definition: TypeObject.h:225
const TypeKind TK_CHAR16
Definition: TypeObject.h:228
const TypeKind TK_INT32
Definition: TypeObject.h:217
const TypeKind TK_CHAR8
Definition: TypeObject.h:227
const TypeKind TK_UINT16
Definition: TypeObject.h:219
const TypeKind TK_INT64
Definition: TypeObject.h:218
const TypeKind TK_UINT8
Definition: TypeObject.h:226
const TypeKind TK_BOOLEAN
Definition: TypeObject.h:214
const TypeKind TK_INT16
Definition: TypeObject.h:216
const TypeKind TK_ENUM
Definition: TypeObject.h:238
const TypeKind TK_UINT32
Definition: TypeObject.h:220
const TypeKind TK_BYTE
Definition: TypeObject.h:215
const TypeKind TK_UINT64
Definition: TypeObject.h:221

◆ loan_value()

DDS::DynamicData_ptr OpenDDS::XTypes::DynamicDataImpl::loan_value ( DDS::MemberId  id)

Definition at line 641 of file DynamicDataImpl.cpp.

References ACE_ERROR, and LM_ERROR.

642 {
643  ACE_ERROR((LM_ERROR, "(%P|%t) ERROR: DynamicDataImpl::loan_value: Not implemented\n"));
644  return 0;
645 }
#define ACE_ERROR(X)

◆ move_sequence_helper()

template<typename SequenceType >
void OpenDDS::XTypes::DynamicDataImpl::move_sequence_helper ( const DataContainer::const_sequence_iterator &  it,
DynamicDataImpl data 
)
private

Definition at line 3475 of file DynamicDataImpl.cpp.

References insert_single().

3477 {
3478  const SequenceType& values = it->second.get<SequenceType>();
3479  for (CORBA::ULong i = 0; i < values.length(); ++i) {
3480  data->insert_single(i, values[i]);
3481  }
3482 }
ACE_CDR::ULong ULong

◆ move_sequence_to_complex()

bool OpenDDS::XTypes::DynamicDataImpl::move_sequence_to_complex ( const DataContainer::const_sequence_iterator &  it,
DynamicDataImpl data 
)
private

Definition at line 3569 of file DynamicDataImpl.cpp.

References OpenDDS::XTypes::get_base_type(), DDS::RETCODE_OK, OpenDDS::XTypes::TK_BOOLEAN, OpenDDS::XTypes::TK_BYTE, OpenDDS::XTypes::TK_CHAR16, OpenDDS::XTypes::TK_CHAR8, OpenDDS::XTypes::TK_FLOAT128, OpenDDS::XTypes::TK_FLOAT32, OpenDDS::XTypes::TK_FLOAT64, OpenDDS::XTypes::TK_INT16, OpenDDS::XTypes::TK_INT32, OpenDDS::XTypes::TK_INT64, OpenDDS::XTypes::TK_INT8, OpenDDS::XTypes::TK_STRING16, OpenDDS::XTypes::TK_STRING8, OpenDDS::XTypes::TK_UINT16, OpenDDS::XTypes::TK_UINT32, OpenDDS::XTypes::TK_UINT64, OpenDDS::XTypes::TK_UINT8, and type().

Referenced by get_complex_from_aggregated(), and get_complex_from_collection().

3571 {
3572  DDS::DynamicType_var seq_type = data->type();
3573  DDS::TypeDescriptor_var seq_td;
3574  if (seq_type->get_descriptor(seq_td) != DDS::RETCODE_OK) {
3575  return false;
3576  }
3577  DDS::DynamicType_var elem_type = get_base_type(seq_td->element_type());
3578 
3579  switch (elem_type->get_kind()) {
3580  case TK_INT8: {
3581  move_sequence_helper<DDS::Int8Seq>(it, data);
3582  break;
3583  }
3584  case TK_UINT8: {
3585  move_sequence_helper<DDS::UInt8Seq>(it, data);
3586  break;
3587  }
3588  case TK_INT16: {
3589  move_sequence_helper<DDS::Int16Seq>(it, data);
3590  break;
3591  }
3592  case TK_UINT16: {
3593  move_sequence_helper<DDS::UInt16Seq>(it, data);
3594  break;
3595  }
3596  case TK_INT32: {
3597  move_sequence_helper<DDS::Int32Seq>(it, data);
3598  break;
3599  }
3600  case TK_UINT32: {
3601  move_sequence_helper<DDS::UInt32Seq>(it, data);
3602  break;
3603  }
3604  case TK_INT64: {
3605  move_sequence_helper<DDS::Int64Seq>(it, data);
3606  break;
3607  }
3608  case TK_UINT64: {
3609  move_sequence_helper<DDS::UInt64Seq>(it, data);
3610  break;
3611  }
3612  case TK_FLOAT32: {
3613  move_sequence_helper<DDS::Float32Seq>(it, data);
3614  break;
3615  }
3616  case TK_FLOAT64: {
3617  move_sequence_helper<DDS::Float64Seq>(it, data);
3618  break;
3619  }
3620  case TK_FLOAT128: {
3621  move_sequence_helper<DDS::Float128Seq>(it, data);
3622  break;
3623  }
3624  case TK_CHAR8: {
3625  move_sequence_helper<DDS::CharSeq>(it, data);
3626  break;
3627  }
3628 #ifdef DDS_HAS_WCHAR
3629  case TK_CHAR16: {
3630  move_sequence_helper<DDS::WcharSeq>(it, data);
3631  break;
3632  }
3633 #endif
3634  case TK_BYTE: {
3635  move_sequence_helper<DDS::ByteSeq>(it, data);
3636  break;
3637  }
3638  case TK_BOOLEAN: {
3639  move_sequence_helper<DDS::BooleanSeq>(it, data);
3640  break;
3641  }
3642  case TK_STRING8: {
3643  move_sequence_helper<DDS::StringSeq>(it, data);
3644  break;
3645  }
3646 #ifdef DDS_HAS_WCHAR
3647  case TK_STRING16: {
3648  move_sequence_helper<DDS::WstringSeq>(it, data);
3649  break;
3650  }
3651 #endif
3652  default:
3653  return false;
3654  }
3655  return true;
3656 }
const TypeKind TK_INT8
Definition: TypeObject.h:225
const TypeKind TK_FLOAT128
Definition: TypeObject.h:224
const ReturnCode_t RETCODE_OK
DDS::DynamicType_var get_base_type(DDS::DynamicType_ptr type)
const TypeKind TK_CHAR16
Definition: TypeObject.h:228
const TypeKind TK_INT32
Definition: TypeObject.h:217
const TypeKind TK_CHAR8
Definition: TypeObject.h:227
const TypeKind TK_STRING16
Definition: TypeObject.h:232
const TypeKind TK_UINT16
Definition: TypeObject.h:219
const TypeKind TK_INT64
Definition: TypeObject.h:218
const TypeKind TK_UINT8
Definition: TypeObject.h:226
const TypeKind TK_FLOAT32
Definition: TypeObject.h:222
const TypeKind TK_BOOLEAN
Definition: TypeObject.h:214
const TypeKind TK_INT16
Definition: TypeObject.h:216
const TypeKind TK_FLOAT64
Definition: TypeObject.h:223
const TypeKind TK_STRING8
Definition: TypeObject.h:231
const TypeKind TK_UINT32
Definition: TypeObject.h:220
const TypeKind TK_BYTE
Definition: TypeObject.h:215
const TypeKind TK_UINT64
Definition: TypeObject.h:221

◆ move_single_to_complex()

bool OpenDDS::XTypes::DynamicDataImpl::move_single_to_complex ( const DataContainer::const_single_iterator &  it,
DynamicDataImpl data 
)
private

Definition at line 3355 of file DynamicDataImpl.cpp.

References OpenDDS::XTypes::enum_bound(), move_single_to_complex_i(), DDS::RETCODE_OK, OpenDDS::XTypes::TK_ENUM, and type().

Referenced by get_complex_from_aggregated(), and get_complex_from_collection().

3357 {
3358  DDS::DynamicType_var member_type = data->type();
3359  const TypeKind member_tk = member_type->get_kind();
3360  TypeKind treat_as = member_tk;
3361  if (member_tk == TK_ENUM) {
3362  if (enum_bound(member_type, treat_as) != DDS::RETCODE_OK) {
3363  return false;
3364  }
3365  }
3366  return move_single_to_complex_i(it, data, treat_as);
3367 }
const ReturnCode_t RETCODE_OK
DDS::ReturnCode_t enum_bound(DDS::DynamicType_ptr type, DDS::TypeKind &bound_kind)
const TypeKind TK_ENUM
Definition: TypeObject.h:238
bool move_single_to_complex_i(const DataContainer::const_single_iterator &it, DynamicDataImpl *data, const TypeKind treat_as)
ACE_CDR::Octet TypeKind
Definition: TypeObject.h:210

◆ move_single_to_complex_i()

bool OpenDDS::XTypes::DynamicDataImpl::move_single_to_complex_i ( const DataContainer::const_single_iterator &  it,
DynamicDataImpl data,
const TypeKind  treat_as 
)
private

Definition at line 3369 of file DynamicDataImpl.cpp.

References insert_single(), OpenDDS::XTypes::MEMBER_ID_INVALID, ACE_OS::strlen(), OpenDDS::XTypes::TK_BOOLEAN, OpenDDS::XTypes::TK_BYTE, OpenDDS::XTypes::TK_CHAR16, OpenDDS::XTypes::TK_CHAR8, OpenDDS::XTypes::TK_FLOAT128, OpenDDS::XTypes::TK_FLOAT32, OpenDDS::XTypes::TK_FLOAT64, OpenDDS::XTypes::TK_INT16, OpenDDS::XTypes::TK_INT32, OpenDDS::XTypes::TK_INT64, OpenDDS::XTypes::TK_INT8, OpenDDS::XTypes::TK_STRING16, OpenDDS::XTypes::TK_STRING8, OpenDDS::XTypes::TK_UINT16, OpenDDS::XTypes::TK_UINT32, OpenDDS::XTypes::TK_UINT64, and OpenDDS::XTypes::TK_UINT8.

Referenced by move_single_to_complex().

3371 {
3372  switch (treat_as) {
3373  case TK_INT8: {
3374  const ACE_OutputCDR::from_int8& value = it->second.get<ACE_OutputCDR::from_int8>();
3375  data->insert_single(MEMBER_ID_INVALID, value);
3376  break;
3377  }
3378  case TK_UINT8: {
3379  const ACE_OutputCDR::from_uint8& value = it->second.get<ACE_OutputCDR::from_uint8>();
3380  data->insert_single(MEMBER_ID_INVALID, value);
3381  break;
3382  }
3383  case TK_INT16: {
3384  const CORBA::Short value = it->second.get<CORBA::Short>();
3385  data->insert_single(MEMBER_ID_INVALID, value);
3386  break;
3387  }
3388  case TK_UINT16: {
3389  const CORBA::UShort value = it->second.get<CORBA::UShort>();
3390  data->insert_single(MEMBER_ID_INVALID, value);
3391  break;
3392  }
3393  case TK_INT32: {
3394  const CORBA::Long value = it->second.get<CORBA::Long>();
3395  data->insert_single(MEMBER_ID_INVALID, value);
3396  break;
3397  }
3398  case TK_UINT32: {
3399  const CORBA::ULong value = it->second.get<CORBA::ULong>();
3400  data->insert_single(MEMBER_ID_INVALID, value);
3401  break;
3402  }
3403  case TK_INT64: {
3404  const CORBA::LongLong value = it->second.get<CORBA::LongLong>();
3405  data->insert_single(MEMBER_ID_INVALID, value);
3406  break;
3407  }
3408  case TK_UINT64: {
3409  const CORBA::ULongLong value = it->second.get<CORBA::ULongLong>();
3410  data->insert_single(MEMBER_ID_INVALID, value);
3411  break;
3412  }
3413  case TK_FLOAT32: {
3414  const CORBA::Float value = it->second.get<CORBA::Float>();
3415  data->insert_single(MEMBER_ID_INVALID, value);
3416  break;
3417  }
3418  case TK_FLOAT64: {
3419  const CORBA::Double value = it->second.get<CORBA::Double>();
3420  data->insert_single(MEMBER_ID_INVALID, value);
3421  break;
3422  }
3423  case TK_FLOAT128: {
3424  const CORBA::LongDouble value = it->second.get<CORBA::LongDouble>();
3425  data->insert_single(MEMBER_ID_INVALID, value);
3426  break;
3427  }
3428  case TK_CHAR8: {
3429  const ACE_OutputCDR::from_char& value = it->second.get<ACE_OutputCDR::from_char>();
3430  data->insert_single(MEMBER_ID_INVALID, value);
3431  break;
3432  }
3433 #ifdef DDS_HAS_WCHAR
3434  case TK_CHAR16: {
3435  const ACE_OutputCDR::from_wchar& value = it->second.get<ACE_OutputCDR::from_wchar>();
3436  data->insert_single(MEMBER_ID_INVALID, value);
3437  break;
3438  }
3439 #endif
3440  case TK_BYTE: {
3441  const ACE_OutputCDR::from_octet& value = it->second.get<ACE_OutputCDR::from_octet>();
3442  data->insert_single(MEMBER_ID_INVALID, value);
3443  break;
3444  }
3445  case TK_BOOLEAN: {
3446  const ACE_OutputCDR::from_boolean& value = it->second.get<ACE_OutputCDR::from_boolean>();
3447  data->insert_single(MEMBER_ID_INVALID, value);
3448  break;
3449  }
3450  case TK_STRING8: {
3451  const char* str = it->second.get<const char*>();
3452  const size_t len = ACE_OS::strlen(str);
3453  for (CORBA::ULong i = 0; i < len; ++i) {
3454  data->insert_single(i, ACE_OutputCDR::from_char(str[i]));
3455  }
3456  break;
3457  }
3458 #ifdef DDS_HAS_WCHAR
3459  case TK_STRING16: {
3460  const CORBA::WChar* wstr = it->second.get<const CORBA::WChar*>();
3461  const size_t len = ACE_OS::strlen(wstr);
3462  for (CORBA::ULong i = 0; i < len; ++i) {
3463  data->insert_single(i, ACE_OutputCDR::from_wchar(wstr[i]));
3464  }
3465  break;
3466  }
3467 #endif
3468  default:
3469  return false;
3470  }
3471  return true;
3472 }
ACE_CDR::Long Long
const TypeKind TK_INT8
Definition: TypeObject.h:225
const LogLevel::Value value
Definition: debug.cpp:61
const TypeKind TK_FLOAT128
Definition: TypeObject.h:224
const TypeKind TK_CHAR16
Definition: TypeObject.h:228
ACE_CDR::LongLong LongLong
ACE_CDR::Short Short
const TypeKind TK_INT32
Definition: TypeObject.h:217
const TypeKind TK_CHAR8
Definition: TypeObject.h:227
const TypeKind TK_STRING16
Definition: TypeObject.h:232
size_t strlen(const char *s)
ACE_CDR::ULongLong ULongLong
const TypeKind TK_UINT16
Definition: TypeObject.h:219
const ACE_CDR::ULong MEMBER_ID_INVALID
Definition: TypeObject.h:911
ACE_CDR::ULong ULong
const TypeKind TK_INT64
Definition: TypeObject.h:218
const TypeKind TK_UINT8
Definition: TypeObject.h:226
const TypeKind TK_FLOAT32
Definition: TypeObject.h:222
const TypeKind TK_BOOLEAN
Definition: TypeObject.h:214
const TypeKind TK_INT16
Definition: TypeObject.h:216
ACE_CDR::UShort UShort
const TypeKind TK_FLOAT64
Definition: TypeObject.h:223
const TypeKind TK_STRING8
Definition: TypeObject.h:231
const TypeKind TK_UINT32
Definition: TypeObject.h:220
const TypeKind TK_BYTE
Definition: TypeObject.h:215
const TypeKind TK_UINT64
Definition: TypeObject.h:221
ACE_CDR::WChar WChar

◆ OPENDDS_VECTOR()

typedef OpenDDS::XTypes::DynamicDataImpl::OPENDDS_VECTOR ( CORBA::ULong  )
private

◆ read_basic_in_complex_map()

template<typename ValueType >
bool OpenDDS::XTypes::DynamicDataImpl::read_basic_in_complex_map ( ValueType &  value,
DDS::MemberId  id 
)
private

Definition at line 2738 of file DynamicDataImpl.cpp.

References container_, and read_basic_value().

Referenced by read_basic_member().

2739 {
2740  DataContainer::const_complex_iterator complex_it = container_.complex_map_.find(id);
2741  if (complex_it != container_.complex_map_.end()) {
2742  DynamicDataImpl* nested_dd = dynamic_cast<DynamicDataImpl*>(complex_it->second.in());
2743  return nested_dd && nested_dd->read_basic_value(value);
2744  }
2745  return false;
2746 }
const LogLevel::Value value
Definition: debug.cpp:61
DynamicDataImpl(DDS::DynamicType_ptr type)

◆ read_basic_in_single_map() [1/3]

template<typename ValueType >
bool OpenDDS::XTypes::DynamicDataImpl::read_basic_in_single_map ( ValueType &  value,
DDS::MemberId  id 
)
private

Read a basic member from a containing type.

Definition at line 2703 of file DynamicDataImpl.cpp.

References container_.

Referenced by get_value_from_union(), and read_basic_member().

2704 {
2705  DataContainer::const_single_iterator single_it = container_.single_map_.find(id);
2706  if (single_it != container_.single_map_.end()) {
2707  value = single_it->second.get<ValueType>();
2708  return true;
2709  }
2710  return false;
2711 }
const LogLevel::Value value
Definition: debug.cpp:61

◆ read_basic_in_single_map() [2/3]

template<>
bool OpenDDS::XTypes::DynamicDataImpl::read_basic_in_single_map ( char *&  value,
DDS::MemberId  id 
)

Definition at line 2714 of file DynamicDataImpl.cpp.

References container_, and CORBA::string_free().

2715 {
2716  DataContainer::const_single_iterator single_it = container_.single_map_.find(id);
2717  if (single_it != container_.single_map_.end()) {
2719  value = single_it->second.get_string();
2720  return true;
2721  }
2722  return false;
2723 }
const LogLevel::Value value
Definition: debug.cpp:61
void string_free(char *)

◆ read_basic_in_single_map() [3/3]

template<>
bool OpenDDS::XTypes::DynamicDataImpl::read_basic_in_single_map ( CORBA::WChar *&  value,
DDS::MemberId  id 
)

Definition at line 2726 of file DynamicDataImpl.cpp.

References container_, and CORBA::wstring_free().

2727 {
2728  DataContainer::const_single_iterator single_it = container_.single_map_.find(id);
2729  if (single_it != container_.single_map_.end()) {
2731  value = single_it->second.get_wstring();
2732  return true;
2733  }
2734  return false;
2735 }
const LogLevel::Value value
Definition: debug.cpp:61
void wstring_free(WChar *const)

◆ read_basic_member() [1/3]

template<typename ValueType >
bool OpenDDS::XTypes::DynamicDataImpl::read_basic_member ( ValueType &  value,
DDS::MemberId  id 
)
private

Definition at line 2749 of file DynamicDataImpl.cpp.

References read_basic_in_complex_map(), and read_basic_in_single_map().

Referenced by get_char_common(), get_value_from_collection(), get_value_from_struct(), and get_value_from_union().

2750 {
2752 }
const LogLevel::Value value
Definition: debug.cpp:61
bool read_basic_in_complex_map(ValueType &value, DDS::MemberId id)
bool read_basic_in_single_map(ValueType &value, DDS::MemberId id)
Read a basic member from a containing type.

◆ read_basic_member() [2/3]

template<>
bool OpenDDS::XTypes::DynamicDataImpl::read_basic_member ( char *&  value,
DDS::MemberId  id 
)

Definition at line 2755 of file DynamicDataImpl.cpp.

References read_basic_in_complex_map(), and read_basic_in_single_map().

2756 {
2758 }
const LogLevel::Value value
Definition: debug.cpp:61
bool read_basic_in_complex_map(ValueType &value, DDS::MemberId id)
bool read_basic_in_single_map(ValueType &value, DDS::MemberId id)
Read a basic member from a containing type.

◆ read_basic_member() [3/3]

template<>
bool OpenDDS::XTypes::DynamicDataImpl::read_basic_member ( CORBA::WChar *&  value,
DDS::MemberId  id 
)

Definition at line 2761 of file DynamicDataImpl.cpp.

References read_basic_in_complex_map(), and read_basic_in_single_map().

2762 {
2764 }
const LogLevel::Value value
Definition: debug.cpp:61
bool read_basic_in_complex_map(ValueType &value, DDS::MemberId id)
bool read_basic_in_single_map(ValueType &value, DDS::MemberId id)
Read a basic member from a containing type.

◆ read_basic_value() [1/16]

bool OpenDDS::XTypes::DynamicDataImpl::read_basic_value ( ACE_OutputCDR::from_int8 value)
private

Group of functions to read a basic value represented by this DynamicData instance.

Definition at line 2577 of file DynamicDataImpl.cpp.

References get_int8_value(), OpenDDS::XTypes::MEMBER_ID_INVALID, DDS::RETCODE_OK, and ACE_OutputCDR::from_int8::val_.

Referenced by OpenDDS::XTypes::DynamicDataImpl::get_boolean_from_bitmask< CORBA::UInt8 >(), get_boolean_from_bitmask(), get_simple_value_string(), read_basic_in_complex_map(), and read_basic_value().

2578 {
2580 }
const ReturnCode_t RETCODE_OK
const ACE_CDR::ULong MEMBER_ID_INVALID
Definition: TypeObject.h:911
DDS::ReturnCode_t get_int8_value(CORBA::Int8 &value, DDS::MemberId id)

◆ read_basic_value() [2/16]

bool OpenDDS::XTypes::DynamicDataImpl::read_basic_value ( ACE_OutputCDR::from_uint8 value)
private

Definition at line 2582 of file DynamicDataImpl.cpp.

References get_uint8_value(), OpenDDS::XTypes::MEMBER_ID_INVALID, DDS::RETCODE_OK, and ACE_OutputCDR::from_uint8::val_.

2583 {
2585 }
const ReturnCode_t RETCODE_OK
const ACE_CDR::ULong MEMBER_ID_INVALID
Definition: TypeObject.h:911
DDS::ReturnCode_t get_uint8_value(CORBA::UInt8 &value, DDS::MemberId id)

◆ read_basic_value() [3/16]

bool OpenDDS::XTypes::DynamicDataImpl::read_basic_value ( CORBA::Short value)
private

Definition at line 2587 of file DynamicDataImpl.cpp.

References get_int16_value(), OpenDDS::XTypes::MEMBER_ID_INVALID, and DDS::RETCODE_OK.

2588 {
2590 }
const LogLevel::Value value
Definition: debug.cpp:61
const ReturnCode_t RETCODE_OK
const ACE_CDR::ULong MEMBER_ID_INVALID
Definition: TypeObject.h:911
DDS::ReturnCode_t get_int16_value(CORBA::Short &value, DDS::MemberId id)

◆ read_basic_value() [4/16]

bool OpenDDS::XTypes::DynamicDataImpl::read_basic_value ( CORBA::UShort value)
private

Definition at line 2592 of file DynamicDataImpl.cpp.

References get_uint16_value(), OpenDDS::XTypes::MEMBER_ID_INVALID, and DDS::RETCODE_OK.

2593 {
2595 }
const LogLevel::Value value
Definition: debug.cpp:61
const ReturnCode_t RETCODE_OK
const ACE_CDR::ULong MEMBER_ID_INVALID
Definition: TypeObject.h:911
DDS::ReturnCode_t get_uint16_value(CORBA::UShort &value, DDS::MemberId id)

◆ read_basic_value() [5/16]

bool OpenDDS::XTypes::DynamicDataImpl::read_basic_value ( CORBA::Long value)
private

Definition at line 2597 of file DynamicDataImpl.cpp.

References get_int32_value(), OpenDDS::XTypes::MEMBER_ID_INVALID, and DDS::RETCODE_OK.

2598 {
2600 }
const LogLevel::Value value
Definition: debug.cpp:61
const ReturnCode_t RETCODE_OK
DDS::ReturnCode_t get_int32_value(CORBA::Long &value, DDS::MemberId id)
const ACE_CDR::ULong MEMBER_ID_INVALID
Definition: TypeObject.h:911

◆ read_basic_value() [6/16]

bool OpenDDS::XTypes::DynamicDataImpl::read_basic_value ( CORBA::ULong value)
private

Definition at line 2602 of file DynamicDataImpl.cpp.

References get_uint32_value(), OpenDDS::XTypes::MEMBER_ID_INVALID, and DDS::RETCODE_OK.

2603 {
2605 }
DDS::ReturnCode_t get_uint32_value(CORBA::ULong &value, DDS::MemberId)
const LogLevel::Value value
Definition: debug.cpp:61
const ReturnCode_t RETCODE_OK
const ACE_CDR::ULong MEMBER_ID_INVALID
Definition: TypeObject.h:911

◆ read_basic_value() [7/16]

bool OpenDDS::XTypes::DynamicDataImpl::read_basic_value ( CORBA::LongLong value)
private

Definition at line 2607 of file DynamicDataImpl.cpp.

References get_int64_value(), OpenDDS::XTypes::MEMBER_ID_INVALID, and DDS::RETCODE_OK.

2608 {
2610 }
DDS::ReturnCode_t get_int64_value(CORBA::LongLong &value, DDS::MemberId id)
const LogLevel::Value value
Definition: debug.cpp:61
const ReturnCode_t RETCODE_OK
const ACE_CDR::ULong MEMBER_ID_INVALID
Definition: TypeObject.h:911

◆ read_basic_value() [8/16]

bool OpenDDS::XTypes::DynamicDataImpl::read_basic_value ( CORBA::ULongLong value)
private

Definition at line 2612 of file DynamicDataImpl.cpp.

References get_uint64_value(), OpenDDS::XTypes::MEMBER_ID_INVALID, and DDS::RETCODE_OK.

2613 {
2615 }
const LogLevel::Value value
Definition: debug.cpp:61
const ReturnCode_t RETCODE_OK
const ACE_CDR::ULong MEMBER_ID_INVALID
Definition: TypeObject.h:911
DDS::ReturnCode_t get_uint64_value(CORBA::ULongLong &value, DDS::MemberId id)

◆ read_basic_value() [9/16]

bool OpenDDS::XTypes::DynamicDataImpl::read_basic_value ( CORBA::Float value)
private

Definition at line 2617 of file DynamicDataImpl.cpp.

References get_float32_value(), OpenDDS::XTypes::MEMBER_ID_INVALID, and DDS::RETCODE_OK.

2618 {
2620 }
const ReturnCode_t RETCODE_OK
DDS::ReturnCode_t get_float32_value(CORBA::Float &value, DDS::MemberId id)
const ACE_CDR::ULong MEMBER_ID_INVALID
Definition: TypeObject.h:911

◆ read_basic_value() [10/16]

bool OpenDDS::XTypes::DynamicDataImpl::read_basic_value ( CORBA::Double value)
private

Definition at line 2622 of file DynamicDataImpl.cpp.

References get_float64_value(), OpenDDS::XTypes::MEMBER_ID_INVALID, and DDS::RETCODE_OK.

2623 {
2625 }
const ReturnCode_t RETCODE_OK
const ACE_CDR::ULong MEMBER_ID_INVALID
Definition: TypeObject.h:911
DDS::ReturnCode_t get_float64_value(CORBA::Double &value, DDS::MemberId id)

◆ read_basic_value() [11/16]

bool OpenDDS::XTypes::DynamicDataImpl::read_basic_value ( CORBA::LongDouble value)
private

Definition at line 2627 of file DynamicDataImpl.cpp.

References get_float128_value(), OpenDDS::XTypes::MEMBER_ID_INVALID, and DDS::RETCODE_OK.

2628 {
2630 }
const ReturnCode_t RETCODE_OK
const ACE_CDR::ULong MEMBER_ID_INVALID
Definition: TypeObject.h:911
DDS::ReturnCode_t get_float128_value(CORBA::LongDouble &value, DDS::MemberId id)

◆ read_basic_value() [12/16]

bool OpenDDS::XTypes::DynamicDataImpl::read_basic_value ( ACE_OutputCDR::from_char value)
private

Definition at line 2632 of file DynamicDataImpl.cpp.

References get_char16_value(), get_char8_value(), OpenDDS::XTypes::MEMBER_ID_INVALID, read_basic_value(), DDS::RETCODE_OK, ACE_OutputCDR::from_wchar::val_, and ACE_OutputCDR::from_char::val_.

2633 {
2635 }
const ReturnCode_t RETCODE_OK
const ACE_CDR::ULong MEMBER_ID_INVALID
Definition: TypeObject.h:911
DDS::ReturnCode_t get_char8_value(CORBA::Char &value, DDS::MemberId id)

◆ read_basic_value() [13/16]

bool OpenDDS::XTypes::DynamicDataImpl::read_basic_value ( ACE_OutputCDR::from_wchar value)
private

◆ read_basic_value() [14/16]

bool OpenDDS::XTypes::DynamicDataImpl::read_basic_value ( ACE_OutputCDR::from_octet value)
private

Definition at line 2644 of file DynamicDataImpl.cpp.

References get_byte_value(), OpenDDS::XTypes::MEMBER_ID_INVALID, DDS::RETCODE_OK, and ACE_OutputCDR::from_octet::val_.

2645 {
2647 }
const ReturnCode_t RETCODE_OK
const ACE_CDR::ULong MEMBER_ID_INVALID
Definition: TypeObject.h:911
DDS::ReturnCode_t get_byte_value(CORBA::Octet &value, DDS::MemberId id)

◆ read_basic_value() [15/16]

bool OpenDDS::XTypes::DynamicDataImpl::read_basic_value ( ACE_OutputCDR::from_boolean value)
private

Definition at line 2649 of file DynamicDataImpl.cpp.

References get_boolean_value(), OpenDDS::XTypes::MEMBER_ID_INVALID, DDS::RETCODE_OK, and ACE_OutputCDR::from_boolean::val_.

2650 {
2652 }
DDS::ReturnCode_t get_boolean_value(CORBA::Boolean &value, DDS::MemberId id)
const ReturnCode_t RETCODE_OK
const ACE_CDR::ULong MEMBER_ID_INVALID
Definition: TypeObject.h:911

◆ read_basic_value() [16/16]

bool OpenDDS::XTypes::DynamicDataImpl::read_basic_value ( char *&  value) const
private

Definition at line 2654 of file DynamicDataImpl.cpp.

References TAO::String_var< charT >::_retn(), container_, OpenDDS::XTypes::DynamicDataImpl::DataContainer::get_largest_index_basic(), TAO::String_var< charT >::inout(), ACE_OS::memset(), read_basic_value(), OpenDDS::XTypes::DynamicDataImpl::DataContainer::reconstruct_string_value(), OpenDDS::XTypes::DynamicDataImpl::DataContainer::reconstruct_wstring_value(), CORBA::string_alloc(), CORBA::string_dup(), CORBA::string_free(), CORBA::wstring_alloc(), CORBA::wstring_dup(), and CORBA::wstring_free().

2655 {
2656  const bool is_empty = container_.single_map_.empty() && container_.complex_map_.empty();
2657  if (!is_empty) {
2658  CORBA::ULong largest_index;
2659  if (!container_.get_largest_index_basic(largest_index)) {
2660  return false;
2661  }
2662  const CORBA::ULong length = largest_index + 2;
2663  CORBA::String_var str_var = CORBA::string_alloc(length);
2664  ACE_OS::memset(str_var.inout(), 0, length);
2665  if (!container_.reconstruct_string_value(str_var.inout())) {
2666  return false;
2667  }
2669  value = str_var._retn();
2670  } else {
2672  value = CORBA::string_dup("");
2673  }
2674  return true;
2675 }
const LogLevel::Value value
Definition: debug.cpp:61
char * string_alloc(ULong len)
bool get_largest_index_basic(CORBA::ULong &index) const
char * string_dup(const char *)
ACE_CDR::ULong ULong
bool reconstruct_string_value(CORBA::Char *str) const
void string_free(char *)
character_type *& inout(void)
character_type * _retn(void)
void * memset(void *s, int c, size_t len)

◆ read_discriminator() [1/2]

bool OpenDDS::XTypes::DynamicDataImpl::read_discriminator ( CORBA::Long disc_val) const
private

Definition at line 1296 of file DynamicDataImpl.cpp.

References container_, is_valid_discriminator_type(), OpenDDS::XTypes::MEMBER_ID_INVALID, and OpenDDS::XTypes::DynamicDataBase::type_.

Referenced by set_complex_to_union().

1297 {
1298  if (!is_valid_discriminator_type(type_->get_kind())) {
1299  return false;
1300  }
1301  DataContainer::const_single_iterator it = container_.single_map_.find(MEMBER_ID_INVALID);
1302  if (it == container_.single_map_.end()) {
1303  return false;
1304  }
1305  return read_discriminator(disc_val, type_, it);
1306 }
DDS::DynamicType_var type_
The actual (i.e., non-alias) DynamicType of the associated type.
bool read_discriminator(CORBA::Long &disc_val) const
const ACE_CDR::ULong MEMBER_ID_INVALID
Definition: TypeObject.h:911
static bool is_valid_discriminator_type(TypeKind tk)

◆ read_discriminator() [2/2]

bool OpenDDS::XTypes::DynamicDataImpl::read_discriminator ( CORBA::Long disc_val,
const DDS::DynamicType_var &  disc_type,
DataContainer::const_single_iterator  it 
) const
private

Definition at line 1209 of file DynamicDataImpl.cpp.

References DDS::RETCODE_OK, OpenDDS::XTypes::TK_BOOLEAN, OpenDDS::XTypes::TK_BYTE, OpenDDS::XTypes::TK_CHAR16, OpenDDS::XTypes::TK_CHAR8, OpenDDS::XTypes::TK_ENUM, OpenDDS::XTypes::TK_INT16, OpenDDS::XTypes::TK_INT32, OpenDDS::XTypes::TK_INT64, OpenDDS::XTypes::TK_INT8, OpenDDS::XTypes::TK_UINT16, OpenDDS::XTypes::TK_UINT32, OpenDDS::XTypes::TK_UINT64, OpenDDS::XTypes::TK_UINT8, ACE_OutputCDR::from_char::val_, ACE_OutputCDR::from_wchar::val_, ACE_OutputCDR::from_uint8::val_, ACE_OutputCDR::from_boolean::val_, ACE_OutputCDR::from_int8::val_, ACE_OutputCDR::from_octet::val_, and value.

1211 {
1212  switch (disc_type->get_kind()) {
1213  case TK_BOOLEAN: {
1215  disc_val = static_cast<CORBA::Long>(value.val_);
1216  return true;
1217  }
1218  case TK_BYTE: {
1219  const ACE_OutputCDR::from_octet& value = it->second.get<ACE_OutputCDR::from_octet>();
1220  disc_val = static_cast<CORBA::Long>(value.val_);
1221  return true;
1222  }
1223  case TK_CHAR8: {
1224  const ACE_OutputCDR::from_char& value = it->second.get<ACE_OutputCDR::from_char>();
1225  disc_val = static_cast<CORBA::Long>(value.val_);
1226  return true;
1227  }
1228 #ifdef DDS_HAS_WCHAR
1229  case TK_CHAR16: {
1230  const ACE_OutputCDR::from_wchar& value = it->second.get<ACE_OutputCDR::from_wchar>();
1231  disc_val = static_cast<CORBA::Long>(value.val_);
1232  return true;
1233  }
1234 #endif
1235  case TK_INT8: {
1236  const ACE_OutputCDR::from_int8& value = it->second.get<ACE_OutputCDR::from_int8>();
1237  disc_val = static_cast<CORBA::Long>(value.val_);
1238  return true;
1239  }
1240  case TK_UINT8: {
1241  const ACE_OutputCDR::from_uint8& value = it->second.get<ACE_OutputCDR::from_uint8>();
1242  disc_val = static_cast<CORBA::Long>(value.val_);
1243  return true;
1244  }
1245  case TK_INT16: {
1246  CORBA::Short value = it->second.get<CORBA::Short>();
1247  disc_val = static_cast<CORBA::Long>(value);
1248  return true;
1249  }
1250  case TK_UINT16: {
1251  CORBA::UShort value = it->second.get<CORBA::UShort>();
1252  disc_val = static_cast<CORBA::Long>(value);
1253  return true;
1254  }
1255  case TK_INT32: {
1256  disc_val = it->second.get<CORBA::Long>();
1257  return true;
1258  }
1259  case TK_UINT32: {
1260  CORBA::ULong value = it->second.get<CORBA::ULong>();
1261  disc_val = static_cast<CORBA::Long>(value);
1262  return true;
1263  }
1264  case TK_INT64: {
1265  CORBA::LongLong value = it->second.get<CORBA::LongLong>();
1266  disc_val = static_cast<CORBA::Long>(value);
1267  return true;
1268  }
1269  case TK_UINT64: {
1270  CORBA::ULongLong value = it->second.get<CORBA::ULongLong>();
1271  disc_val = static_cast<CORBA::Long>(value);
1272  return true;
1273  }
1274  case TK_ENUM: {
1275  DDS::TypeDescriptor_var td;
1276  if (disc_type->get_descriptor(td) != DDS::RETCODE_OK) {
1277  return false;
1278  }
1279  const CORBA::ULong bitbound = td->bound()[0];
1280  if (bitbound >= 1 && bitbound <= 8) {
1281  const ACE_OutputCDR::from_int8& value = it->second.get<ACE_OutputCDR::from_int8>();
1282  disc_val = static_cast<CORBA::Long>(value.val_);
1283  } else if (bitbound >= 9 && bitbound <= 16) {
1284  CORBA::Short value = it->second.get<CORBA::Short>();
1285  disc_val = static_cast<CORBA::Long>(value);
1286  } else {
1287  disc_val = it->second.get<CORBA::Long>();
1288  }
1289  return true;
1290  }
1291  }
1292  return false;
1293 }
ACE_CDR::Long Long
const TypeKind TK_INT8
Definition: TypeObject.h:225
const LogLevel::Value value
Definition: debug.cpp:61
const ReturnCode_t RETCODE_OK
const TypeKind TK_CHAR16
Definition: TypeObject.h:228
ACE_CDR::LongLong LongLong
ACE_CDR::Short Short
const TypeKind TK_INT32
Definition: TypeObject.h:217
const TypeKind TK_CHAR8
Definition: TypeObject.h:227
ACE_CDR::ULongLong ULongLong
const TypeKind TK_UINT16
Definition: TypeObject.h:219
ACE_CDR::ULong ULong
const TypeKind TK_INT64
Definition: TypeObject.h:218
const TypeKind TK_UINT8
Definition: TypeObject.h:226
const TypeKind TK_BOOLEAN
Definition: TypeObject.h:214
const TypeKind TK_INT16
Definition: TypeObject.h:216
ACE_CDR::UShort UShort
const TypeKind TK_ENUM
Definition: TypeObject.h:238
const TypeKind TK_UINT32
Definition: TypeObject.h:220
const TypeKind TK_BYTE
Definition: TypeObject.h:215
const TypeKind TK_UINT64
Definition: TypeObject.h:221

◆ return_loaned_value()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::return_loaned_value ( DDS::DynamicData_ptr  value)

Definition at line 647 of file DynamicDataImpl.cpp.

References ACE_ERROR, LM_ERROR, and DDS::RETCODE_UNSUPPORTED.

648 {
649  ACE_ERROR((LM_ERROR, "(%P|%t) ERROR: DynamicDataImpl::return_loaned_value: Not implemented\n"));
651 }
#define ACE_ERROR(X)
const ReturnCode_t RETCODE_UNSUPPORTED

◆ serialize_i()

bool OpenDDS::XTypes::DynamicDataImpl::serialize_i ( DCPS::Serializer ser,
DCPS::Sample::Extent  ext 
) const
private

Definition at line 8699 of file DynamicDataImpl.cpp.

References ACE_ERROR, container_, LM_NOTICE, OpenDDS::DCPS::log_level, OpenDDS::DCPS::LogLevel::Notice, OpenDDS::XTypes::DynamicDataImpl::DataContainer::serialize_array(), OpenDDS::XTypes::DynamicDataImpl::DataContainer::serialize_bitmask_value(), OpenDDS::XTypes::DynamicDataImpl::DataContainer::serialize_enum_value(), OpenDDS::XTypes::DynamicDataImpl::DataContainer::serialize_primitive_value(), OpenDDS::XTypes::DynamicDataImpl::DataContainer::serialize_sequence(), OpenDDS::XTypes::DynamicDataImpl::DataContainer::serialize_string_value(), OpenDDS::XTypes::DynamicDataImpl::DataContainer::serialize_structure(), OpenDDS::XTypes::DynamicDataImpl::DataContainer::serialize_union(), OpenDDS::XTypes::DynamicDataImpl::DataContainer::serialize_wstring_value(), OpenDDS::XTypes::TK_ARRAY, OpenDDS::XTypes::TK_BITMASK, OpenDDS::XTypes::TK_BOOLEAN, OpenDDS::XTypes::TK_BYTE, OpenDDS::XTypes::TK_CHAR16, OpenDDS::XTypes::TK_CHAR8, OpenDDS::XTypes::TK_ENUM, OpenDDS::XTypes::TK_FLOAT128, OpenDDS::XTypes::TK_FLOAT32, OpenDDS::XTypes::TK_FLOAT64, OpenDDS::XTypes::TK_INT16, OpenDDS::XTypes::TK_INT32, OpenDDS::XTypes::TK_INT64, OpenDDS::XTypes::TK_INT8, OpenDDS::XTypes::TK_MAP, OpenDDS::XTypes::TK_SEQUENCE, OpenDDS::XTypes::TK_STRING16, OpenDDS::XTypes::TK_STRING8, OpenDDS::XTypes::TK_STRUCTURE, OpenDDS::XTypes::TK_UINT16, OpenDDS::XTypes::TK_UINT32, OpenDDS::XTypes::TK_UINT64, OpenDDS::XTypes::TK_UINT8, OpenDDS::XTypes::TK_UNION, and OpenDDS::XTypes::DynamicDataBase::type_.

Referenced by OpenDDS::DCPS::operator<<(), OpenDDS::XTypes::DynamicDataImpl::DataContainer::serialize_complex_aggregated_member_xcdr2(), OpenDDS::XTypes::DynamicDataImpl::DataContainer::serialize_complex_aggregated_member_xcdr2_default(), and OpenDDS::XTypes::DynamicDataImpl::DataContainer::serialize_complex_member_i().

8700 {
8701  const TypeKind tk = type_->get_kind();
8702  switch (tk) {
8703  case TK_INT32:
8705  case TK_UINT32:
8707  case TK_INT8:
8709  case TK_UINT8:
8710  return container_.serialize_primitive_value(ser, ACE_OutputCDR::from_uint8(CORBA::UInt8()));
8711  case TK_INT16:
8713  case TK_UINT16:
8715  case TK_INT64:
8717  case TK_UINT64:
8719  case TK_FLOAT32:
8721  case TK_FLOAT64:
8723  case TK_FLOAT128:
8725  case TK_CHAR8:
8727 #ifdef DDS_HAS_WCHAR
8728  case TK_CHAR16:
8730 #endif
8731  case TK_BYTE:
8733  case TK_BOOLEAN:
8735  case TK_ENUM:
8736  return container_.serialize_enum_value(ser);
8737  case TK_BITMASK:
8738  return container_.serialize_bitmask_value(ser);
8739  case TK_STRING8:
8740  return container_.serialize_string_value(ser);
8741 #ifdef DDS_HAS_WCHAR
8742  case TK_STRING16:
8743  return container_.serialize_wstring_value(ser);
8744 #endif
8745  case TK_STRUCTURE:
8746  return container_.serialize_structure(ser, ext);
8747  case TK_UNION:
8748  return container_.serialize_union(ser, ext);
8749  case TK_SEQUENCE:
8750  return container_.serialize_sequence(ser, ext);
8751  case TK_ARRAY:
8752  return container_.serialize_array(ser, ext);
8753  case TK_MAP:
8755  ACE_ERROR((LM_NOTICE, "(%P|%t) NOTICE: DynamicDataImpl::serialize_i: Serialization of map types is not supported\n"));
8756  }
8757  }
8758  return false;
8759 }
OpenDDS_Dcps_Export LogLevel log_level
bool serialize_union(DCPS::Serializer &ser, DCPS::Sample::Extent ext) const
ACE_CDR::Long Long
#define ACE_ERROR(X)
const TypeKind TK_INT8
Definition: TypeObject.h:225
DDS::DynamicType_var type_
The actual (i.e., non-alias) DynamicType of the associated type.
const TypeKind TK_FLOAT128
Definition: TypeObject.h:224
const TypeKind TK_CHAR16
Definition: TypeObject.h:228
ACE_CDR::LongLong LongLong
ACE_CDR::Short Short
const TypeKind TK_INT32
Definition: TypeObject.h:217
const TypeKind TK_CHAR8
Definition: TypeObject.h:227
const TypeKind TK_STRING16
Definition: TypeObject.h:232
const TypeKind TK_STRUCTURE
Definition: TypeObject.h:243
ACE_CDR::ULongLong ULongLong
const TypeKind TK_UINT16
Definition: TypeObject.h:219
bool serialize_enum_value(DCPS::Serializer &ser) const
ACE_CDR::ULong ULong
const TypeKind TK_INT64
Definition: TypeObject.h:218
ACE_CDR::Boolean Boolean
const TypeKind TK_BITMASK
Definition: TypeObject.h:239
const TypeKind TK_UINT8
Definition: TypeObject.h:226
const TypeKind TK_FLOAT32
Definition: TypeObject.h:222
const TypeKind TK_BOOLEAN
Definition: TypeObject.h:214
const TypeKind TK_INT16
Definition: TypeObject.h:216
ACE_CDR::UShort UShort
bool serialize_string_value(DCPS::Serializer &ser) const
const TypeKind TK_FLOAT64
Definition: TypeObject.h:223
const TypeKind TK_STRING8
Definition: TypeObject.h:231
bool serialize_structure(DCPS::Serializer &ser, DCPS::Sample::Extent) const
bool serialize_wstring_value(DCPS::Serializer &ser) const
const TypeKind TK_SEQUENCE
Definition: TypeObject.h:248
const TypeKind TK_ENUM
Definition: TypeObject.h:238
const TypeKind TK_UINT32
Definition: TypeObject.h:220
bool serialize_bitmask_value(DCPS::Serializer &ser) const
const TypeKind TK_BYTE
Definition: TypeObject.h:215
ACE_CDR::Char Char
const TypeKind TK_UNION
Definition: TypeObject.h:244
const TypeKind TK_UINT64
Definition: TypeObject.h:221
ACE_CDR::Octet Octet
bool serialize_array(DCPS::Serializer &ser, DCPS::Sample::Extent ext) const
ACE_CDR::WChar WChar
const TypeKind TK_ARRAY
Definition: TypeObject.h:249
const TypeKind TK_MAP
Definition: TypeObject.h:250
bool serialize_sequence(DCPS::Serializer &ser, DCPS::Sample::Extent ext) const
ACE_CDR::Octet TypeKind
Definition: TypeObject.h:210
bool serialize_primitive_value(DCPS::Serializer &ser, PrimitiveType default_value) const

◆ serialized_size_i()

bool OpenDDS::XTypes::DynamicDataImpl::serialized_size_i ( const DCPS::Encoding encoding,
size_t &  size,
DCPS::Sample::Extent  ext 
) const
private

Definition at line 8631 of file DynamicDataImpl.cpp.

References ACE_ERROR, container_, LM_NOTICE, OpenDDS::DCPS::log_level, OpenDDS::DCPS::LogLevel::Notice, OpenDDS::DCPS::primitive_serialized_size(), OpenDDS::DCPS::primitive_serialized_size_boolean(), OpenDDS::DCPS::primitive_serialized_size_char(), OpenDDS::DCPS::primitive_serialized_size_octet(), OpenDDS::DCPS::primitive_serialized_size_wchar(), OpenDDS::XTypes::DynamicDataImpl::DataContainer::serialized_size_array(), OpenDDS::XTypes::DynamicDataImpl::DataContainer::serialized_size_bitmask(), OpenDDS::XTypes::DynamicDataImpl::DataContainer::serialized_size_enum(), OpenDDS::XTypes::DynamicDataImpl::DataContainer::serialized_size_sequence(), OpenDDS::XTypes::DynamicDataImpl::DataContainer::serialized_size_string(), OpenDDS::XTypes::DynamicDataImpl::DataContainer::serialized_size_structure(), OpenDDS::XTypes::DynamicDataImpl::DataContainer::serialized_size_union(), OpenDDS::XTypes::DynamicDataImpl::DataContainer::serialized_size_wstring(), OpenDDS::XTypes::TK_ARRAY, OpenDDS::XTypes::TK_BITMASK, OpenDDS::XTypes::TK_BOOLEAN, OpenDDS::XTypes::TK_BYTE, OpenDDS::XTypes::TK_CHAR16, OpenDDS::XTypes::TK_CHAR8, OpenDDS::XTypes::TK_ENUM, OpenDDS::XTypes::TK_FLOAT128, OpenDDS::XTypes::TK_FLOAT32, OpenDDS::XTypes::TK_FLOAT64, OpenDDS::XTypes::TK_INT16, OpenDDS::XTypes::TK_INT32, OpenDDS::XTypes::TK_INT64, OpenDDS::XTypes::TK_INT8, OpenDDS::XTypes::TK_MAP, OpenDDS::XTypes::TK_SEQUENCE, OpenDDS::XTypes::TK_STRING16, OpenDDS::XTypes::TK_STRING8, OpenDDS::XTypes::TK_STRUCTURE, OpenDDS::XTypes::TK_UINT16, OpenDDS::XTypes::TK_UINT32, OpenDDS::XTypes::TK_UINT64, OpenDDS::XTypes::TK_UINT8, OpenDDS::XTypes::TK_UNION, and OpenDDS::XTypes::DynamicDataBase::type_.

Referenced by OpenDDS::XTypes::DynamicDataImpl::DataContainer::serialize_complex_aggregated_member_xcdr2(), OpenDDS::XTypes::DynamicDataImpl::DataContainer::serialize_complex_aggregated_member_xcdr2_default(), OpenDDS::DCPS::serialized_size(), OpenDDS::XTypes::DynamicDataImpl::DataContainer::serialized_size_complex_aggregated_member_xcdr2(), and OpenDDS::XTypes::DynamicDataImpl::DataContainer::serialized_size_complex_member_i().

8632 {
8633  const TypeKind tk = type_->get_kind();
8634  switch (tk) {
8635  case TK_INT32:
8637  case TK_UINT32:
8639  case TK_INT8:
8640  primitive_serialized_size_int8(encoding, size);
8641  return true;
8642  case TK_UINT8:
8643  primitive_serialized_size_uint8(encoding, size);
8644  return true;
8645  case TK_INT16:
8647  case TK_UINT16:
8649  case TK_INT64:
8651  case TK_UINT64:
8653  case TK_FLOAT32:
8655  case TK_FLOAT64:
8657  case TK_FLOAT128:
8659  case TK_CHAR8:
8661  return true;
8662 #ifdef DDS_HAS_WCHAR
8663  case TK_CHAR16:
8665  return true;
8666 #endif
8667  case TK_BYTE:
8669  return true;
8670  case TK_BOOLEAN:
8672  return true;
8673  case TK_ENUM:
8675  case TK_BITMASK:
8677  case TK_STRING8:
8679 #ifdef DDS_HAS_WCHAR
8680  case TK_STRING16:
8682 #endif
8683  case TK_STRUCTURE:
8684  return container_.serialized_size_structure(encoding, size, ext);
8685  case TK_UNION:
8686  return container_.serialized_size_union(encoding, size, ext);
8687  case TK_SEQUENCE:
8688  return container_.serialized_size_sequence(encoding, size, ext);
8689  case TK_ARRAY:
8690  return container_.serialized_size_array(encoding, size, ext);
8691  case TK_MAP:
8693  ACE_ERROR((LM_NOTICE, "(%P|%t) NOTICE: DynamicDataImpl::serialized_size_i: Serialization of map types is not supported\n"));
8694  }
8695  }
8696  return false;
8697 }
OpenDDS_Dcps_Export LogLevel log_level
ACE_CDR::Long Long
#define ACE_ERROR(X)
const TypeKind TK_INT8
Definition: TypeObject.h:225
DDS::DynamicType_var type_
The actual (i.e., non-alias) DynamicType of the associated type.
const TypeKind TK_FLOAT128
Definition: TypeObject.h:224
OpenDDS_Dcps_Export void primitive_serialized_size_octet(const Encoding &encoding, size_t &size, size_t count=1)
bool serialized_size_array(const DCPS::Encoding &encoding, size_t &size, DCPS::Sample::Extent ext) const
const TypeKind TK_CHAR16
Definition: TypeObject.h:228
ACE_CDR::LongLong LongLong
ACE_CDR::Short Short
const TypeKind TK_INT32
Definition: TypeObject.h:217
const TypeKind TK_CHAR8
Definition: TypeObject.h:227
const TypeKind TK_STRING16
Definition: TypeObject.h:232
const TypeKind TK_STRUCTURE
Definition: TypeObject.h:243
bool serialized_size_enum(const DCPS::Encoding &encoding, size_t &size, const DDS::DynamicType_var &enum_type) const
const DCPS::Encoding encoding(DCPS::Encoding::KIND_UNALIGNED_CDR, DCPS::ENDIAN_BIG)
ACE_CDR::ULongLong ULongLong
const TypeKind TK_UINT16
Definition: TypeObject.h:219
ACE_CDR::ULong ULong
bool serialized_size_structure(const DCPS::Encoding &encoding, size_t &size, DCPS::Sample::Extent ext) const
const TypeKind TK_INT64
Definition: TypeObject.h:218
OpenDDS_Dcps_Export void primitive_serialized_size_char(const Encoding &encoding, size_t &size, size_t count=1)
const TypeKind TK_BITMASK
Definition: TypeObject.h:239
const TypeKind TK_UINT8
Definition: TypeObject.h:226
bool serialized_size_wstring(const DCPS::Encoding &encoding, size_t &size) const
const TypeKind TK_FLOAT32
Definition: TypeObject.h:222
bool serialized_size_bitmask(const DCPS::Encoding &encoding, size_t &size, const DDS::DynamicType_var &bitmask_type) const
const TypeKind TK_BOOLEAN
Definition: TypeObject.h:214
const TypeKind TK_INT16
Definition: TypeObject.h:216
OpenDDS_Dcps_Export void primitive_serialized_size_wchar(const Encoding &encoding, size_t &size, size_t count=1)
ACE_CDR::UShort UShort
const TypeKind TK_FLOAT64
Definition: TypeObject.h:223
const TypeKind TK_STRING8
Definition: TypeObject.h:231
bool serialized_size_sequence(const DCPS::Encoding &encoding, size_t &size, DCPS::Sample::Extent ext) const
bool serialized_size_string(const DCPS::Encoding &encoding, size_t &size) const
const TypeKind TK_SEQUENCE
Definition: TypeObject.h:248
const TypeKind TK_ENUM
Definition: TypeObject.h:238
bool serialized_size_union(const DCPS::Encoding &encoding, size_t &size, DCPS::Sample::Extent ext) const
const TypeKind TK_UINT32
Definition: TypeObject.h:220
const TypeKind TK_BYTE
Definition: TypeObject.h:215
const TypeKind TK_UNION
Definition: TypeObject.h:244
const TypeKind TK_UINT64
Definition: TypeObject.h:221
const TypeKind TK_ARRAY
Definition: TypeObject.h:249
OpenDDS_Dcps_Export void primitive_serialized_size_boolean(const Encoding &encoding, size_t &size, size_t count=1)
OpenDDS_Dcps_Export bool primitive_serialized_size(const Encoding &encoding, size_t &size, const ACE_CDR::Short &value, size_t count=1)
const TypeKind TK_MAP
Definition: TypeObject.h:250
ACE_CDR::Octet TypeKind
Definition: TypeObject.h:210

◆ set_boolean_value()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::set_boolean_value ( DDS::MemberId  id,
CORBA::Boolean  value 
)

Definition at line 1868 of file DynamicDataImpl.cpp.

References ACE_ERROR, check_index_from_id(), insert_single(), LM_NOTICE, OpenDDS::DCPS::log_level, OpenDDS::XTypes::MEMBER_ID_INVALID, OpenDDS::DCPS::LogLevel::Notice, DDS::RETCODE_ERROR, DDS::RETCODE_OK, OpenDDS::XTypes::TK_ARRAY, OpenDDS::XTypes::TK_BITMASK, OpenDDS::XTypes::TK_BOOLEAN, OpenDDS::XTypes::TK_MAP, OpenDDS::XTypes::TK_SEQUENCE, OpenDDS::XTypes::TK_STRUCTURE, OpenDDS::XTypes::TK_UNION, OpenDDS::XTypes::DynamicDataBase::type_, and OpenDDS::XTypes::typekind_to_string().

Referenced by clear_value().

1869 {
1870  const TypeKind tk = type_->get_kind();
1871  bool good = true;
1872 
1873  switch (tk) {
1874  case TK_BOOLEAN:
1876  break;
1877  case TK_BITMASK: {
1878  DDS::TypeDescriptor_var descriptor;
1879  if (type_->get_descriptor(descriptor) != DDS::RETCODE_OK) {
1880  good = false;
1881  break;
1882  }
1883  const CORBA::ULong bit_bound = descriptor->bound()[0];
1884  if (!check_index_from_id(tk, id, bit_bound)) {
1885  good = false;
1886  } else {
1888  }
1889  break;
1890  }
1891  case TK_STRUCTURE:
1892  good = set_value_to_struct<TK_BOOLEAN>(id, ACE_OutputCDR::from_boolean(value));
1893  break;
1894  case TK_UNION:
1895  good = set_value_to_union<TK_BOOLEAN>(id, ACE_OutputCDR::from_boolean(value));
1896  break;
1897  case TK_SEQUENCE:
1898  case TK_ARRAY:
1899  case TK_MAP:
1900  good = set_value_to_collection<TK_BOOLEAN>(id, ACE_OutputCDR::from_boolean(value), tk);
1901  break;
1902  default:
1903  good = false;
1904  break;
1905  }
1906 
1907  if (!good && DCPS::log_level >= DCPS::LogLevel::Notice) {
1908  ACE_ERROR((LM_NOTICE, "(%P|%t) NOTICE: DynamicDataImpl::set_boolean_value:"
1909  " Failed to write boolean to DynamicData object of type %C\n",
1910  typekind_to_string(tk)));
1911  }
1912  return good ? DDS::RETCODE_OK : DDS::RETCODE_ERROR;
1913 }
OpenDDS_Dcps_Export LogLevel log_level
#define ACE_ERROR(X)
const LogLevel::Value value
Definition: debug.cpp:61
bool insert_single(DDS::MemberId id, const ACE_OutputCDR::from_int8 &value)
DDS::DynamicType_var type_
The actual (i.e., non-alias) DynamicType of the associated type.
const ReturnCode_t RETCODE_OK
const TypeKind TK_STRUCTURE
Definition: TypeObject.h:243
const ACE_CDR::ULong MEMBER_ID_INVALID
Definition: TypeObject.h:911
ACE_CDR::ULong ULong
const TypeKind TK_BITMASK
Definition: TypeObject.h:239
const ReturnCode_t RETCODE_ERROR
const TypeKind TK_BOOLEAN
Definition: TypeObject.h:214
bool check_index_from_id(TypeKind tk, DDS::MemberId id, CORBA::ULong bound) const
const TypeKind TK_SEQUENCE
Definition: TypeObject.h:248
const char * typekind_to_string(TypeKind tk)
const TypeKind TK_UNION
Definition: TypeObject.h:244
const TypeKind TK_ARRAY
Definition: TypeObject.h:249
const TypeKind TK_MAP
Definition: TypeObject.h:250
ACE_CDR::Octet TypeKind
Definition: TypeObject.h:210

◆ set_boolean_values()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::set_boolean_values ( DDS::MemberId  id,
const DDS::BooleanSeq value 
)

Definition at line 2558 of file DynamicDataImpl.cpp.

References value.

2559 {
2560  return set_sequence_values<TK_BOOLEAN>(id, value);
2561 }
const LogLevel::Value value
Definition: debug.cpp:61

◆ set_byte_value()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::set_byte_value ( DDS::MemberId  id,
CORBA::Octet  value 
)

Definition at line 1863 of file DynamicDataImpl.cpp.

1864 {
1865  return set_single_value<TK_BYTE>(id, ACE_OutputCDR::from_octet(value));
1866 }
const LogLevel::Value value
Definition: debug.cpp:61

◆ set_byte_values()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::set_byte_values ( DDS::MemberId  id,
const DDS::ByteSeq value 
)

Definition at line 2553 of file DynamicDataImpl.cpp.

References value.

2554 {
2555  return set_sequence_values<TK_BYTE>(id, value);
2556 }
const LogLevel::Value value
Definition: debug.cpp:61

◆ set_char16_value()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::set_char16_value ( DDS::MemberId  id,
CORBA::WChar  value 
)

Definition at line 1854 of file DynamicDataImpl.cpp.

References DDS::RETCODE_UNSUPPORTED.

1855 {
1856 #ifdef DDS_HAS_WCHAR
1857  return set_char_common<TK_CHAR16, TK_STRING16>(id, ACE_OutputCDR::from_wchar(value));
1858 #else
1859  return DDS::RETCODE_UNSUPPORTED;
1860 #endif
1861 }
const LogLevel::Value value
Definition: debug.cpp:61
const ReturnCode_t RETCODE_UNSUPPORTED

◆ set_char16_values()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::set_char16_values ( DDS::MemberId  id,
const DDS::WcharSeq value 
)

Definition at line 2544 of file DynamicDataImpl.cpp.

References DDS::RETCODE_UNSUPPORTED, and value.

2545 {
2546 #ifdef DDS_HAS_WCHAR
2547  return set_sequence_values<TK_CHAR16>(id, value);
2548 #else
2549  return DDS::RETCODE_UNSUPPORTED;
2550 #endif
2551 }
const LogLevel::Value value
Definition: debug.cpp:61
const ReturnCode_t RETCODE_UNSUPPORTED

◆ set_char8_value()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::set_char8_value ( DDS::MemberId  id,
CORBA::Char  value 
)

Definition at line 1849 of file DynamicDataImpl.cpp.

1850 {
1851  return set_char_common<TK_CHAR8, TK_STRING8>(id, ACE_OutputCDR::from_char(value));
1852 }
const LogLevel::Value value
Definition: debug.cpp:61

◆ set_char8_values()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::set_char8_values ( DDS::MemberId  id,
const DDS::CharSeq value 
)

Definition at line 2539 of file DynamicDataImpl.cpp.

References value.

2540 {
2541  return set_sequence_values<TK_CHAR8>(id, value);
2542 }
const LogLevel::Value value
Definition: debug.cpp:61

◆ set_char_common()

template<TypeKind CharKind, TypeKind StringKind, typename FromCharT >
DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::set_char_common ( DDS::MemberId  id,
const FromCharT &  value 
)
private

Definition at line 1803 of file DynamicDataImpl.cpp.

References ACE_ERROR, check_index_from_id(), insert_single(), LM_NOTICE, OpenDDS::DCPS::log_level, OpenDDS::XTypes::MEMBER_ID_INVALID, OpenDDS::DCPS::LogLevel::Notice, DDS::RETCODE_ERROR, DDS::RETCODE_OK, OpenDDS::XTypes::TK_ARRAY, OpenDDS::XTypes::TK_MAP, OpenDDS::XTypes::TK_SEQUENCE, OpenDDS::XTypes::TK_STRUCTURE, OpenDDS::XTypes::TK_UNION, OpenDDS::XTypes::DynamicDataBase::type_, OpenDDS::XTypes::typekind_to_string(), and value.

1804 {
1805  const TypeKind tk = type_->get_kind();
1806  bool good = true;
1807 
1808  switch (tk) {
1809  case CharKind:
1810  good = id == MEMBER_ID_INVALID && insert_single(id, value);
1811  break;
1812  case StringKind: {
1813  DDS::TypeDescriptor_var descriptor;
1814  if (type_->get_descriptor(descriptor) != DDS::RETCODE_OK) {
1815  good = false;
1816  break;
1817  }
1818  const CORBA::ULong bound = descriptor->bound()[0];
1819  if (!check_index_from_id(tk, id, bound)) {
1820  good = false;
1821  } else {
1822  good = insert_single(id, value);
1823  }
1824  break;
1825  }
1826  case TK_STRUCTURE:
1827  good = set_value_to_struct<CharKind>(id, value);
1828  break;
1829  case TK_UNION:
1830  good = set_value_to_union<CharKind>(id, value);
1831  break;
1832  case TK_SEQUENCE:
1833  case TK_ARRAY:
1834  case TK_MAP:
1835  good = set_value_to_collection<CharKind>(id, value, tk);
1836  break;
1837  default:
1838  good = false;
1839  break;
1840  }
1841 
1842  if (!good && DCPS::log_level >= DCPS::LogLevel::Notice) {
1843  ACE_ERROR((LM_NOTICE, "(%P|%t) NOTICE: DynamicDataImpl::set_char_common:"
1844  " Failed to write DynamicData object of type %C\n", typekind_to_string(tk)));
1845  }
1846  return good ? DDS::RETCODE_OK : DDS::RETCODE_ERROR;
1847 }
OpenDDS_Dcps_Export LogLevel log_level
#define ACE_ERROR(X)
const LogLevel::Value value
Definition: debug.cpp:61
bool insert_single(DDS::MemberId id, const ACE_OutputCDR::from_int8 &value)
DDS::DynamicType_var type_
The actual (i.e., non-alias) DynamicType of the associated type.
const ReturnCode_t RETCODE_OK
const TypeKind TK_STRUCTURE
Definition: TypeObject.h:243
const ACE_CDR::ULong MEMBER_ID_INVALID
Definition: TypeObject.h:911
ACE_CDR::ULong ULong
const ReturnCode_t RETCODE_ERROR
bool check_index_from_id(TypeKind tk, DDS::MemberId id, CORBA::ULong bound) const
const TypeKind TK_SEQUENCE
Definition: TypeObject.h:248
const char * typekind_to_string(TypeKind tk)
const TypeKind TK_UNION
Definition: TypeObject.h:244
const TypeKind TK_ARRAY
Definition: TypeObject.h:249
const TypeKind TK_MAP
Definition: TypeObject.h:250
ACE_CDR::Octet TypeKind
Definition: TypeObject.h:210

◆ set_complex_to_collection()

bool OpenDDS::XTypes::DynamicDataImpl::set_complex_to_collection ( DDS::MemberId  id,
DDS::DynamicData_var  value,
TypeKind  tk 
)
private

Definition at line 2220 of file DynamicDataImpl.cpp.

References OpenDDS::XTypes::get_base_type(), insert_complex(), DDS::RETCODE_OK, OpenDDS::XTypes::DynamicDataBase::type_, and validate_member_id_collection().

Referenced by set_complex_value().

2222 {
2223  DDS::TypeDescriptor_var descriptor;
2224  if (type_->get_descriptor(descriptor) != DDS::RETCODE_OK) {
2225  return false;
2226  }
2227 
2228  const DDS::DynamicType_var elem_type = get_base_type(descriptor->element_type());
2229  const DDS::DynamicType_var value_type = value->type();
2230  if (!elem_type->equals(value_type)) {
2231  return false;
2232  }
2233 
2234  return validate_member_id_collection(descriptor, id, collection_tk) && insert_complex(id, value);
2235 }
const LogLevel::Value value
Definition: debug.cpp:61
DDS::DynamicType_var type_
The actual (i.e., non-alias) DynamicType of the associated type.
const ReturnCode_t RETCODE_OK
DDS::DynamicType_var get_base_type(DDS::DynamicType_ptr type)
bool validate_member_id_collection(const DDS::TypeDescriptor_var &descriptor, DDS::MemberId id, TypeKind collection_tk) const
bool insert_complex(DDS::MemberId id, const DDS::DynamicData_var &value)

◆ set_complex_to_struct()

bool OpenDDS::XTypes::DynamicDataImpl::set_complex_to_struct ( DDS::MemberId  id,
DDS::DynamicData_var  value 
)
private

Definition at line 2108 of file DynamicDataImpl.cpp.

References OpenDDS::XTypes::get_base_type(), insert_complex(), DDS::RETCODE_OK, and OpenDDS::XTypes::DynamicDataBase::type_.

Referenced by set_complex_value().

2109 {
2110  DDS::DynamicTypeMember_var member;
2111  if (type_->get_member(member, id) != DDS::RETCODE_OK) {
2112  return false;
2113  }
2114  DDS::MemberDescriptor_var md;
2115  if (member->get_descriptor(md) != DDS::RETCODE_OK) {
2116  return false;
2117  }
2118 
2119  const DDS::DynamicType_var member_type = get_base_type(md->type());
2120  const DDS::DynamicType_var value_type = value->type();
2121  if (!member_type || !value_type || !member_type->equals(value_type)) {
2122  return false;
2123  }
2124  return insert_complex(id, value);
2125 }
const LogLevel::Value value
Definition: debug.cpp:61
DDS::DynamicType_var type_
The actual (i.e., non-alias) DynamicType of the associated type.
const ReturnCode_t RETCODE_OK
DDS::DynamicType_var get_base_type(DDS::DynamicType_ptr type)
bool insert_complex(DDS::MemberId id, const DDS::DynamicData_var &value)

◆ set_complex_to_union()

bool OpenDDS::XTypes::DynamicDataImpl::set_complex_to_union ( DDS::MemberId  id,
DDS::DynamicData_var  value,
const DDS::TypeDescriptor_var &  descriptor 
)
private

Definition at line 2127 of file DynamicDataImpl.cpp.

References ACE_ERROR, clear_container(), OpenDDS::XTypes::DISCRIMINATOR_ID, OpenDDS::XTypes::DynamicDataBase::discriminator_selects_no_member(), equals(), find_selected_member(), OpenDDS::XTypes::get_base_type(), insert_complex(), insert_valid_discriminator(), LM_NOTICE, OpenDDS::DCPS::log_level, OpenDDS::XTypes::MEMBER_ID_INVALID, OpenDDS::DCPS::LogLevel::Notice, read_discriminator(), DDS::RETCODE_OK, OpenDDS::XTypes::DynamicDataBase::type_, and validate_discriminator().

Referenced by set_complex_value().

2129 {
2130  if (id == DISCRIMINATOR_ID) {
2131  DDS::DynamicType_var disc_type = get_base_type(descriptor->discriminator_type());
2132  const DDS::DynamicType_var value_type = value->type();
2133  if (!disc_type->equals(value_type)) {
2134  return false;
2135  }
2136 
2137  CORBA::Long disc_val;
2138  const DynamicDataImpl* dd_impl = dynamic_cast<const DynamicDataImpl*>(value.in());
2139  if (!dd_impl || !dd_impl->read_discriminator(disc_val)) {
2140  return false;
2141  }
2142 
2143  const DDS::MemberId selected_id = find_selected_member();
2144  if (selected_id != MEMBER_ID_INVALID) {
2145  DDS::DynamicTypeMember_var selected_member;
2146  if (type_->get_member(selected_member, selected_id) != DDS::RETCODE_OK) {
2147  return false;
2148  }
2149  DDS::MemberDescriptor_var selected_md;
2150  if (selected_member->get_descriptor(selected_md) != DDS::RETCODE_OK) {
2151  return false;
2152  }
2153  if (!validate_discriminator(disc_val, selected_md)) {
2155  ACE_ERROR((LM_NOTICE, "(%P|%t) NOTICE: DynamicDataImpl::set_complex_to_union:"
2156  " Discriminator value %d does not select the activated member (ID %u)\n",
2157  disc_val, selected_id));
2158  }
2159  return false;
2160  }
2161  return insert_complex(id, value);
2162  } else {
2163  if (discriminator_selects_no_member(type_, disc_val)) {
2164  return insert_complex(id, value);
2165  }
2167  ACE_ERROR((LM_NOTICE, "(%P|%t) NOTICE: DynamicDataImpl::set_complex_to_union:"
2168  " Can't directly set a discriminator that selects a member."
2169  " Activate the member first!\n"));
2170  }
2171  return false;
2172  }
2173  }
2174 
2175  // Activate a member
2176  clear_container();
2177 
2178  DDS::DynamicTypeMember_var member;
2179  if (type_->get_member(member, id) != DDS::RETCODE_OK) {
2180  return false;
2181  }
2182  DDS::MemberDescriptor_var md;
2183  if (member->get_descriptor(md) != DDS::RETCODE_OK) {
2184  return false;
2185  }
2186  const DDS::DynamicType_var value_type = value->type();
2187  if (get_base_type(md->type())->equals(value_type)) {
2188  return false;
2189  }
2190 
2191  return insert_valid_discriminator(md) && insert_complex(id, value);
2192 }
OpenDDS_Dcps_Export LogLevel log_level
ACE_CDR::Long Long
#define ACE_ERROR(X)
ACE_CDR::ULong MemberId
Definition: TypeObject.h:910
const LogLevel::Value value
Definition: debug.cpp:61
DDS::DynamicType_var type_
The actual (i.e., non-alias) DynamicType of the associated type.
const ReturnCode_t RETCODE_OK
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.
Definition: TypeObject.h:913
bool validate_discriminator(CORBA::Long disc_val, const DDS::MemberDescriptor_var &md) const
const ACE_CDR::ULong MEMBER_ID_INVALID
Definition: TypeObject.h:911
DynamicDataImpl(DDS::DynamicType_ptr type)
DDS::MemberId find_selected_member() const
bool insert_valid_discriminator(DDS::MemberDescriptor *memberSelected)
CORBA::Boolean equals(DDS::DynamicData_ptr other)
static bool discriminator_selects_no_member(DDS::DynamicType *type, ACE_CDR::Long disc)
bool insert_complex(DDS::MemberId id, const DDS::DynamicData_var &value)

◆ set_complex_value()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::set_complex_value ( DDS::MemberId  id,
DDS::DynamicData_ptr  value 
)

Definition at line 2237 of file DynamicDataImpl.cpp.

References ACE_ERROR, LM_NOTICE, OpenDDS::DCPS::log_level, OpenDDS::DCPS::LogLevel::Notice, DDS::RETCODE_ERROR, DDS::RETCODE_OK, set_complex_to_collection(), set_complex_to_struct(), set_complex_to_union(), OpenDDS::XTypes::TK_ARRAY, OpenDDS::XTypes::TK_MAP, OpenDDS::XTypes::TK_SEQUENCE, OpenDDS::XTypes::TK_STRUCTURE, OpenDDS::XTypes::TK_UNION, and OpenDDS::XTypes::DynamicDataBase::type_.

2238 {
2239  DDS::TypeDescriptor_var descriptor;
2240  if (type_->get_descriptor(descriptor) != DDS::RETCODE_OK) {
2241  return DDS::RETCODE_ERROR;
2242  }
2243 
2244  DDS::DynamicData_var value_var = DDS::DynamicData::_duplicate(value);
2245  const TypeKind tk = type_->get_kind();
2246  bool good = false;
2247 
2248  switch (tk) {
2249  case TK_STRUCTURE:
2250  good = set_complex_to_struct(id, value_var);
2251  break;
2252  case TK_UNION:
2253  good = set_complex_to_union(id, value_var, descriptor);
2254  break;
2255  case TK_SEQUENCE:
2256  case TK_ARRAY:
2257  case TK_MAP:
2258  good = set_complex_to_collection(id, value_var, tk);
2259  break;
2260  default:
2261  good = false;
2262  break;
2263  }
2264 
2265  if (!good && DCPS::log_level >= DCPS::LogLevel::Notice) {
2266  ACE_ERROR((LM_NOTICE, "(%P|%t) NOTICE: DynamicDataImpl::set_complex_value:"
2267  " Failed to write complex value for member with ID %d\n", id));
2268  }
2269  return good ? DDS::RETCODE_OK : DDS::RETCODE_ERROR;
2270 }
OpenDDS_Dcps_Export LogLevel log_level
#define ACE_ERROR(X)
const LogLevel::Value value
Definition: debug.cpp:61
DDS::DynamicType_var type_
The actual (i.e., non-alias) DynamicType of the associated type.
const ReturnCode_t RETCODE_OK
const TypeKind TK_STRUCTURE
Definition: TypeObject.h:243
bool set_complex_to_struct(DDS::MemberId id, DDS::DynamicData_var value)
const ReturnCode_t RETCODE_ERROR
const TypeKind TK_SEQUENCE
Definition: TypeObject.h:248
const TypeKind TK_UNION
Definition: TypeObject.h:244
const TypeKind TK_ARRAY
Definition: TypeObject.h:249
const TypeKind TK_MAP
Definition: TypeObject.h:250
bool set_complex_to_collection(DDS::MemberId id, DDS::DynamicData_var value, TypeKind tk)
bool set_complex_to_union(DDS::MemberId id, DDS::DynamicData_var value, const DDS::TypeDescriptor_var &descriptor)
ACE_CDR::Octet TypeKind
Definition: TypeObject.h:210

◆ set_descriptor()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::set_descriptor ( MemberId  id,
DDS::MemberDescriptor value 
)

Definition at line 46 of file DynamicDataImpl.cpp.

References DDS::RETCODE_UNSUPPORTED.

47 {
49 }
const ReturnCode_t RETCODE_UNSUPPORTED

◆ set_float128_value()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::set_float128_value ( DDS::MemberId  id,
CORBA::LongDouble  value 
)

Definition at line 1797 of file DynamicDataImpl.cpp.

References value.

1798 {
1799  return set_single_value<TK_FLOAT128>(id, value);
1800 }
const LogLevel::Value value
Definition: debug.cpp:61

◆ set_float128_values()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::set_float128_values ( DDS::MemberId  id,
const DDS::Float128Seq value 
)

Definition at line 2534 of file DynamicDataImpl.cpp.

References value.

2535 {
2536  return set_sequence_values<TK_FLOAT128>(id, value);
2537 }
const LogLevel::Value value
Definition: debug.cpp:61

◆ set_float32_value()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::set_float32_value ( DDS::MemberId  id,
CORBA::Float  value 
)

Definition at line 1787 of file DynamicDataImpl.cpp.

References value.

1788 {
1789  return set_single_value<TK_FLOAT32>(id, value);
1790 }
const LogLevel::Value value
Definition: debug.cpp:61

◆ set_float32_values()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::set_float32_values ( DDS::MemberId  id,
const DDS::Float32Seq value 
)

Definition at line 2524 of file DynamicDataImpl.cpp.

References value.

2525 {
2526  return set_sequence_values<TK_FLOAT32>(id, value);
2527 }
const LogLevel::Value value
Definition: debug.cpp:61

◆ set_float64_value()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::set_float64_value ( DDS::MemberId  id,
CORBA::Double  value 
)

Definition at line 1792 of file DynamicDataImpl.cpp.

References value.

1793 {
1794  return set_single_value<TK_FLOAT64>(id, value);
1795 }
const LogLevel::Value value
Definition: debug.cpp:61

◆ set_float64_values()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::set_float64_values ( DDS::MemberId  id,
const DDS::Float64Seq value 
)

Definition at line 2529 of file DynamicDataImpl.cpp.

References value.

2530 {
2531  return set_sequence_values<TK_FLOAT64>(id, value);
2532 }
const LogLevel::Value value
Definition: debug.cpp:61

◆ set_int16_value()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::set_int16_value ( DDS::MemberId  id,
CORBA::Short  value 
)

Definition at line 1767 of file DynamicDataImpl.cpp.

References OpenDDS::XTypes::TK_ENUM, and value.

1768 {
1769  return set_single_value<TK_INT16>(id, value, TK_ENUM, 9, 16);
1770 }
const LogLevel::Value value
Definition: debug.cpp:61
const TypeKind TK_ENUM
Definition: TypeObject.h:238

◆ set_int16_values()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::set_int16_values ( DDS::MemberId  id,
const DDS::Int16Seq value 
)

Definition at line 2504 of file DynamicDataImpl.cpp.

References OpenDDS::XTypes::TK_ENUM, and value.

2505 {
2506  return set_sequence_values<TK_INT16>(id, value, TK_ENUM, 9, 16);
2507 }
const LogLevel::Value value
Definition: debug.cpp:61
const TypeKind TK_ENUM
Definition: TypeObject.h:238

◆ set_int32_value()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::set_int32_value ( DDS::MemberId  id,
CORBA::Long  value 
)

Definition at line 1747 of file DynamicDataImpl.cpp.

References OpenDDS::XTypes::TK_ENUM, and value.

1748 {
1749  return set_single_value<TK_INT32>(id, value, TK_ENUM, 17, 32);
1750 }
const LogLevel::Value value
Definition: debug.cpp:61
const TypeKind TK_ENUM
Definition: TypeObject.h:238

◆ set_int32_values()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::set_int32_values ( DDS::MemberId  id,
const DDS::Int32Seq value 
)

Definition at line 2484 of file DynamicDataImpl.cpp.

References OpenDDS::XTypes::TK_ENUM, and value.

2485 {
2486  return set_sequence_values<TK_INT32>(id, value, TK_ENUM, 17, 32);
2487 }
const LogLevel::Value value
Definition: debug.cpp:61
const TypeKind TK_ENUM
Definition: TypeObject.h:238

◆ set_int64_value()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::set_int64_value ( DDS::MemberId  id,
CORBA::LongLong  value 
)

Definition at line 1777 of file DynamicDataImpl.cpp.

References value.

1778 {
1779  return set_single_value<TK_INT64>(id, value);
1780 }
const LogLevel::Value value
Definition: debug.cpp:61

◆ set_int64_values()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::set_int64_values ( DDS::MemberId  id,
const DDS::Int64Seq value 
)

Definition at line 2514 of file DynamicDataImpl.cpp.

References value.

2515 {
2516  return set_sequence_values<TK_INT64>(id, value);
2517 }
const LogLevel::Value value
Definition: debug.cpp:61

◆ set_int8_value()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::set_int8_value ( DDS::MemberId  id,
CORBA::Int8  value 
)

Definition at line 1757 of file DynamicDataImpl.cpp.

References OpenDDS::XTypes::TK_ENUM.

1758 {
1759  return set_single_value<TK_INT8>(id, ACE_OutputCDR::from_int8(value), TK_ENUM, 1, 8);
1760 }
const LogLevel::Value value
Definition: debug.cpp:61
const TypeKind TK_ENUM
Definition: TypeObject.h:238

◆ set_int8_values()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::set_int8_values ( DDS::MemberId  id,
const DDS::Int8Seq value 
)

Definition at line 2494 of file DynamicDataImpl.cpp.

References OpenDDS::XTypes::TK_ENUM, and value.

2495 {
2496  return set_sequence_values<TK_INT8>(id, value, TK_ENUM, 1, 8);
2497 }
const LogLevel::Value value
Definition: debug.cpp:61
const TypeKind TK_ENUM
Definition: TypeObject.h:238

◆ set_sequence_values()

template<TypeKind ElementTypeKind, typename SequenceType >
DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::set_sequence_values ( DDS::MemberId  id,
const SequenceType &  value,
TypeKind  enum_or_bitmask = TK_NONE,
LBound  lower = 0,
LBound  upper = 0 
)
private

Definition at line 2438 of file DynamicDataImpl.cpp.

References ACE_ERROR, OpenDDS::XTypes::DynamicDataBase::is_type_supported(), LM_NOTICE, OpenDDS::DCPS::log_level, OpenDDS::DCPS::LogLevel::Notice, DDS::RETCODE_ERROR, DDS::RETCODE_OK, OpenDDS::XTypes::TK_ARRAY, OpenDDS::XTypes::TK_MAP, OpenDDS::XTypes::TK_SEQUENCE, OpenDDS::XTypes::TK_STRUCTURE, OpenDDS::XTypes::TK_UNION, OpenDDS::XTypes::DynamicDataBase::type_, OpenDDS::XTypes::typekind_to_string(), and value.

2441 {
2442  if (!is_type_supported(ElementTypeKind, "set_sequence_values")) {
2443  return DDS::RETCODE_ERROR;
2444  }
2445 
2446  const TypeKind tk = type_->get_kind();
2447  bool good = true;
2448 
2449  switch (tk) {
2450  case TK_STRUCTURE:
2451  good = set_values_to_struct<ElementTypeKind>(id, value, enum_or_bitmask, lower, upper);
2452  break;
2453  case TK_UNION:
2454  good = set_values_to_union<ElementTypeKind>(id, value, enum_or_bitmask, lower, upper);
2455  break;
2456  case TK_SEQUENCE:
2457  good = set_values_to_sequence<ElementTypeKind>(id, value, enum_or_bitmask, lower, upper);
2458  break;
2459  case TK_ARRAY:
2460  good = set_values_to_array<ElementTypeKind>(id, value, enum_or_bitmask, lower, upper);
2461  break;
2462  case TK_MAP:
2464  ACE_ERROR((LM_NOTICE, "(%P|%t) NOTICE: DynamicDataImpl::set_sequence_values:"
2465  " Map is currently not supported\n"));
2466  }
2467  return DDS::RETCODE_ERROR;
2468  default:
2470  ACE_ERROR((LM_NOTICE, "(%P|%t) NOTICE: DynamicDataImpl::set_sequence_values:"
2471  " Write to unsupported type (%C)\n", typekind_to_string(tk)));
2472  }
2473  return DDS::RETCODE_ERROR;
2474  }
2475 
2476  if (!good && DCPS::log_level >= DCPS::LogLevel::Notice) {
2477  ACE_ERROR((LM_NOTICE, "(%P|%t) NOTICE: DynamicDataImpl::set_sequence_values:"
2478  " Failed to write sequence of %C to member with ID %d\n",
2479  typekind_to_string(ElementTypeKind), id));
2480  }
2481  return good ? DDS::RETCODE_OK : DDS::RETCODE_ERROR;
2482 }
OpenDDS_Dcps_Export LogLevel log_level
#define ACE_ERROR(X)
const LogLevel::Value value
Definition: debug.cpp:61
DDS::DynamicType_var type_
The actual (i.e., non-alias) DynamicType of the associated type.
const ReturnCode_t RETCODE_OK
const TypeKind TK_STRUCTURE
Definition: TypeObject.h:243
const ReturnCode_t RETCODE_ERROR
const TypeKind TK_SEQUENCE
Definition: TypeObject.h:248
const char * typekind_to_string(TypeKind tk)
const TypeKind TK_UNION
Definition: TypeObject.h:244
const TypeKind TK_ARRAY
Definition: TypeObject.h:249
const TypeKind TK_MAP
Definition: TypeObject.h:250
ACE_CDR::Octet TypeKind
Definition: TypeObject.h:210
bool is_type_supported(TypeKind tk, const char *func_name)

◆ set_single_value()

template<TypeKind ValueTypeKind, typename ValueType >
DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::set_single_value ( DDS::MemberId  id,
const ValueType &  value,
TypeKind  enum_or_bitmask = TK_NONE,
LBound  lower = 0,
LBound  upper = 0 
)
private

Definition at line 1693 of file DynamicDataImpl.cpp.

References ACE_ERROR, insert_single(), OpenDDS::XTypes::DynamicDataBase::is_primitive(), OpenDDS::XTypes::DynamicDataBase::is_type_supported(), LM_NOTICE, OpenDDS::DCPS::log_level, OpenDDS::XTypes::MEMBER_ID_INVALID, OpenDDS::DCPS::LogLevel::Notice, DDS::RETCODE_ERROR, DDS::RETCODE_OK, OpenDDS::XTypes::TK_ARRAY, OpenDDS::XTypes::TK_MAP, OpenDDS::XTypes::TK_SEQUENCE, OpenDDS::XTypes::TK_STRUCTURE, OpenDDS::XTypes::TK_UNION, OpenDDS::XTypes::DynamicDataBase::type_, OpenDDS::XTypes::typekind_to_string(), and value.

1695 {
1696  if (!is_type_supported(ValueTypeKind, "set_single_value")) {
1697  return DDS::RETCODE_ERROR;
1698  }
1699 
1700  const TypeKind tk = type_->get_kind();
1701  bool good = true;
1702 
1703  // TODO: Bitmask can be stored as a whole as a unsigned integer using MEMBER_ID_INVALID
1704  // (this is an extension to the XTypes spec). Elements of the bitmask can also be set
1705  // using the set_boolean_value interface. The two copies of the bitmask value must be
1706  // made consistent. For example, when a bit in the bitmask is updated, either update
1707  // the unsigned integer representation or invalidate it. Similarly, when the unsigned
1708  // integer value is updated, either update the stored elements or invalidate them all.
1709  if (tk == enum_or_bitmask) {
1710  DDS::TypeDescriptor_var descriptor;
1711  if (type_->get_descriptor(descriptor) != DDS::RETCODE_OK) {
1712  return DDS::RETCODE_ERROR;
1713  }
1714  const CORBA::ULong bit_bound = descriptor->bound()[0];
1715  good = id == MEMBER_ID_INVALID && bit_bound >= lower && bit_bound <= upper &&
1716  insert_single(id, value);
1717  } else {
1718  switch (tk) {
1719  case ValueTypeKind:
1720  good = is_primitive(tk) && id == MEMBER_ID_INVALID && insert_single(id, value);
1721  break;
1722  case TK_STRUCTURE:
1723  good = set_value_to_struct<ValueTypeKind>(id, value);
1724  break;
1725  case TK_UNION:
1726  good = set_value_to_union<ValueTypeKind>(id, value, enum_or_bitmask, lower, upper);
1727  break;
1728  case TK_SEQUENCE:
1729  case TK_ARRAY:
1730  case TK_MAP:
1731  good = set_value_to_collection<ValueTypeKind>(id, value, tk, enum_or_bitmask, lower, upper);
1732  break;
1733  default:
1734  good = false;
1735  break;
1736  }
1737  }
1738 
1739  if (!good && DCPS::log_level >= DCPS::LogLevel::Notice) {
1740  ACE_ERROR((LM_NOTICE, "(%P|%t) NOTICE: DynamicDataImpl::set_single_value: "
1741  "Failed to write a value of %C to DynamicData object of type %C\n",
1742  typekind_to_string(ValueTypeKind), typekind_to_string(tk)));
1743  }
1744  return good ? DDS::RETCODE_OK : DDS::RETCODE_ERROR;
1745 }
OpenDDS_Dcps_Export LogLevel log_level
#define ACE_ERROR(X)
const LogLevel::Value value
Definition: debug.cpp:61
bool insert_single(DDS::MemberId id, const ACE_OutputCDR::from_int8 &value)
DDS::DynamicType_var type_
The actual (i.e., non-alias) DynamicType of the associated type.
const ReturnCode_t RETCODE_OK
const TypeKind TK_STRUCTURE
Definition: TypeObject.h:243
const ACE_CDR::ULong MEMBER_ID_INVALID
Definition: TypeObject.h:911
ACE_CDR::ULong ULong
const ReturnCode_t RETCODE_ERROR
const TypeKind TK_SEQUENCE
Definition: TypeObject.h:248
bool is_primitive(TypeKind tk) const
const char * typekind_to_string(TypeKind tk)
const TypeKind TK_UNION
Definition: TypeObject.h:244
const TypeKind TK_ARRAY
Definition: TypeObject.h:249
const TypeKind TK_MAP
Definition: TypeObject.h:250
ACE_CDR::Octet TypeKind
Definition: TypeObject.h:210
bool is_type_supported(TypeKind tk, const char *func_name)

◆ set_string_value()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::set_string_value ( DDS::MemberId  id,
const char *  value 
)

Definition at line 1915 of file DynamicDataImpl.cpp.

References OpenDDS::XTypes::get_enumerator_value(), OpenDDS::XTypes::get_member_type(), DDS::RETCODE_OK, OpenDDS::XTypes::set_enum_value(), OpenDDS::XTypes::TK_ENUM, OpenDDS::XTypes::DynamicDataBase::type_, and value.

1916 {
1917  DDS::DynamicType_var mtype;
1918  DDS::ReturnCode_t rc = get_member_type(mtype, type_, id);
1919  if (rc != DDS::RETCODE_OK) {
1920  return rc;
1921  }
1922  if (mtype->get_kind() == TK_ENUM) {
1923  DDS::Int32 intValue;
1924  rc = get_enumerator_value(intValue, value, mtype);
1925  if (rc != DDS::RETCODE_OK) {
1926  return rc;
1927  }
1928  return set_enum_value(mtype, this, id, intValue);
1929  }
1930  return set_single_value<TK_STRING8>(id, value);
1931 }
const LogLevel::Value value
Definition: debug.cpp:61
DDS::ReturnCode_t get_enumerator_value(DDS::Int32 &value, const char *name, DDS::DynamicType_ptr type)
DDS::DynamicType_var type_
The actual (i.e., non-alias) DynamicType of the associated type.
DDS::ReturnCode_t get_member_type(DDS::DynamicType_var &member_type, DDS::DynamicType_ptr container_type, DDS::MemberId id)
const ReturnCode_t RETCODE_OK
DDS::ReturnCode_t set_enum_value(DDS::DynamicType_ptr type, DDS::DynamicData_ptr src, DDS::MemberId id, CORBA::Int32 value)
const TypeKind TK_ENUM
Definition: TypeObject.h:238

◆ set_string_values()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::set_string_values ( DDS::MemberId  id,
const DDS::StringSeq value 
)

Definition at line 2563 of file DynamicDataImpl.cpp.

References value.

2564 {
2565  return set_sequence_values<TK_STRING8>(id, value);
2566 }
const LogLevel::Value value
Definition: debug.cpp:61

◆ set_uint16_value()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::set_uint16_value ( DDS::MemberId  id,
CORBA::UShort  value 
)

Definition at line 1772 of file DynamicDataImpl.cpp.

References OpenDDS::XTypes::TK_BITMASK, and value.

1773 {
1774  return set_single_value<TK_UINT16>(id, value, TK_BITMASK, 9, 16);
1775 }
const LogLevel::Value value
Definition: debug.cpp:61
const TypeKind TK_BITMASK
Definition: TypeObject.h:239

◆ set_uint16_values()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::set_uint16_values ( DDS::MemberId  id,
const DDS::UInt16Seq value 
)

Definition at line 2509 of file DynamicDataImpl.cpp.

References OpenDDS::XTypes::TK_BITMASK, and value.

2510 {
2511  return set_sequence_values<TK_UINT16>(id, value, TK_BITMASK, 9, 16);
2512 }
const LogLevel::Value value
Definition: debug.cpp:61
const TypeKind TK_BITMASK
Definition: TypeObject.h:239

◆ set_uint32_value()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::set_uint32_value ( DDS::MemberId  id,
CORBA::ULong  value 
)

Definition at line 1752 of file DynamicDataImpl.cpp.

References OpenDDS::XTypes::TK_BITMASK, and value.

1753 {
1754  return set_single_value<TK_UINT32>(id, value, TK_BITMASK, 17, 32);
1755 }
const LogLevel::Value value
Definition: debug.cpp:61
const TypeKind TK_BITMASK
Definition: TypeObject.h:239

◆ set_uint32_values()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::set_uint32_values ( DDS::MemberId  id,
const DDS::UInt32Seq value 
)

Definition at line 2489 of file DynamicDataImpl.cpp.

References OpenDDS::XTypes::TK_BITMASK, and value.

2490 {
2491  return set_sequence_values<TK_UINT32>(id, value, TK_BITMASK, 17, 32);
2492 }
const LogLevel::Value value
Definition: debug.cpp:61
const TypeKind TK_BITMASK
Definition: TypeObject.h:239

◆ set_uint64_value()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::set_uint64_value ( DDS::MemberId  id,
CORBA::ULongLong  value 
)

Definition at line 1782 of file DynamicDataImpl.cpp.

References OpenDDS::XTypes::TK_BITMASK, and value.

1783 {
1784  return set_single_value<TK_UINT64>(id, value, TK_BITMASK, 33, 64);
1785 }
const LogLevel::Value value
Definition: debug.cpp:61
const TypeKind TK_BITMASK
Definition: TypeObject.h:239

◆ set_uint64_values()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::set_uint64_values ( DDS::MemberId  id,
const DDS::UInt64Seq value 
)

Definition at line 2519 of file DynamicDataImpl.cpp.

References OpenDDS::XTypes::TK_BITMASK, and value.

2520 {
2521  return set_sequence_values<TK_UINT64>(id, value, TK_BITMASK, 33, 64);
2522 }
const LogLevel::Value value
Definition: debug.cpp:61
const TypeKind TK_BITMASK
Definition: TypeObject.h:239

◆ set_uint8_value()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::set_uint8_value ( DDS::MemberId  id,
CORBA::UInt8  value 
)

Definition at line 1762 of file DynamicDataImpl.cpp.

References OpenDDS::XTypes::TK_BITMASK.

1763 {
1764  return set_single_value<TK_UINT8>(id, ACE_OutputCDR::from_uint8(value), TK_BITMASK, 1, 8);
1765 }
const LogLevel::Value value
Definition: debug.cpp:61
const TypeKind TK_BITMASK
Definition: TypeObject.h:239

◆ set_uint8_values()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::set_uint8_values ( DDS::MemberId  id,
const DDS::UInt8Seq value 
)

Definition at line 2499 of file DynamicDataImpl.cpp.

References OpenDDS::XTypes::TK_BITMASK, and value.

2500 {
2501  return set_sequence_values<TK_UINT8>(id, value, TK_BITMASK, 1, 8);
2502 }
const LogLevel::Value value
Definition: debug.cpp:61
const TypeKind TK_BITMASK
Definition: TypeObject.h:239

◆ set_value_to_collection()

template<TypeKind ElementTypeKind, typename ElementType >
bool OpenDDS::XTypes::DynamicDataImpl::set_value_to_collection ( DDS::MemberId  id,
const ElementType &  value,
TypeKind  coll_tk,
TypeKind  enum_or_bitmask = TK_NONE,
LBound  lower = 0,
LBound  upper = 0 
)
private

Definition at line 1656 of file DynamicDataImpl.cpp.

References ACE_ERROR, OpenDDS::XTypes::get_base_type(), insert_single(), LM_NOTICE, OpenDDS::DCPS::log_level, OpenDDS::DCPS::LogLevel::Notice, DDS::RETCODE_OK, OpenDDS::XTypes::DynamicDataBase::type_, OpenDDS::XTypes::typekind_to_string(), and validate_member_id_collection().

1658 {
1659  DDS::TypeDescriptor_var descriptor;
1660  if (type_->get_descriptor(descriptor) != DDS::RETCODE_OK) {
1661  return false;
1662  }
1663 
1664  const DDS::DynamicType_var elem_type = get_base_type(descriptor->element_type());
1665  const TypeKind elem_tk = elem_type->get_kind();
1666 
1667  if (elem_tk != ElementTypeKind && elem_tk != enum_or_bitmask) {
1669  ACE_ERROR((LM_NOTICE, "(%P|%t) NOTICE: DynamicDataImpl::set_value_to_collection:"
1670  " Could not write a value of type %C to %C with element type %C\n",
1671  typekind_to_string(ElementTypeKind), typekind_to_string(collection_tk),
1672  typekind_to_string(elem_tk)));
1673  }
1674  return false;
1675  }
1676 
1677  if (elem_tk == enum_or_bitmask) {
1678  DDS::TypeDescriptor_var elem_td;
1679  if (elem_type->get_descriptor(elem_td) != DDS::RETCODE_OK) {
1680  return false;
1681  }
1682  const CORBA::ULong bit_bound = elem_td->bound()[0];
1683  if (bit_bound < lower || bit_bound > upper) {
1684  return false;
1685  }
1686  }
1687 
1688  return validate_member_id_collection(descriptor, id, collection_tk) &&
1689  insert_single(id, value);
1690 }
OpenDDS_Dcps_Export LogLevel log_level
#define ACE_ERROR(X)
const LogLevel::Value value
Definition: debug.cpp:61
bool insert_single(DDS::MemberId id, const ACE_OutputCDR::from_int8 &value)
DDS::DynamicType_var type_
The actual (i.e., non-alias) DynamicType of the associated type.
const ReturnCode_t RETCODE_OK
DDS::DynamicType_var get_base_type(DDS::DynamicType_ptr type)
bool validate_member_id_collection(const DDS::TypeDescriptor_var &descriptor, DDS::MemberId id, TypeKind collection_tk) const
ACE_CDR::ULong ULong
const char * typekind_to_string(TypeKind tk)
ACE_CDR::Octet TypeKind
Definition: TypeObject.h:210

◆ set_value_to_struct()

template<TypeKind MemberTypeKind, typename MemberType >
bool OpenDDS::XTypes::DynamicDataImpl::set_value_to_struct ( DDS::MemberId  id,
const MemberType &  value 
)
private

Definition at line 732 of file DynamicDataImpl.cpp.

References OpenDDS::XTypes::DynamicDataBase::check_member(), insert_single(), and DDS::RETCODE_OK.

733 {
734  DDS::MemberDescriptor_var md;
735  DDS::DynamicType_var member_type;
736  const DDS::ReturnCode_t rc = check_member(
737  md, member_type, "DynamicDataImpl::set_value_to_struct", "set", id, MemberTypeKind);
738  if (rc != DDS::RETCODE_OK) {
739  return false;
740  }
741  return insert_single(id, value);
742 }
const LogLevel::Value value
Definition: debug.cpp:61
bool insert_single(DDS::MemberId id, const ACE_OutputCDR::from_int8 &value)
const ReturnCode_t RETCODE_OK
DDS::ReturnCode_t check_member(DDS::MemberDescriptor_var &md, DDS::DynamicType_var &type, const char *method, const char *what, DDS::MemberId id, DDS::TypeKind tk)

◆ set_value_to_union()

template<TypeKind MemberTypeKind, typename MemberType >
bool OpenDDS::XTypes::DynamicDataImpl::set_value_to_union ( DDS::MemberId  id,
const MemberType &  value,
TypeKind  enum_or_bitmask = TK_NONE,
LBound  lower = 0,
LBound  upper = 0 
)
private

Definition at line 1457 of file DynamicDataImpl.cpp.

References ACE_ERROR, cast_to_discriminator_value(), clear_container(), OpenDDS::XTypes::DISCRIMINATOR_ID, OpenDDS::XTypes::DynamicDataBase::discriminator_selects_no_member(), find_selected_member(), OpenDDS::XTypes::get_base_type(), insert_single(), insert_valid_discriminator(), is_valid_discriminator_type(), LM_NOTICE, OpenDDS::DCPS::log_level, OpenDDS::XTypes::MEMBER_ID_INVALID, OpenDDS::DCPS::LogLevel::Notice, DDS::RETCODE_OK, OpenDDS::XTypes::DynamicDataBase::type_, OpenDDS::XTypes::typekind_to_string(), and validate_discriminator().

1459 {
1460  DDS::TypeDescriptor_var descriptor;
1461  if (type_->get_descriptor(descriptor) != DDS::RETCODE_OK) {
1462  return false;
1463  }
1464 
1465  // This follows the IDL-to-C++ mapping for union.
1466  DDS::DynamicType_var member_type;
1467  if (id == DISCRIMINATOR_ID) {
1468  // Discriminator can only be of certain types (XTypes spec, 7.2.2.4.4.3)
1469  if (!is_valid_discriminator_type(MemberTypeKind)) {
1471  ACE_ERROR((LM_NOTICE, "(%P|%t) NOTICE: DynamicDataImpl::set_value_to_union:"
1472  " Type %C cannot be used for union discriminator\n",
1473  typekind_to_string(MemberTypeKind)));
1474  }
1475  return false;
1476  }
1477 
1478  member_type = get_base_type(descriptor->discriminator_type());
1479 
1480  const TypeKind member_tk = member_type->get_kind();
1481  if (member_tk != MemberTypeKind && member_tk != enum_or_bitmask) {
1482  return false;
1483  }
1484 
1485  if (member_tk == enum_or_bitmask) {
1486  DDS::TypeDescriptor_var member_td;
1487  if (member_type->get_descriptor(member_td) != DDS::RETCODE_OK) {
1488  return false;
1489  }
1490  const CORBA::ULong bit_bound = member_td->bound()[0];
1491  if (bit_bound < lower || bit_bound > upper) {
1492  return false;
1493  }
1494  }
1495 
1496  CORBA::Long disc_value;
1497  if (!cast_to_discriminator_value(disc_value, value)) {
1498  return false;
1499  }
1500 
1501  const DDS::MemberId selected_id = find_selected_member();
1502  if (selected_id != MEMBER_ID_INVALID) {
1503  DDS::DynamicTypeMember_var selected_member;
1504  if (type_->get_member(selected_member, selected_id) != DDS::RETCODE_OK) {
1505  return false;
1506  }
1507  DDS::MemberDescriptor_var selected_md;
1508  if (selected_member->get_descriptor(selected_md) != DDS::RETCODE_OK) {
1509  return false;
1510  }
1511 
1512  if (!validate_discriminator(disc_value, selected_md)) {
1514  ACE_ERROR((LM_NOTICE, "(%P|%t) NOTICE: DynamicDataImpl::set_value_to_union:"
1515  " Discriminator value %d does not select the activated member (ID %u)\n",
1516  disc_value, selected_id));
1517  }
1518  return false;
1519  }
1520  return insert_single(id, value);
1521  } else {
1522  // In case the union has implicit default member and the input discriminator value
1523  // selects that implicit default member, store the discriminator value. The semantics
1524  // of this is similar to the _default() method of the IDL-to-C++ mapping for union.
1525  if (discriminator_selects_no_member(type_, disc_value)) {
1526  return insert_single(id, value);
1527  }
1529  ACE_ERROR((LM_NOTICE, "(%P|%t) NOTICE: DynamicDataImpl::set_value_to_union:"
1530  " Can't directly set a discriminator that selects a member."
1531  " Activate the member first!\n"));
1532  }
1533  return false;
1534  }
1535  }
1536 
1537  // Activate a member
1538  clear_container();
1539 
1540  DDS::DynamicTypeMember_var member;
1541  if (type_->get_member(member, id) != DDS::RETCODE_OK) {
1542  return false;
1543  }
1544  DDS::MemberDescriptor_var md;
1545  if (member->get_descriptor(md) != DDS::RETCODE_OK) {
1546  return false;
1547  }
1548  member_type = get_base_type(md->type());
1549 
1550  const TypeKind member_tk = member_type->get_kind();
1551  if (member_tk != MemberTypeKind && member_tk != enum_or_bitmask) {
1552  return false;
1553  }
1554 
1555  return insert_valid_discriminator(md) && insert_single(id, value);
1556 }
OpenDDS_Dcps_Export LogLevel log_level
ACE_CDR::Long Long
#define ACE_ERROR(X)
ACE_CDR::ULong MemberId
Definition: TypeObject.h:910
const LogLevel::Value value
Definition: debug.cpp:61
bool insert_single(DDS::MemberId id, const ACE_OutputCDR::from_int8 &value)
DDS::DynamicType_var type_
The actual (i.e., non-alias) DynamicType of the associated type.
const ReturnCode_t RETCODE_OK
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.
Definition: TypeObject.h:913
bool validate_discriminator(CORBA::Long disc_val, const DDS::MemberDescriptor_var &md) const
const ACE_CDR::ULong MEMBER_ID_INVALID
Definition: TypeObject.h:911
ACE_CDR::ULong ULong
bool cast_to_discriminator_value(CORBA::Long &disc_value, const ACE_OutputCDR::from_boolean &value) const
DDS::MemberId find_selected_member() const
bool insert_valid_discriminator(DDS::MemberDescriptor *memberSelected)
static bool is_valid_discriminator_type(TypeKind tk)
const char * typekind_to_string(TypeKind tk)
static bool discriminator_selects_no_member(DDS::DynamicType *type, ACE_CDR::Long disc)
ACE_CDR::Octet TypeKind
Definition: TypeObject.h:210

◆ set_values_to_array()

template<TypeKind ElementTypeKind, typename SequenceType >
bool OpenDDS::XTypes::DynamicDataImpl::set_values_to_array ( DDS::MemberId  id,
const SequenceType &  value,
TypeKind  enum_or_bitmask,
LBound  lower,
LBound  upper 
)
private

Definition at line 2422 of file DynamicDataImpl.cpp.

References OpenDDS::XTypes::DynamicDataBase::bound_total(), insert_sequence(), DDS::RETCODE_OK, OpenDDS::XTypes::TK_ARRAY, OpenDDS::XTypes::DynamicDataBase::type_, and validate_member_id_collection().

2425 {
2426  DDS::TypeDescriptor_var descriptor;
2427  if (type_->get_descriptor(descriptor) != DDS::RETCODE_OK) {
2428  return false;
2429  }
2430  const CORBA::ULong length = bound_total(descriptor);
2431  return
2432  check_seqmem_in_sequence_and_array<ElementTypeKind>(id, length, enum_or_bitmask, lower, upper) &&
2433  validate_member_id_collection(descriptor, id, TK_ARRAY) &&
2434  insert_sequence(id, value);
2435 }
const LogLevel::Value value
Definition: debug.cpp:61
DDS::DynamicType_var type_
The actual (i.e., non-alias) DynamicType of the associated type.
const ReturnCode_t RETCODE_OK
bool validate_member_id_collection(const DDS::TypeDescriptor_var &descriptor, DDS::MemberId id, TypeKind collection_tk) const
static CORBA::ULong bound_total(DDS::TypeDescriptor_var descriptor)
ACE_CDR::ULong ULong
const TypeKind TK_ARRAY
Definition: TypeObject.h:249
bool insert_sequence(DDS::MemberId id, const SequenceType &value)

◆ set_values_to_sequence()

template<TypeKind ElementTypeKind, typename SequenceType >
bool OpenDDS::XTypes::DynamicDataImpl::set_values_to_sequence ( DDS::MemberId  id,
const SequenceType &  value,
TypeKind  enum_or_bitmask,
LBound  lower,
LBound  upper 
)
private

Definition at line 2406 of file DynamicDataImpl.cpp.

References insert_sequence(), DDS::RETCODE_OK, OpenDDS::XTypes::TK_SEQUENCE, OpenDDS::XTypes::DynamicDataBase::type_, and validate_member_id_collection().

2409 {
2410  DDS::TypeDescriptor_var descriptor;
2411  if (type_->get_descriptor(descriptor) != DDS::RETCODE_OK) {
2412  return false;
2413  }
2414  const CORBA::ULong bound = descriptor->bound()[0];
2415  return
2416  check_seqmem_in_sequence_and_array<ElementTypeKind>(id, bound, enum_or_bitmask, lower, upper) &&
2417  validate_member_id_collection(descriptor, id, TK_SEQUENCE) &&
2418  insert_sequence(id, value);
2419 }
const LogLevel::Value value
Definition: debug.cpp:61
DDS::DynamicType_var type_
The actual (i.e., non-alias) DynamicType of the associated type.
const ReturnCode_t RETCODE_OK
bool validate_member_id_collection(const DDS::TypeDescriptor_var &descriptor, DDS::MemberId id, TypeKind collection_tk) const
ACE_CDR::ULong ULong
const TypeKind TK_SEQUENCE
Definition: TypeObject.h:248
bool insert_sequence(DDS::MemberId id, const SequenceType &value)

◆ set_values_to_struct()

template<TypeKind ElementTypeKind, typename SequenceType >
bool OpenDDS::XTypes::DynamicDataImpl::set_values_to_struct ( DDS::MemberId  id,
const SequenceType &  value,
TypeKind  enum_or_bitmask,
LBound  lower,
LBound  upper 
)
private

Definition at line 2325 of file DynamicDataImpl.cpp.

References insert_sequence().

2328 {
2329  return check_seqmem_in_struct_and_union<ElementTypeKind>(id, enum_or_bitmask, lower, upper) &&
2330  insert_sequence(id, value);
2331 }
const LogLevel::Value value
Definition: debug.cpp:61
bool insert_sequence(DDS::MemberId id, const SequenceType &value)

◆ set_values_to_union()

template<TypeKind ElementTypeKind, typename SequenceType >
bool OpenDDS::XTypes::DynamicDataImpl::set_values_to_union ( DDS::MemberId  id,
const SequenceType &  value,
TypeKind  enum_or_bitmask,
LBound  lower,
LBound  upper 
)
private

Definition at line 2334 of file DynamicDataImpl.cpp.

References ACE_ERROR, clear_container(), OpenDDS::XTypes::DISCRIMINATOR_ID, insert_sequence(), insert_valid_discriminator(), LM_NOTICE, OpenDDS::DCPS::log_level, OpenDDS::DCPS::LogLevel::Notice, DDS::RETCODE_OK, and OpenDDS::XTypes::DynamicDataBase::type_.

2337 {
2338  if (id == DISCRIMINATOR_ID) {
2340  ACE_ERROR((LM_NOTICE, "(%P|%t) NOTICE: DynamicDataImpl::set_values_to_union:"
2341  " Union discriminator cannot be a sequence\n"));
2342  }
2343  return false;
2344  }
2345 
2346  // Check the member type against the input type parameters.
2347  if (!check_seqmem_in_struct_and_union<ElementTypeKind>(id, enum_or_bitmask, lower, upper)) {
2348  return false;
2349  }
2350 
2351  clear_container();
2352 
2353  DDS::DynamicTypeMember_var member;
2354  if (type_->get_member(member, id) != DDS::RETCODE_OK) {
2355  return false;
2356  }
2357  DDS::MemberDescriptor_var md;
2358  if (member->get_descriptor(md) != DDS::RETCODE_OK) {
2359  return false;
2360  }
2362 }
OpenDDS_Dcps_Export LogLevel log_level
#define ACE_ERROR(X)
const LogLevel::Value value
Definition: debug.cpp:61
DDS::DynamicType_var type_
The actual (i.e., non-alias) DynamicType of the associated type.
const ReturnCode_t RETCODE_OK
const ACE_CDR::ULong DISCRIMINATOR_ID
Implementation specific sentinel for a union discriminator used in DynamicData.
Definition: TypeObject.h:913
bool insert_valid_discriminator(DDS::MemberDescriptor *memberSelected)
bool insert_sequence(DDS::MemberId id, const SequenceType &value)

◆ set_wstring_value()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::set_wstring_value ( DDS::MemberId  id,
const CORBA::WChar value 
)

Definition at line 1933 of file DynamicDataImpl.cpp.

References DDS::RETCODE_UNSUPPORTED, and value.

1934 {
1935 #ifdef DDS_HAS_WCHAR
1936  return set_single_value<TK_STRING16>(id, value);
1937 #else
1938  return DDS::RETCODE_UNSUPPORTED;
1939 #endif
1940 }
const LogLevel::Value value
Definition: debug.cpp:61
const ReturnCode_t RETCODE_UNSUPPORTED

◆ set_wstring_values()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicDataImpl::set_wstring_values ( DDS::MemberId  id,
const DDS::WstringSeq value 
)

Definition at line 2568 of file DynamicDataImpl.cpp.

References DDS::RETCODE_UNSUPPORTED, and value.

2569 {
2570 #ifdef DDS_HAS_WCHAR
2571  return set_sequence_values<TK_STRING16>(id, value);
2572 #else
2573  return DDS::RETCODE_UNSUPPORTED;
2574 #endif
2575 }
const LogLevel::Value value
Definition: debug.cpp:61
const ReturnCode_t RETCODE_UNSUPPORTED

◆ type()

DDS::DynamicType_ptr OpenDDS::XTypes::DynamicDataImpl::type ( void  )

Definition at line 41 of file DynamicDataImpl.cpp.

References OpenDDS::XTypes::DynamicDataBase::type_.

Referenced by move_sequence_to_complex(), and move_single_to_complex().

42 {
43  return DDS::DynamicType::_duplicate(type_);
44 }
DDS::DynamicType_var type_
The actual (i.e., non-alias) DynamicType of the associated type.

◆ validate_discriminator()

bool OpenDDS::XTypes::DynamicDataImpl::validate_discriminator ( CORBA::Long  disc_val,
const DDS::MemberDescriptor_var &  md 
) const
private

Definition at line 1340 of file DynamicDataImpl.cpp.

References is_default_member_selected(), and OpenDDS::XTypes::Sequence< T >::length().

Referenced by set_complex_to_union(), and set_value_to_union().

1342 {
1343  // If the selected member is not default, the discriminator value must equal one of its
1344  // labels. If the selected member is default, the discriminator value must not equal
1345  // any label of the non-default members.
1346  if (!md->is_default_label()) {
1347  const DDS::UnionCaseLabelSeq& labels = md->label();
1348  bool found = false;
1349  for (CORBA::ULong i = 0; !found && i < labels.length(); ++i) {
1350  if (disc_val == labels[i]) {
1351  found = true;
1352  }
1353  }
1354  if (!found) {
1355  return false;
1356  }
1357  } else if (!is_default_member_selected(disc_val, md->id())) {
1358  return false;
1359  }
1360  return true;
1361 }
ACE_CDR::ULong length() const
Definition: TypeObject.h:167
bool is_default_member_selected(CORBA::Long disc_val, DDS::MemberId default_id) const
ACE_CDR::ULong ULong

◆ validate_member_id_collection()

bool OpenDDS::XTypes::DynamicDataImpl::validate_member_id_collection ( const DDS::TypeDescriptor_var &  descriptor,
DDS::MemberId  id,
TypeKind  collection_tk 
) const
private

Definition at line 2194 of file DynamicDataImpl.cpp.

References ACE_ERROR, check_index_from_id(), LM_NOTICE, OpenDDS::DCPS::log_level, OpenDDS::DCPS::LogLevel::Notice, OpenDDS::XTypes::TK_ARRAY, OpenDDS::XTypes::TK_MAP, and OpenDDS::XTypes::TK_SEQUENCE.

Referenced by set_complex_to_collection(), set_value_to_collection(), set_values_to_array(), and set_values_to_sequence().

2196 {
2197  switch (tk) {
2198  case TK_SEQUENCE:
2199  {
2200  const CORBA::ULong bound = descriptor->bound()[0];
2201  return check_index_from_id(tk, id, bound);
2202  }
2203  case TK_ARRAY:
2204  {
2205  CORBA::ULong bound = 1;
2206  for (CORBA::ULong i = 0; i < descriptor->bound().length(); ++i) {
2207  bound *= descriptor->bound()[i];
2208  }
2209  return check_index_from_id(tk, id, bound);
2210  }
2211  case TK_MAP:
2213  ACE_ERROR((LM_NOTICE, "(%P|%t) NOTICE: DynamicDataImpl::validate_member_id_collection::"
2214  " Map is currently not supported\n"));
2215  }
2216  }
2217  return false;
2218 }
OpenDDS_Dcps_Export LogLevel log_level
#define ACE_ERROR(X)
ACE_CDR::ULong ULong
bool check_index_from_id(TypeKind tk, DDS::MemberId id, CORBA::ULong bound) const
const TypeKind TK_SEQUENCE
Definition: TypeObject.h:248
const TypeKind TK_ARRAY
Definition: TypeObject.h:249
const TypeKind TK_MAP
Definition: TypeObject.h:250

◆ write_discriminator()

bool OpenDDS::XTypes::DynamicDataImpl::write_discriminator ( CORBA::Long  value)
private

Definition at line 3752 of file DynamicDataImpl.cpp.

References OpenDDS::XTypes::enum_bound(), DDS::RETCODE_OK, OpenDDS::XTypes::TK_ENUM, OpenDDS::XTypes::DynamicDataBase::type_, and write_discriminator_helper().

Referenced by get_complex_from_union().

3753 {
3754  TypeKind treat_as = type_->get_kind();
3755  if (treat_as == TK_ENUM) {
3756  if (enum_bound(type_, treat_as) != DDS::RETCODE_OK) {
3757  return false;
3758  }
3759  }
3760  return write_discriminator_helper(value, treat_as);
3761 }
const LogLevel::Value value
Definition: debug.cpp:61
DDS::DynamicType_var type_
The actual (i.e., non-alias) DynamicType of the associated type.
const ReturnCode_t RETCODE_OK
DDS::ReturnCode_t enum_bound(DDS::DynamicType_ptr type, DDS::TypeKind &bound_kind)
const TypeKind TK_ENUM
Definition: TypeObject.h:238
bool write_discriminator_helper(CORBA::Long value, TypeKind treat_as)
ACE_CDR::Octet TypeKind
Definition: TypeObject.h:210

◆ write_discriminator_helper()

bool OpenDDS::XTypes::DynamicDataImpl::write_discriminator_helper ( CORBA::Long  value,
TypeKind  treat_as 
)
private

Definition at line 3717 of file DynamicDataImpl.cpp.

References insert_single(), OpenDDS::XTypes::MEMBER_ID_INVALID, OpenDDS::XTypes::TK_BOOLEAN, OpenDDS::XTypes::TK_BYTE, OpenDDS::XTypes::TK_CHAR16, OpenDDS::XTypes::TK_CHAR8, OpenDDS::XTypes::TK_INT16, OpenDDS::XTypes::TK_INT32, OpenDDS::XTypes::TK_INT64, OpenDDS::XTypes::TK_INT8, OpenDDS::XTypes::TK_UINT16, OpenDDS::XTypes::TK_UINT32, OpenDDS::XTypes::TK_UINT64, and OpenDDS::XTypes::TK_UINT8.

Referenced by write_discriminator().

3718 {
3719  switch (treat_as) {
3720  case TK_BOOLEAN:
3722  case TK_BYTE:
3724  case TK_CHAR8:
3726 #ifdef DDS_HAS_WCHAR
3727  case TK_CHAR16:
3729 #endif
3730  case TK_INT8:
3732  case TK_UINT8:
3734  case TK_INT16:
3735  return insert_single(MEMBER_ID_INVALID, static_cast<CORBA::Short>(value));
3736  case TK_UINT16:
3737  return insert_single(MEMBER_ID_INVALID, static_cast<CORBA::UShort>(value));
3738  case TK_INT32:
3740  case TK_UINT32:
3741  return insert_single(MEMBER_ID_INVALID, static_cast<CORBA::ULong>(value));
3742  case TK_INT64:
3743  return insert_single(MEMBER_ID_INVALID, static_cast<CORBA::LongLong>(value));
3744  case TK_UINT64:
3745  return insert_single(MEMBER_ID_INVALID, static_cast<CORBA::ULongLong>(value));
3746  default:
3747  return false;
3748  }
3749 }
const TypeKind TK_INT8
Definition: TypeObject.h:225
const LogLevel::Value value
Definition: debug.cpp:61
bool insert_single(DDS::MemberId id, const ACE_OutputCDR::from_int8 &value)
const TypeKind TK_CHAR16
Definition: TypeObject.h:228
const TypeKind TK_INT32
Definition: TypeObject.h:217
const TypeKind TK_CHAR8
Definition: TypeObject.h:227
const TypeKind TK_UINT16
Definition: TypeObject.h:219
const ACE_CDR::ULong MEMBER_ID_INVALID
Definition: TypeObject.h:911
const TypeKind TK_INT64
Definition: TypeObject.h:218
const TypeKind TK_UINT8
Definition: TypeObject.h:226
const TypeKind TK_BOOLEAN
Definition: TypeObject.h:214
const TypeKind TK_INT16
Definition: TypeObject.h:216
const TypeKind TK_UINT32
Definition: TypeObject.h:220
const TypeKind TK_BYTE
Definition: TypeObject.h:215
const TypeKind TK_UINT64
Definition: TypeObject.h:221

Friends And Related Function Documentation

◆ DCPS::operator<< [1/2]

OpenDDS_Dcps_Export bool DCPS::operator<< ( DCPS::Serializer ser,
const DynamicDataImpl data 
)
friend

◆ DCPS::operator<< [2/2]

OpenDDS_Dcps_Export bool DCPS::operator<< ( DCPS::Serializer ser,
const DCPS::KeyOnly< const DynamicDataImpl > &  data 
)
friend

◆ DCPS::serialized_size [1/2]

OpenDDS_Dcps_Export bool DCPS::serialized_size ( const DCPS::Encoding encoding,
size_t &  size,
const DynamicDataImpl data 
)
friend

◆ DCPS::serialized_size [2/2]

OpenDDS_Dcps_Export bool DCPS::serialized_size ( const DCPS::Encoding encoding,
size_t &  size,
const DCPS::KeyOnly< const DynamicDataImpl > &  data 
)
friend

Member Data Documentation

◆ container_

DataContainer OpenDDS::XTypes::DynamicDataImpl::container_
private

The documentation for this class was generated from the following files: