Fast RTPS  Version 2.7.1
Fast RTPS
TypeIdentifier.h
1 // Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima).
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
22 #ifndef _TYPEIDENTIFIER_H_
23 #define _TYPEIDENTIFIER_H_
24 
25 #include <fastrtps/types/TypesBase.h>
26 #include <fastrtps/types/TypeIdentifierTypes.h>
27 #include <stdint.h>
28 #include <array>
29 #include <string>
30 #include <vector>
31 
32 namespace eprosima {
33 
34 namespace fastcdr {
35 class Cdr;
36 }
37 
38 namespace fastdds {
39 namespace dds {
41 }
42 }
43 
44 namespace fastrtps {
45 namespace types {
46 
47 typedef octet TypeIdentiferKind;
48 const octet TI_STRING8_SMALL = 0x70;
49 const octet TI_STRING8_LARGE = 0x71;
50 const octet TI_STRING16_SMALL = 0x72;
51 const octet TI_STRING16_LARGE = 0x73;
52 const octet TI_PLAIN_SEQUENCE_SMALL = 0x80;
53 const octet TI_PLAIN_SEQUENCE_LARGE = 0x81;
54 const octet TI_PLAIN_ARRAY_SMALL = 0x90;
55 const octet TI_PLAIN_ARRAY_LARGE = 0x91;
56 const octet TI_PLAIN_MAP_SMALL = 0xA0;
57 const octet TI_PLAIN_MAP_LARGE = 0xA1;
59 
60 // The TypeIdentifier uniquely identifies a type (a set of equivalent
61 // types according to an equivalence relationship: COMPLETE, MNIMAL).
62 //
63 // In some cases (primitive types, strings, plain types) the identifier
64 // is a explicit description of the type.
65 // In other cases the Identifier is a Hash of the type description
66 //
67 // In the case of primitive types and strings the implied equivalence
68 // relation is the identity.
69 //
70 // For Plain Types and Hash-defined TypeIdentifiers there are three
71 // possibilities: MINIMAL, COMPLETE, and COMMON:
72 // - MINIMAL indicates the TypeIdentifier identifies equivalent types
73 // according to the MINIMAL equivalence relation
74 // - COMPLETE indicates the TypeIdentifier identifies equivalent types
75 // according to the COMPLETE equivalence relation
76 // - COMMON indicates the TypeIdentifier identifies equivalent types
77 // according to both the MINIMAL and the COMMON equivalence relation.
78 // This means the TypeIdentifier is the same for both relationships
79 //
81 {
82 public:
83 
87  RTPS_DllAPI TypeIdentifier();
88 
92  RTPS_DllAPI ~TypeIdentifier();
93 
98  RTPS_DllAPI TypeIdentifier(
99  const TypeIdentifier& x);
100 
105  RTPS_DllAPI TypeIdentifier(
106  TypeIdentifier&& x);
107 
112  RTPS_DllAPI TypeIdentifier& operator=(
113  const TypeIdentifier& x);
114 
119  RTPS_DllAPI TypeIdentifier& operator=(
120  TypeIdentifier&& x);
121 
127  RTPS_DllAPI void _d(
128  octet __d);
129 
134  RTPS_DllAPI octet _d() const;
135 
140  RTPS_DllAPI octet& _d();
141 
146  RTPS_DllAPI void string_sdefn(
147  StringSTypeDefn _string_sdefn);
148 
154  RTPS_DllAPI const StringSTypeDefn& string_sdefn() const;
155 
166  RTPS_DllAPI void string_ldefn(
167  StringLTypeDefn _string_ldefn);
168 
174  RTPS_DllAPI const StringLTypeDefn& string_ldefn() const;
175 
186  RTPS_DllAPI void seq_sdefn(
187  PlainSequenceSElemDefn _seq_sdefn);
188 
194  RTPS_DllAPI const PlainSequenceSElemDefn& seq_sdefn() const;
195 
206  RTPS_DllAPI void seq_ldefn(
207  PlainSequenceLElemDefn _seq_ldefn);
208 
214  RTPS_DllAPI const PlainSequenceLElemDefn& seq_ldefn() const;
215 
226  RTPS_DllAPI void array_sdefn(
227  PlainArraySElemDefn _array_sdefn);
228 
234  RTPS_DllAPI const PlainArraySElemDefn& array_sdefn() const;
235 
246  RTPS_DllAPI void array_ldefn(
247  PlainArrayLElemDefn _array_ldefn);
248 
254  RTPS_DllAPI const PlainArrayLElemDefn& array_ldefn() const;
255 
266  RTPS_DllAPI void map_sdefn(
267  PlainMapSTypeDefn _map_sdefn);
268 
274  RTPS_DllAPI const PlainMapSTypeDefn& map_sdefn() const;
275 
281  RTPS_DllAPI PlainMapSTypeDefn& map_sdefn();
286  RTPS_DllAPI void map_ldefn(
287  PlainMapLTypeDefn _map_ldefn);
288 
294  RTPS_DllAPI const PlainMapLTypeDefn& map_ldefn() const;
295 
301  RTPS_DllAPI PlainMapLTypeDefn& map_ldefn();
306  RTPS_DllAPI void sc_component_id(
307  StronglyConnectedComponentId _sc_component_id);
308 
315 
326  RTPS_DllAPI void equivalence_hash(
327  EquivalenceHash _equivalence_hash);
328 
334  RTPS_DllAPI const octet* equivalence_hash() const;
335 
341  RTPS_DllAPI octet* equivalence_hash();
346  RTPS_DllAPI void extended_defn(
347  ExtendedTypeDefn _extended_defn);
348 
354  RTPS_DllAPI const ExtendedTypeDefn& extended_defn() const;
355 
362 
369  RTPS_DllAPI static size_t getCdrSerializedSize(
370  const TypeIdentifier& data,
371  size_t current_alignment = 0);
372 
373 
378  RTPS_DllAPI void serialize(
379  eprosima::fastcdr::Cdr& cdr) const;
380 
385  RTPS_DllAPI void deserialize(
386  eprosima::fastcdr::Cdr& cdr);
387 
392  const TypeIdentifier& other) const;
393 
394  RTPS_DllAPI bool consistent(
395  const TypeIdentifier& x,
396  const fastdds::dds::TypeConsistencyEnforcementQosPolicy& consistency) const;
397 
402  RTPS_DllAPI std::string equivalence_hash_to_string() const;
403 
404 private:
405 
406  octet m__d;
407 
408  StringSTypeDefn m_string_sdefn;
409  StringLTypeDefn m_string_ldefn;
410  PlainSequenceSElemDefn m_seq_sdefn;
411  PlainSequenceLElemDefn m_seq_ldefn;
412  PlainArraySElemDefn m_array_sdefn;
413  PlainArrayLElemDefn m_array_ldefn;
414  PlainMapSTypeDefn m_map_sdefn;
415  PlainMapLTypeDefn m_map_ldefn;
416  StronglyConnectedComponentId m_sc_component_id;
417  EquivalenceHash m_equivalence_hash;
418  ExtendedTypeDefn m_extended_defn;
419 };
420 
421 typedef std::vector<TypeIdentifier> TypeIdentifierSeq;
422 
423 } // namespace types
424 } // namespace fastrtps
425 } // namespace eprosima
426 
427 #endif // _TYPEIDENTIFIER_H_
This class represents the structure ExtendedTypeDefn defined by the user in the IDL file.
Definition: TypeIdentifierTypes.h:1735
This class represents the structure PlainArrayLElemDefn defined by the user in the IDL file.
Definition: TypeIdentifierTypes.h:936
This class represents the structure PlainArraySElemDefn defined by the user in the IDL file.
Definition: TypeIdentifierTypes.h:756
This class represents the structure PlainMapLTypeDefn defined by the user in the IDL file.
Definition: TypeIdentifierTypes.h:1339
This class represents the structure PlainMapSTypeDefn defined by the user in the IDL file.
Definition: TypeIdentifierTypes.h:1116
This class represents the structure PlainSequenceLElemDefn defined by the user in the IDL file.
Definition: TypeIdentifierTypes.h:586
This class represents the structure PlainSequenceSElemDefn defined by the user in the IDL file.
Definition: TypeIdentifierTypes.h:416
This class represents the structure StringLTypeDefn defined by the user in the IDL file.
Definition: TypeIdentifierTypes.h:170
This class represents the structure StringSTypeDefn defined by the user in the IDL file.
Definition: TypeIdentifierTypes.h:59
This class represents the structure StronglyConnectedComponentId defined by the user in the IDL file.
Definition: TypeIdentifierTypes.h:1562
Definition: TypeIdentifier.h:81
RTPS_DllAPI const PlainArrayLElemDefn & array_ldefn() const
This function returns the value of member array_ldefn.
RTPS_DllAPI void sc_component_id(StronglyConnectedComponentId _sc_component_id)
This function sets a value in member sc_component_id.
RTPS_DllAPI PlainSequenceSElemDefn & seq_sdefn()
This function returns a reference to member seq_sdefn.
RTPS_DllAPI const PlainSequenceLElemDefn & seq_ldefn() const
This function returns the value of member seq_ldefn.
RTPS_DllAPI void array_ldefn(PlainArrayLElemDefn _array_ldefn)
This function sets a value in member array_ldefn.
RTPS_DllAPI StringSTypeDefn & string_sdefn()
This function returns a reference to member string_sdefn.
RTPS_DllAPI TypeIdentifier()
Default constructor.
RTPS_DllAPI StronglyConnectedComponentId sc_component_id() const
This function returns the value of member sc_component_id.
RTPS_DllAPI void _d(octet __d)
This function sets the discriminator value.
bool operator==(const TypeIdentifier &other) const
Equals.
RTPS_DllAPI PlainSequenceLElemDefn & seq_ldefn()
This function returns a reference to member seq_ldefn.
RTPS_DllAPI PlainArraySElemDefn & array_sdefn()
This function returns a reference to member array_sdefn.
RTPS_DllAPI void map_sdefn(PlainMapSTypeDefn _map_sdefn)
This function sets a value in member map_sdefn.
RTPS_DllAPI const PlainArraySElemDefn & array_sdefn() const
This function returns the value of member array_sdefn.
RTPS_DllAPI const ExtendedTypeDefn & extended_defn() const
This function returns the value of member extended_defn.
RTPS_DllAPI void equivalence_hash(EquivalenceHash _equivalence_hash)
This function sets a value in member equivalence_hash.
RTPS_DllAPI ExtendedTypeDefn & extended_defn()
This function returns a reference to member extended_defn.
RTPS_DllAPI void seq_sdefn(PlainSequenceSElemDefn _seq_sdefn)
This function sets a value in member seq_sdefn.
RTPS_DllAPI StronglyConnectedComponentId & sc_component_id()
This function returns a reference to member sc_component_id.
RTPS_DllAPI void string_ldefn(StringLTypeDefn _string_ldefn)
This function sets a value in member string_ldefn.
RTPS_DllAPI void map_ldefn(PlainMapLTypeDefn _map_ldefn)
This function sets a value in member map_ldefn.
RTPS_DllAPI bool consistent(const TypeIdentifier &x, const fastdds::dds::TypeConsistencyEnforcementQosPolicy &consistency) const
RTPS_DllAPI PlainArrayLElemDefn & array_ldefn()
This function returns a reference to member array_ldefn.
RTPS_DllAPI const PlainSequenceSElemDefn & seq_sdefn() const
This function returns the value of member seq_sdefn.
RTPS_DllAPI void deserialize(eprosima::fastcdr::Cdr &cdr)
This function deserializes an object using CDR serialization.
RTPS_DllAPI const octet * equivalence_hash() const
This function returns the value of member equivalence_hash.
RTPS_DllAPI ~TypeIdentifier()
Default destructor.
RTPS_DllAPI PlainMapSTypeDefn & map_sdefn()
This function returns a reference to member map_sdefn.
RTPS_DllAPI void seq_ldefn(PlainSequenceLElemDefn _seq_ldefn)
This function sets a value in member seq_ldefn.
static RTPS_DllAPI size_t getCdrSerializedSize(const TypeIdentifier &data, size_t current_alignment=0)
This function returns the serialized size of a data depending on the buffer alignment.
RTPS_DllAPI void string_sdefn(StringSTypeDefn _string_sdefn)
This function sets a value in member string_sdefn.
RTPS_DllAPI StringLTypeDefn & string_ldefn()
This function returns a reference to member string_ldefn.
RTPS_DllAPI const PlainMapSTypeDefn & map_sdefn() const
This function returns the value of member map_sdefn.
RTPS_DllAPI void serialize(eprosima::fastcdr::Cdr &cdr) const
This function serializes an object using CDR serialization.
RTPS_DllAPI const StringSTypeDefn & string_sdefn() const
This function returns the value of member string_sdefn.
RTPS_DllAPI std::string equivalence_hash_to_string() const
equivalence_hash_to_string
RTPS_DllAPI PlainMapLTypeDefn & map_ldefn()
This function returns a reference to member map_ldefn.
RTPS_DllAPI const StringLTypeDefn & string_ldefn() const
This function returns the value of member string_ldefn.
RTPS_DllAPI TypeIdentifier(TypeIdentifier &&x)
Move constructor.
RTPS_DllAPI TypeIdentifier & operator=(TypeIdentifier &&x)
Move assignment.
RTPS_DllAPI void array_sdefn(PlainArraySElemDefn _array_sdefn)
This function sets a value in member array_sdefn.
RTPS_DllAPI octet _d() const
This function returns the value of the discriminator.
RTPS_DllAPI octet * equivalence_hash()
This function returns a reference to member equivalence_hash.
RTPS_DllAPI void extended_defn(ExtendedTypeDefn _extended_defn)
This function sets a value in member extended_defn.
RTPS_DllAPI octet & _d()
This function returns a reference to the discriminator.
RTPS_DllAPI const PlainMapLTypeDefn & map_ldefn() const
This function returns the value of member map_ldefn.
RTPS_DllAPI TypeIdentifier & operator=(const TypeIdentifier &x)
Copy assignment.
RTPS_DllAPI TypeIdentifier(const TypeIdentifier &x)
Copy constructor.
const octet TI_STRONGLY_CONNECTED_COMPONENT
Definition: TypeIdentifier.h:58
octet TypeIdentiferKind
Definition: TypeIdentifier.h:47
std::vector< TypeIdentifier > TypeIdentifierSeq
Definition: TypeIdentifier.h:421
const octet TI_PLAIN_SEQUENCE_SMALL
Definition: TypeIdentifier.h:52
const octet TI_STRING8_SMALL
Definition: TypeIdentifier.h:48
octet EquivalenceHash[14]
Definition: TypeObjectHashId.h:47
const octet TI_STRING16_LARGE
Definition: TypeIdentifier.h:51
const octet TI_STRING16_SMALL
Definition: TypeIdentifier.h:50
const octet TI_PLAIN_ARRAY_LARGE
Definition: TypeIdentifier.h:55
const octet TI_PLAIN_ARRAY_SMALL
Definition: TypeIdentifier.h:54
const octet TI_PLAIN_MAP_LARGE
Definition: TypeIdentifier.h:57
const octet TI_PLAIN_MAP_SMALL
Definition: TypeIdentifier.h:56
const octet TI_PLAIN_SEQUENCE_LARGE
Definition: TypeIdentifier.h:53
const octet TI_STRING8_LARGE
Definition: TypeIdentifier.h:49
fastdds::dds::TypeConsistencyEnforcementQosPolicy TypeConsistencyEnforcementQosPolicy
Definition: QosPolicies.h:95
eProsima namespace.
Definition: LibrarySettingsAttributes.h:23