Fast RTPS  Version 2.14.1
Fast RTPS
Loading...
Searching...
No Matches
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
32namespace eprosima {
33
34namespace fastcdr {
35class Cdr;
36} // namespace fastcdr
37
38namespace fastdds {
39namespace dds {
41} // namespace dds
42} // namespace fastdds
43
44namespace fastrtps {
45namespace types {
46
47typedef octet TypeIdentiferKind;
48const octet TI_STRING8_SMALL = 0x70;
49const octet TI_STRING8_LARGE = 0x71;
50const octet TI_STRING16_SMALL = 0x72;
51const octet TI_STRING16_LARGE = 0x73;
52const octet TI_PLAIN_SEQUENCE_SMALL = 0x80;
53const octet TI_PLAIN_SEQUENCE_LARGE = 0x81;
54const octet TI_PLAIN_ARRAY_SMALL = 0x90;
55const octet TI_PLAIN_ARRAY_LARGE = 0x91;
56const octet TI_PLAIN_MAP_SMALL = 0xA0;
57const 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{
82public:
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
113 const TypeIdentifier& x);
114
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
286 RTPS_DllAPI void map_ldefn(
287 PlainMapLTypeDefn _map_ldefn);
288
294 RTPS_DllAPI const PlainMapLTypeDefn& map_ldefn() const;
295
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
363#ifndef DOXYGEN_SHOULD_SKIP_THIS
370 FASTDDS_SER_METHOD_DEPRECATED(3, "eprosima::fastrtps::types::TypeIdentifier::getCdrSerializedSize()",
371 "In favor of version using eprosima::fastcdr::calculate_serialized_size.")
372 RTPS_DllAPI static size_t getCdrSerializedSize(
373 const TypeIdentifier& data,
374 size_t current_alignment = 0);
375
380 FASTDDS_SER_METHOD_DEPRECATED(3, "eprosima::fastrtps::types::TypeIdentifier::serialize()",
381 "In favor of version using eprosima::fastcdr::serialize.")
382 RTPS_DllAPI void serialize(
383 eprosima::fastcdr::Cdr& cdr) const;
384
389 FASTDDS_SER_METHOD_DEPRECATED(3, "eprosima::fastrtps::types::TypeIdentifier::deserialize()",
390 "In favor of version using eprosima::fastcdr::deserialize.")
391 RTPS_DllAPI void deserialize(
392 eprosima::fastcdr::Cdr& cdr);
393#endif // DOXYGEN_SHOULD_SKIP_THIS
394
399 const TypeIdentifier& other) const;
400
401 RTPS_DllAPI bool consistent(
402 const TypeIdentifier& x,
403 const fastdds::dds::TypeConsistencyEnforcementQosPolicy& consistency) const;
404
409 RTPS_DllAPI std::string equivalence_hash_to_string() const;
410
411private:
412
413 octet m__d;
414
415 StringSTypeDefn m_string_sdefn;
416 StringLTypeDefn m_string_ldefn;
417 PlainSequenceSElemDefn m_seq_sdefn;
418 PlainSequenceLElemDefn m_seq_ldefn;
419 PlainArraySElemDefn m_array_sdefn;
420 PlainArrayLElemDefn m_array_ldefn;
421 PlainMapSTypeDefn m_map_sdefn;
422 PlainMapLTypeDefn m_map_ldefn;
423 StronglyConnectedComponentId m_sc_component_id;
424 EquivalenceHash m_equivalence_hash;
425 ExtendedTypeDefn m_extended_defn;
426};
427
428typedef std::vector<TypeIdentifier> TypeIdentifierSeq;
429
430} // namespace types
431} // namespace fastrtps
432} // namespace eprosima
433
434#endif // _TYPEIDENTIFIER_H_
This class represents the structure ExtendedTypeDefn defined by the user in the IDL file.
Definition TypeIdentifierTypes.h:1835
This class represents the structure PlainArrayLElemDefn defined by the user in the IDL file.
Definition TypeIdentifierTypes.h:992
This class represents the structure PlainArraySElemDefn defined by the user in the IDL file.
Definition TypeIdentifierTypes.h:802
This class represents the structure PlainMapLTypeDefn defined by the user in the IDL file.
Definition TypeIdentifierTypes.h:1417
This class represents the structure PlainMapSTypeDefn defined by the user in the IDL file.
Definition TypeIdentifierTypes.h:1182
This class represents the structure PlainSequenceLElemDefn defined by the user in the IDL file.
Definition TypeIdentifierTypes.h:622
This class represents the structure PlainSequenceSElemDefn defined by the user in the IDL file.
Definition TypeIdentifierTypes.h:442
This class represents the structure StringLTypeDefn defined by the user in the IDL file.
Definition TypeIdentifierTypes.h:179
This class represents the structure StringSTypeDefn defined by the user in the IDL file.
Definition TypeIdentifierTypes.h:60
This class represents the structure StronglyConnectedComponentId defined by the user in the IDL file.
Definition TypeIdentifierTypes.h:1652
Definition TypeIdentifier.h:81
RTPS_DllAPI void sc_component_id(StronglyConnectedComponentId _sc_component_id)
This function sets a value in member sc_component_id.
RTPS_DllAPI const PlainSequenceLElemDefn & seq_ldefn() const
This function returns the value of member seq_ldefn.
RTPS_DllAPI const PlainSequenceSElemDefn & seq_sdefn() const
This function returns the value of member seq_sdefn.
RTPS_DllAPI ExtendedTypeDefn & extended_defn()
This function returns a reference to member extended_defn.
RTPS_DllAPI void array_ldefn(PlainArrayLElemDefn _array_ldefn)
This function sets a value in member array_ldefn.
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 void map_sdefn(PlainMapSTypeDefn _map_sdefn)
This function sets a value in member map_sdefn.
RTPS_DllAPI void equivalence_hash(EquivalenceHash _equivalence_hash)
This function sets a value in member equivalence_hash.
RTPS_DllAPI void seq_sdefn(PlainSequenceSElemDefn _seq_sdefn)
This function sets a value in member seq_sdefn.
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 PlainMapLTypeDefn & map_ldefn()
This function returns a reference to member map_ldefn.
RTPS_DllAPI PlainArraySElemDefn & array_sdefn()
This function returns a reference to member array_sdefn.
RTPS_DllAPI StringLTypeDefn & string_ldefn()
This function returns a reference to member string_ldefn.
RTPS_DllAPI StronglyConnectedComponentId & sc_component_id()
This function returns a reference to member sc_component_id.
RTPS_DllAPI ~TypeIdentifier()
Default destructor.
RTPS_DllAPI PlainSequenceSElemDefn & seq_sdefn()
This function returns a reference to member seq_sdefn.
RTPS_DllAPI void seq_ldefn(PlainSequenceLElemDefn _seq_ldefn)
This function sets a value in member seq_ldefn.
RTPS_DllAPI void string_sdefn(StringSTypeDefn _string_sdefn)
This function sets a value in member string_sdefn.
RTPS_DllAPI const ExtendedTypeDefn & extended_defn() const
This function returns the value of member extended_defn.
RTPS_DllAPI octet & _d()
This function returns a reference to the discriminator.
RTPS_DllAPI const StringSTypeDefn & string_sdefn() const
This function returns the value of member string_sdefn.
RTPS_DllAPI const PlainMapLTypeDefn & map_ldefn() const
This function returns the value of member map_ldefn.
RTPS_DllAPI const PlainArrayLElemDefn & array_ldefn() const
This function returns the value of member array_ldefn.
RTPS_DllAPI const PlainMapSTypeDefn & map_sdefn() const
This function returns the value of member map_sdefn.
RTPS_DllAPI const octet * equivalence_hash() const
This function returns the value of member equivalence_hash.
RTPS_DllAPI std::string equivalence_hash_to_string() const
equivalence_hash_to_string
RTPS_DllAPI const PlainArraySElemDefn & array_sdefn() const
This function returns the value of member array_sdefn.
RTPS_DllAPI TypeIdentifier(TypeIdentifier &&x)
Move constructor.
RTPS_DllAPI TypeIdentifier & operator=(const TypeIdentifier &x)
Copy assignment.
RTPS_DllAPI PlainArrayLElemDefn & array_ldefn()
This function returns a reference to member array_ldefn.
RTPS_DllAPI PlainSequenceLElemDefn & seq_ldefn()
This function returns a reference to member seq_ldefn.
RTPS_DllAPI octet * equivalence_hash()
This function returns a reference to member equivalence_hash.
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 PlainMapSTypeDefn & map_sdefn()
This function returns a reference to member map_sdefn.
RTPS_DllAPI StringSTypeDefn & string_sdefn()
This function returns a reference to member string_sdefn.
RTPS_DllAPI void extended_defn(ExtendedTypeDefn _extended_defn)
This function sets a value in member extended_defn.
RTPS_DllAPI TypeIdentifier(const TypeIdentifier &x)
Copy constructor.
RTPS_DllAPI const StringLTypeDefn & string_ldefn() const
This function returns the value of member string_ldefn.
const octet TI_STRONGLY_CONNECTED_COMPONENT
Definition TypeIdentifier.h:58
octet TypeIdentiferKind
Definition TypeIdentifier.h:47
std::vector< TypeIdentifier > TypeIdentifierSeq
Definition TypeIdentifier.h:428
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:45
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