Fast RTPS  Version 2.6.0
Fast RTPS
TypeObjectHashId.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 _TYPEOBJECTHASHID_H_
23 #define _TYPEOBJECTHASHID_H_
24 
25 #include <fastrtps/types/TypesBase.h>
26 #include <stdint.h>
27 #include <array>
28 #include <string>
29 #include <vector>
30 
31 namespace eprosima
32 {
33  namespace fastcdr
34  {
35  class Cdr;
36  }
37 }
38 
39 // The types in this file shall be serialized with XCDR encoding version 2
40 namespace eprosima {
41 namespace fastrtps {
42 
43 namespace types {
44 
45 // First 14 bytes of MD5 of the serialized TypeObject using XCDR
46 // version 2 with Little Endian encoding
47 typedef octet EquivalenceHash[14];
48 
54 {
55 public:
56 
61 
66 
72 
78 
84 
90 
96  void _d(uint8_t __d);
97 
102  uint8_t _d() const;
103 
108  uint8_t& _d();
109 
114  void hash(const EquivalenceHash &_hash);
115 
120  void hash(EquivalenceHash &&_hash);
121 
127  const EquivalenceHash& hash() const;
128 
135 
142  static size_t getCdrSerializedSize(const TypeObjectHashId& data, size_t current_alignment = 0);
143 
144 
149  void serialize(eprosima::fastcdr::Cdr &cdr) const;
150 
155  void deserialize(eprosima::fastcdr::Cdr &cdr);
156 
157 
158 
165  static size_t getKeyMaxCdrSerializedSize(size_t current_alignment = 0);
166 
170  static bool isKeyDefined();
171 
176  void serializeKey(eprosima::fastcdr::Cdr &cdr) const;
177 
178 private:
179  uint8_t m__d;
180 
181  EquivalenceHash m_hash;
182 };
183 
184 } // namespace types
185 } // namespace fastrtps
186 } // namespace eprosima
187 
188 #endif // _TYPEOBJECTHASHID_H_
void serializeKey(eprosima::fastcdr::Cdr &cdr) const
This function serializes the key members of an object using CDR serialization.
TypeObjectHashId & operator=(const TypeObjectHashId &x)
Copy assignment.
static size_t getCdrSerializedSize(const TypeObjectHashId &data, size_t current_alignment=0)
This function returns the serialized size of a data depending on the buffer alignment.
void deserialize(eprosima::fastcdr::Cdr &cdr)
This function deserializes an object using CDR serialization.
static bool isKeyDefined()
This function tells you if the Key has been defined for this type.
void serialize(eprosima::fastcdr::Cdr &cdr) const
This function serializes an object using CDR serialization.
eProsima namespace.
Definition: LibrarySettingsAttributes.h:23
octet EquivalenceHash[14]
Definition: TypeObjectHashId.h:47
uint8_t _d() const
This function returns the value of the discriminator.
static size_t getKeyMaxCdrSerializedSize(size_t current_alignment=0)
This function returns the maximum serialized size of the Key of an object depending on the buffer ali...
This class represents the union TypeObjectHashId defined by the user in the IDL file.
Definition: TypeObjectHashId.h:53
const EquivalenceHash & hash() const
This function returns a constant reference to member hash.