OpenDDS  Snapshot(2023/04/28-20:55)
Public Member Functions | Private Member Functions | Private Attributes | List of all members
OpenDDS::XTypes::DynamicTypeImpl Class Reference

#include <DynamicTypeImpl.h>

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

Public Member Functions

 DynamicTypeImpl ()
 
 ~DynamicTypeImpl ()
 
void set_descriptor (DDS::TypeDescriptor *descriptor)
 
DDS::ReturnCode_t get_descriptor (DDS::TypeDescriptor *&descriptor)
 
char * get_name ()
 
TypeKind get_kind ()
 
DDS::ReturnCode_t get_member_by_name (DDS::DynamicTypeMember_ptr &member, const char *name)
 
DDS::ReturnCode_t get_all_members_by_name (DDS::DynamicTypeMembersByName_ptr &member)
 
DDS::ReturnCode_t get_member (DDS::DynamicTypeMember_ptr &member, MemberId id)
 
DDS::ReturnCode_t get_all_members (DDS::DynamicTypeMembersById_ptr &member)
 
ACE_CDR::ULong get_member_count ()
 
DDS::ReturnCode_t get_member_by_index (DDS::DynamicTypeMember_ptr &member, ACE_CDR::ULong index)
 
CORBA::ULong get_annotation_count ()
 
DDS::ReturnCode_t get_annotation (DDS::AnnotationDescriptor *&descriptor, CORBA::ULong idx)
 
CORBA::ULong get_verbatim_text_count ()
 
DDS::ReturnCode_t get_verbatim_text (DDS::VerbatimTextDescriptor *&descriptor, CORBA::ULong idx)
 
bool equals (DDS::DynamicType_ptr other)
 
void insert_dynamic_member (DDS::DynamicTypeMember_ptr dtm)
 
void clear ()
 
void set_minimal_type_identifier (const TypeIdentifier &ti)
 
const TypeIdentifierget_minimal_type_identifier () const
 
void set_minimal_type_map (const TypeMap &tm)
 
const TypeMap & get_minimal_type_map () const
 
void set_complete_type_identifier (const TypeIdentifier &ti)
 
const TypeIdentifierget_complete_type_identifier () const
 
void set_complete_type_map (const TypeMap &tm)
 
const TypeMap & get_complete_type_map () const
 
void set_preset_type_info (const TypeInformation &type_info)
 
const TypeInformationget_preset_type_info () const
 
- Public Member Functions inherited from DDS::DynamicType
DDS::ReturnCode_t get_descriptor (inout TypeDescriptor descriptor)
 
DDS::ReturnCode_t get_member_by_name (inout DynamicTypeMember member, in ObjectName name)
 
DDS::ReturnCode_t get_all_members_by_name (inout DynamicTypeMembersByName member)
 
DDS::ReturnCode_t get_member (inout DynamicTypeMember member, in MemberId id)
 
DDS::ReturnCode_t get_all_members (inout DynamicTypeMembersById member)
 
DDS::ReturnCode_t get_member_by_index (inout DynamicTypeMember member, in unsigned long index)
 
DDS::ReturnCode_t get_annotation (inout AnnotationDescriptor descriptor, in unsigned long idx)
 
DDS::ReturnCode_t get_verbatim_text (inout VerbatimTextDescriptor descriptor, in unsigned long idx)
 
boolean equals (in DynamicType other)
 

Private Member Functions

typedef OPENDDS_VECTOR (DDS::DynamicTypeMember_var) DynamicTypeMembersByIndex
 

Private Attributes

DynamicTypeMembersByNameImpl member_by_name_
 
DynamicTypeMembersByIdImpl member_by_id_
 
DynamicTypeMembersByIndex member_by_index_
 
DDS::TypeDescriptor_var descriptor_
 
TypeIdentifier minimal_ti_
 
TypeMap minimal_tm_
 
TypeIdentifier complete_ti_
 
TypeMap complete_tm_
 
bool preset_type_info_set_
 
TypeInformation preset_type_info_
 

Detailed Description

Definition at line 100 of file DynamicTypeImpl.h.

Constructor & Destructor Documentation

◆ DynamicTypeImpl()

OpenDDS::XTypes::DynamicTypeImpl::DynamicTypeImpl ( )

Definition at line 20 of file DynamicTypeImpl.cpp.

◆ ~DynamicTypeImpl()

OpenDDS::XTypes::DynamicTypeImpl::~DynamicTypeImpl ( )

Definition at line 24 of file DynamicTypeImpl.cpp.

25 {}

Member Function Documentation

◆ clear()

void OpenDDS::XTypes::DynamicTypeImpl::clear ( void  )

◆ equals()

bool OpenDDS::XTypes::DynamicTypeImpl::equals ( DDS::DynamicType_ptr  other)

Definition at line 140 of file DynamicTypeImpl.cpp.

References OpenDDS::XTypes::test_equality().

141 {
142  //7.5.2.8.4 Operation: equals
143  //Two types shall be considered equal if and only if all of their respective properties, as identified
144  //in Table 54 above, are equal.
145 
146  //In addition to what the spec says to compare, we will be comparing the TypeDescriptors of both
147  //DynamicTypes. The spec seems to assume this is the case, despite not listing the TypeDescriptor
148  //as a property in table 54. This is done to allow the recursive comparison required by the changes
149  //to DynamicTypeMember::equals.
150  DynamicTypePtrPairSeen dt_ptr_pair;
151  return test_equality(this, other, dt_ptr_pair);
152 }
bool test_equality(DDS::DynamicType_ptr lhs, DDS::DynamicType_ptr rhs, DynamicTypePtrPairSeen &dt_ptr_pair)

◆ get_all_members()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicTypeImpl::get_all_members ( DDS::DynamicTypeMembersById_ptr &  member)

Definition at line 88 of file DynamicTypeImpl.cpp.

References member_by_id_, and DDS::RETCODE_OK.

89 {
90  DDS::DynamicTypeMembersById_var member_v(member);
91  member = DDS::DynamicTypeMembersById::_duplicate(&member_by_id_);
92  return DDS::RETCODE_OK;
93 }
DynamicTypeMembersByIdImpl member_by_id_
const ReturnCode_t RETCODE_OK

◆ get_all_members_by_name()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicTypeImpl::get_all_members_by_name ( DDS::DynamicTypeMembersByName_ptr &  member)

Definition at line 64 of file DynamicTypeImpl.cpp.

References member_by_name_, and DDS::RETCODE_OK.

65 {
66  DDS::DynamicTypeMembersByName_var member_v(member);
67  member = DDS::DynamicTypeMembersByName::_duplicate(&member_by_name_);
68  return DDS::RETCODE_OK;
69 }
DynamicTypeMembersByNameImpl member_by_name_
const ReturnCode_t RETCODE_OK

◆ get_annotation()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicTypeImpl::get_annotation ( DDS::AnnotationDescriptor *&  descriptor,
CORBA::ULong  idx 
)

Definition at line 122 of file DynamicTypeImpl.cpp.

References DDS::RETCODE_UNSUPPORTED.

123 {
124  // FUTURE
126 }
const ReturnCode_t RETCODE_UNSUPPORTED

◆ get_annotation_count()

CORBA::ULong OpenDDS::XTypes::DynamicTypeImpl::get_annotation_count ( )

Implements DDS::DynamicType.

Definition at line 116 of file DynamicTypeImpl.cpp.

117 {
118  // FUTURE
119  return 0;
120 }

◆ get_complete_type_identifier()

const TypeIdentifier& OpenDDS::XTypes::DynamicTypeImpl::get_complete_type_identifier ( ) const
inline

Definition at line 148 of file DynamicTypeImpl.h.

Referenced by DDS::DynamicTypeSupport::getCompleteTypeIdentifier().

149  {
150  return complete_ti_;
151  }

◆ get_complete_type_map()

const TypeMap& OpenDDS::XTypes::DynamicTypeImpl::get_complete_type_map ( ) const
inline

Definition at line 158 of file DynamicTypeImpl.h.

Referenced by DDS::DynamicTypeSupport::getCompleteTypeMap().

159  {
160  return complete_tm_;
161  }

◆ get_descriptor()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicTypeImpl::get_descriptor ( DDS::TypeDescriptor *&  descriptor)

Definition at line 34 of file DynamicTypeImpl.cpp.

References descriptor_, and DDS::RETCODE_OK.

35 {
36  DDS::TypeDescriptor_var descriptor_v(descriptor);
37  descriptor = descriptor_;
38  CORBA::add_ref(descriptor);
39  return DDS::RETCODE_OK;
40 }
DDS::TypeDescriptor_var descriptor_
const ReturnCode_t RETCODE_OK

◆ get_kind()

TypeKind OpenDDS::XTypes::DynamicTypeImpl::get_kind ( )

Implements DDS::DynamicType.

Definition at line 48 of file DynamicTypeImpl.cpp.

References descriptor_.

49 {
50  return descriptor_->kind();
51 }
DDS::TypeDescriptor_var descriptor_

◆ get_member()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicTypeImpl::get_member ( DDS::DynamicTypeMember_ptr &  member,
MemberId  id 
)

Definition at line 71 of file DynamicTypeImpl.cpp.

References ACE_ERROR, descriptor_, OpenDDS::XTypes::DynamicTypeMembersByIdImpl::end(), OpenDDS::XTypes::DynamicTypeMembersByIdImpl::find(), TAO::String_var< charT >::in(), LM_NOTICE, OpenDDS::DCPS::log_level, member_by_id_, name, OpenDDS::DCPS::LogLevel::Notice, DDS::RETCODE_BAD_PARAMETER, and DDS::RETCODE_OK.

72 {
74  if (pos == member_by_id_.end()) {
77  ACE_ERROR((LM_NOTICE, "(%P|%t) NOTICE: DynamicTypeImpl::get_member: "
78  "type %C doesn't have a member with id %u\n", name.in(), id));
79  }
81  }
82 
83  DDS::DynamicTypeMember_var member_v(member);
84  member = DDS::DynamicTypeMember::_duplicate(pos->second);
85  return DDS::RETCODE_OK;
86 }
#define ACE_ERROR(X)
DynamicTypeMembersByIdImpl member_by_id_
DDS::TypeDescriptor_var descriptor_
const_iterator find(MemberId key) const
const char *const name
Definition: debug.cpp:60
OpenDDS_Dcps_Export LogLevel log_level
const ReturnCode_t RETCODE_OK
const character_type * in(void) const
const ReturnCode_t RETCODE_BAD_PARAMETER

◆ get_member_by_index()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicTypeImpl::get_member_by_index ( DDS::DynamicTypeMember_ptr &  member,
ACE_CDR::ULong  index 
)

Definition at line 100 of file DynamicTypeImpl.cpp.

References ACE_ERROR, descriptor_, TAO::String_var< charT >::in(), LM_NOTICE, OpenDDS::DCPS::log_level, member_by_index_, name, OpenDDS::DCPS::LogLevel::Notice, DDS::RETCODE_BAD_PARAMETER, and DDS::RETCODE_OK.

101 {
102  if (index >= member_by_index_.size()) {
105  ACE_ERROR((LM_NOTICE, "(%P|%t) NOTICE: DynamicTypeImpl::get_member_by_index: "
106  "type %C doesn't have a member with index %u\n", name.in(), index));
107  }
109  }
110 
111  DDS::DynamicTypeMember_var member_v(member);
112  member = DDS::DynamicTypeMember::_duplicate(member_by_index_[index]);
113  return DDS::RETCODE_OK;
114 }
#define ACE_ERROR(X)
DDS::TypeDescriptor_var descriptor_
DynamicTypeMembersByIndex member_by_index_
const char *const name
Definition: debug.cpp:60
OpenDDS_Dcps_Export LogLevel log_level
const ReturnCode_t RETCODE_OK
const character_type * in(void) const
const ReturnCode_t RETCODE_BAD_PARAMETER

◆ get_member_by_name()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicTypeImpl::get_member_by_name ( DDS::DynamicTypeMember_ptr &  member,
const char *  name 
)

Definition at line 53 of file DynamicTypeImpl.cpp.

References OpenDDS::XTypes::DynamicTypeMembersByNameImpl::end(), OpenDDS::XTypes::DynamicTypeMembersByNameImpl::find(), member_by_name_, DDS::RETCODE_ERROR, and DDS::RETCODE_OK.

54 {
56  if (pos != member_by_name_.end()) {
57  DDS::DynamicTypeMember_var member_v(member);
58  member = DDS::DynamicTypeMember::_duplicate(pos->second);
59  return DDS::RETCODE_OK;
60  }
61  return DDS::RETCODE_ERROR;
62 }
DynamicTypeMembersByNameImpl member_by_name_
const_iterator find(const OpenDDS::DCPS::String &key) const
const char *const name
Definition: debug.cpp:60
const ReturnCode_t RETCODE_ERROR
const ReturnCode_t RETCODE_OK

◆ get_member_count()

ACE_CDR::ULong OpenDDS::XTypes::DynamicTypeImpl::get_member_count ( )

Implements DDS::DynamicType.

Definition at line 95 of file DynamicTypeImpl.cpp.

References member_by_index_.

96 {
97  return ACE_CDR::ULong(member_by_index_.size());
98 }
DynamicTypeMembersByIndex member_by_index_
ACE_UINT32 ULong

◆ get_minimal_type_identifier()

const TypeIdentifier& OpenDDS::XTypes::DynamicTypeImpl::get_minimal_type_identifier ( ) const
inline

Definition at line 128 of file DynamicTypeImpl.h.

Referenced by DDS::DynamicTypeSupport::getMinimalTypeIdentifier().

129  {
130  return minimal_ti_;
131  }

◆ get_minimal_type_map()

const TypeMap& OpenDDS::XTypes::DynamicTypeImpl::get_minimal_type_map ( ) const
inline

Definition at line 138 of file DynamicTypeImpl.h.

Referenced by DDS::DynamicTypeSupport::getMinimalTypeMap().

139  {
140  return minimal_tm_;
141  }

◆ get_name()

char * OpenDDS::XTypes::DynamicTypeImpl::get_name ( void  )

Implements DDS::DynamicType.

Definition at line 42 of file DynamicTypeImpl.cpp.

References TAO::String_var< charT >::_retn(), and descriptor_.

43 {
44  CORBA::String_var str = descriptor_->name();
45  return str._retn();
46 }
DDS::TypeDescriptor_var descriptor_
character_type * _retn(void)

◆ get_preset_type_info()

const TypeInformation* OpenDDS::XTypes::DynamicTypeImpl::get_preset_type_info ( ) const
inline

Definition at line 169 of file DynamicTypeImpl.h.

Referenced by DDS::DynamicTypeSupport::preset_type_info().

170  {
172  }

◆ get_verbatim_text()

DDS::ReturnCode_t OpenDDS::XTypes::DynamicTypeImpl::get_verbatim_text ( DDS::VerbatimTextDescriptor *&  descriptor,
CORBA::ULong  idx 
)

Definition at line 134 of file DynamicTypeImpl.cpp.

References DDS::RETCODE_UNSUPPORTED.

135 {
136  // FUTURE
138 }
const ReturnCode_t RETCODE_UNSUPPORTED

◆ get_verbatim_text_count()

CORBA::ULong OpenDDS::XTypes::DynamicTypeImpl::get_verbatim_text_count ( )

Implements DDS::DynamicType.

Definition at line 128 of file DynamicTypeImpl.cpp.

129 {
130  // FUTURE
131  return 0;
132 }

◆ insert_dynamic_member()

void OpenDDS::XTypes::DynamicTypeImpl::insert_dynamic_member ( DDS::DynamicTypeMember_ptr  dtm)

Definition at line 154 of file DynamicTypeImpl.cpp.

References OpenDDS::XTypes::DynamicTypeMembersByNameImpl::insert(), OpenDDS::XTypes::DynamicTypeMembersByIdImpl::insert(), member_by_id_, member_by_index_, member_by_name_, OpenDDS::XTypes::MEMBER_ID_INVALID, and DDS::RETCODE_OK.

Referenced by OpenDDS::XTypes::TypeLookupService::complete_to_dynamic_i().

155 {
156  DDS::MemberDescriptor_var d;
157  if (dtm->get_descriptor(d) != DDS::RETCODE_OK) {
158  throw std::runtime_error("Could not get type descriptor of dynamic member");
159  }
160 
161  member_by_index_.push_back(DDS::DynamicTypeMember::_duplicate(dtm));
162 
163  if (d->id() != MEMBER_ID_INVALID) {
164  member_by_id_.insert(std::make_pair(d->id(), DDS::DynamicTypeMember::_duplicate(dtm)));
165  }
166  member_by_name_.insert(std::make_pair(d->name(), DDS::DynamicTypeMember::_duplicate(dtm)));
167 }
DynamicTypeMembersByNameImpl member_by_name_
DynamicTypeMembersByIdImpl member_by_id_
void insert(const MapType::value_type &value)
void insert(const MapType::value_type &value)
const ACE_CDR::ULong MEMBER_ID_INVALID
Definition: TypeObject.h:911
DynamicTypeMembersByIndex member_by_index_
const ReturnCode_t RETCODE_OK

◆ OPENDDS_VECTOR()

typedef OpenDDS::XTypes::DynamicTypeImpl::OPENDDS_VECTOR ( DDS::DynamicTypeMember_var  )
private

◆ set_complete_type_identifier()

void OpenDDS::XTypes::DynamicTypeImpl::set_complete_type_identifier ( const TypeIdentifier ti)
inline

◆ set_complete_type_map()

void OpenDDS::XTypes::DynamicTypeImpl::set_complete_type_map ( const TypeMap &  tm)
inline

◆ set_descriptor()

void OpenDDS::XTypes::DynamicTypeImpl::set_descriptor ( DDS::TypeDescriptor descriptor)

Definition at line 27 of file DynamicTypeImpl.cpp.

References descriptor_.

Referenced by OpenDDS::XTypes::TypeLookupService::complete_to_dynamic_i(), and OpenDDS::XTypes::TypeLookupService::type_identifier_to_dynamic().

28 {
29  // ValueTypes don't have a duplicate so manually add_ref.
30  CORBA::add_ref(descriptor);
31  descriptor_ = descriptor;
32 }
DDS::TypeDescriptor_var descriptor_

◆ set_minimal_type_identifier()

void OpenDDS::XTypes::DynamicTypeImpl::set_minimal_type_identifier ( const TypeIdentifier ti)
inline

◆ set_minimal_type_map()

void OpenDDS::XTypes::DynamicTypeImpl::set_minimal_type_map ( const TypeMap &  tm)
inline

◆ set_preset_type_info()

void OpenDDS::XTypes::DynamicTypeImpl::set_preset_type_info ( const TypeInformation type_info)
inline

Definition at line 163 of file DynamicTypeImpl.h.

Referenced by OpenDDS::DCPS::DomainParticipantImpl::get_dynamic_type().

164  {
165  preset_type_info_ = type_info;
166  preset_type_info_set_ = true;
167  }

Member Data Documentation

◆ complete_ti_

TypeIdentifier OpenDDS::XTypes::DynamicTypeImpl::complete_ti_
private

Definition at line 183 of file DynamicTypeImpl.h.

◆ complete_tm_

TypeMap OpenDDS::XTypes::DynamicTypeImpl::complete_tm_
private

Definition at line 184 of file DynamicTypeImpl.h.

◆ descriptor_

DDS::TypeDescriptor_var OpenDDS::XTypes::DynamicTypeImpl::descriptor_
private

◆ member_by_id_

DynamicTypeMembersByIdImpl OpenDDS::XTypes::DynamicTypeImpl::member_by_id_
private

Definition at line 176 of file DynamicTypeImpl.h.

Referenced by clear(), get_all_members(), get_member(), and insert_dynamic_member().

◆ member_by_index_

DynamicTypeMembersByIndex OpenDDS::XTypes::DynamicTypeImpl::member_by_index_
private

◆ member_by_name_

DynamicTypeMembersByNameImpl OpenDDS::XTypes::DynamicTypeImpl::member_by_name_
private

◆ minimal_ti_

TypeIdentifier OpenDDS::XTypes::DynamicTypeImpl::minimal_ti_
private

Definition at line 181 of file DynamicTypeImpl.h.

◆ minimal_tm_

TypeMap OpenDDS::XTypes::DynamicTypeImpl::minimal_tm_
private

Definition at line 182 of file DynamicTypeImpl.h.

◆ preset_type_info_

TypeInformation OpenDDS::XTypes::DynamicTypeImpl::preset_type_info_
private

Definition at line 186 of file DynamicTypeImpl.h.

◆ preset_type_info_set_

bool OpenDDS::XTypes::DynamicTypeImpl::preset_type_info_set_
private

Definition at line 185 of file DynamicTypeImpl.h.


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