OpenDDS  Snapshot(2023/04/28-20:55)
DynamicTypeImpl.h
Go to the documentation of this file.
1 #ifndef OPENDDS_DCPS_XTYPES_DYNAMIC_TYPE_IMPL_H
2 #define OPENDDS_DCPS_XTYPES_DYNAMIC_TYPE_IMPL_H
3 
4 #ifndef OPENDDS_SAFETY_PROFILE
5 
6 #include "TypeDescriptorImpl.h"
7 #include "MemberDescriptorImpl.h"
8 
9 #include <dds/DCPS/RcHandle_T.h>
10 #include <dds/DCPS/RcObject.h>
11 #include <dds/DdsDynamicDataC.h>
12 
14 
15 namespace OpenDDS {
16 namespace XTypes {
17 
18 // This will eventually be replaced by a map.
20 private:
21  typedef OPENDDS_MAP(OpenDDS::DCPS::String, DDS::DynamicTypeMember_var) MapType;
22 public:
23  typedef MapType::const_iterator const_iterator;
24 
25  const_iterator find(const OpenDDS::DCPS::String& key) const
26  {
27  return map_.find(key);
28  }
29 
30  const_iterator begin() const
31  {
32  return map_.begin();
33  }
34 
35  const_iterator end() const
36  {
37  return map_.end();
38  }
39 
40  void insert(const MapType::value_type& value)
41  {
42  map_.insert(value);
43  }
44 
45  size_t size() const
46  {
47  return map_.size();
48  }
49 
50  void clear()
51  {
52  map_.clear();
53  }
54 
55 private:
56  MapType map_;
57 };
58 
59 // This will eventually be replaced by a map.
61 private:
62  typedef OPENDDS_MAP(MemberId, DDS::DynamicTypeMember_var) MapType;
63 public:
64  typedef MapType::const_iterator const_iterator;
65 
66  const_iterator find(MemberId key) const
67  {
68  return map_.find(key);
69  }
70 
71  const_iterator begin() const
72  {
73  return map_.begin();
74  }
75 
76  const_iterator end() const
77  {
78  return map_.end();
79  }
80 
81  void insert(const MapType::value_type& value)
82  {
83  map_.insert(value);
84  }
85 
86  size_t size() const
87  {
88  return map_.size();
89  }
90 
91  void clear()
92  {
93  map_.clear();
94  }
95 
96 private:
97  MapType map_;
98 };
99 
101 public:
102  DynamicTypeImpl();
103  ~DynamicTypeImpl();
104 
105  void set_descriptor(DDS::TypeDescriptor* descriptor);
106  DDS::ReturnCode_t get_descriptor(DDS::TypeDescriptor*& descriptor);
107  char* get_name();
108  TypeKind get_kind();
109  DDS::ReturnCode_t get_member_by_name(DDS::DynamicTypeMember_ptr& member, const char* name);
110  DDS::ReturnCode_t get_all_members_by_name(DDS::DynamicTypeMembersByName_ptr& member);
111  DDS::ReturnCode_t get_member(DDS::DynamicTypeMember_ptr& member, MemberId id);
112  DDS::ReturnCode_t get_all_members(DDS::DynamicTypeMembersById_ptr& member);
113  ACE_CDR::ULong get_member_count();
114  DDS::ReturnCode_t get_member_by_index(DDS::DynamicTypeMember_ptr& member, ACE_CDR::ULong index);
115  CORBA::ULong get_annotation_count();
116  DDS::ReturnCode_t get_annotation(DDS::AnnotationDescriptor*& descriptor, CORBA::ULong idx);
117  CORBA::ULong get_verbatim_text_count();
118  DDS::ReturnCode_t get_verbatim_text(DDS::VerbatimTextDescriptor*& descriptor, CORBA::ULong idx);
119  bool equals(DDS::DynamicType_ptr other);
120  void insert_dynamic_member(DDS::DynamicTypeMember_ptr dtm);
121  void clear();
122 
124  {
125  minimal_ti_ = ti;
126  }
127 
129  {
130  return minimal_ti_;
131  }
132 
133  void set_minimal_type_map(const TypeMap& tm)
134  {
135  minimal_tm_ = tm;
136  }
137 
138  const TypeMap& get_minimal_type_map() const
139  {
140  return minimal_tm_;
141  }
142 
144  {
145  complete_ti_ = ti;
146  }
147 
149  {
150  return complete_ti_;
151  }
152 
153  void set_complete_type_map(const TypeMap& tm)
154  {
155  complete_tm_ = tm;
156  }
157 
158  const TypeMap& get_complete_type_map() const
159  {
160  return complete_tm_;
161  }
162 
163  void set_preset_type_info(const TypeInformation& type_info)
164  {
165  preset_type_info_ = type_info;
166  preset_type_info_set_ = true;
167  }
168 
170  {
171  return preset_type_info_set_ ? &preset_type_info_ : 0;
172  }
173 
174 private:
177  typedef OPENDDS_VECTOR(DDS::DynamicTypeMember_var) DynamicTypeMembersByIndex;
178  DynamicTypeMembersByIndex member_by_index_;
179  DDS::TypeDescriptor_var descriptor_;
180 
182  TypeMap minimal_tm_;
184  TypeMap complete_tm_;
187 };
188 
189 OpenDDS_Dcps_Export DDS::DynamicType_var get_base_type(DDS::DynamicType_ptr type);
190 bool test_equality(DDS::DynamicType_ptr lhs, DDS::DynamicType_ptr rhs, DynamicTypePtrPairSeen& dt_ptr_pair);
191 bool test_equality(DynamicTypeMembersByNameImpl* lhs, DynamicTypeMembersByNameImpl* rhs, DynamicTypePtrPairSeen& dt_ptr_pair);
192 bool test_equality(DynamicTypeMembersByIdImpl* lhs, DynamicTypeMembersByIdImpl* rhs, DynamicTypePtrPairSeen& dt_ptr_pair);
193 
194 } // namespace XTypes
195 } // namespace OpenDDS
196 
198 
199 #endif // OPENDDS_SAFETY_PROFILE
200 
201 #endif /* OPENDDS_DCPS_XTYPES_DYNAMIC_TYPE_IMPL_H */
ACE_CDR::ULong MemberId
Definition: TypeObject.h:910
const LogLevel::Value value
Definition: debug.cpp:61
std::string String
const TypeMap & get_complete_type_map() const
typedef OPENDDS_MAP(OpenDDS::DCPS::String, DDS::DynamicTypeMember_var) MapType
#define OpenDDS_Dcps_Export
Definition: dcps_export.h:24
sequence< octet > key
DynamicTypeMembersByNameImpl member_by_name_
DDS::DynamicType_var get_base_type(DDS::DynamicType_ptr type)
DynamicTypeMembersByIdImpl member_by_id_
DDS::TypeDescriptor_var descriptor_
const TypeIdentifier & get_minimal_type_identifier() const
const_iterator find(const OpenDDS::DCPS::String &key) const
void insert(const MapType::value_type &value)
void set_complete_type_map(const TypeMap &tm)
const TypeIdentifier & get_complete_type_identifier() const
void insert(const MapType::value_type &value)
bool test_equality(DDS::DynamicType_ptr lhs, DDS::DynamicType_ptr rhs, DynamicTypePtrPairSeen &dt_ptr_pair)
void set_minimal_type_map(const TypeMap &tm)
ACE_CDR::Octet TypeKind
Definition: TypeObject.h:210
const_iterator find(MemberId key) const
ACE_CDR::ULong ULong
typedef OPENDDS_VECTOR(MemberPair) MatchedSet
const TypeInformation * get_preset_type_info() const
DynamicTypeMembersByIndex member_by_index_
void set_complete_type_identifier(const TypeIdentifier &ti)
ACE_UINT32 ULong
const char *const name
Definition: debug.cpp:60
void set_minimal_type_identifier(const TypeIdentifier &ti)
void set_preset_type_info(const TypeInformation &type_info)
#define OPENDDS_END_VERSIONED_NAMESPACE_DECL
The Internal API and Implementation of OpenDDS.
Definition: AddressCache.h:28
const TypeMap & get_minimal_type_map() const