Fast RTPS  Version 2.14.5
Fast RTPS
DynamicPubSubType.h
1 // Copyright 2018 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 
15 #ifndef TYPES_DYNAMIC_PUB_SUB_TYPE_H
16 #define TYPES_DYNAMIC_PUB_SUB_TYPE_H
17 
18 #include <fastdds/dds/topic/TopicDataType.hpp>
19 #include <fastrtps/types/DynamicData.h>
20 #include <fastrtps/types/DynamicTypePtr.h>
21 #include <fastrtps/types/TypesBase.h>
22 #include <fastrtps/utils/md5.h>
23 
24 namespace eprosima {
25 namespace fastrtps {
26 namespace types {
27 
28 class DynamicPubSubType : public eprosima::fastdds::dds::TopicDataType
29 {
30 protected:
31 
33 
36  unsigned char* m_keyBuffer;
37 
38  enum
39  {
42  MUTABLE
43  }
44  extensibility_ {APPENDABLE};
45 
46 public:
47 
48  typedef DynamicData type;
49 
50  RTPS_DllAPI DynamicPubSubType();
51 
52  RTPS_DllAPI DynamicPubSubType(
53  DynamicType_ptr pDynamicType);
54 
55  RTPS_DllAPI virtual ~DynamicPubSubType();
56 
57  RTPS_DllAPI void* createData() override;
58 
59  RTPS_DllAPI void deleteData (
60  void* data) override;
61 
62  RTPS_DllAPI bool deserialize (
63  eprosima::fastrtps::rtps::SerializedPayload_t* payload,
64  void* data) override;
65 
66  RTPS_DllAPI bool getKey(
67  void* data,
68  eprosima::fastrtps::rtps::InstanceHandle_t* ihandle,
69  bool force_md5 = false) override;
70 
71  RTPS_DllAPI std::function<uint32_t()> getSerializedSizeProvider(
72  void* data) override
73  {
74  return getSerializedSizeProvider(data, fastdds::dds::DEFAULT_DATA_REPRESENTATION);
75  }
76 
77  RTPS_DllAPI std::function<uint32_t()> getSerializedSizeProvider(
78  void* data,
79  fastdds::dds::DataRepresentationId_t data_representation) override;
80 
81  RTPS_DllAPI bool serialize(
82  void* data,
83  eprosima::fastrtps::rtps::SerializedPayload_t* payload) override
84  {
85  return serialize(data, payload, fastdds::dds::DEFAULT_DATA_REPRESENTATION);
86  }
87 
88  RTPS_DllAPI bool serialize(
89  void* data,
90  eprosima::fastrtps::rtps::SerializedPayload_t* payload,
91  fastdds::dds::DataRepresentationId_t data_representation) override;
92 
93  RTPS_DllAPI void CleanDynamicType();
94 
95  RTPS_DllAPI DynamicType_ptr GetDynamicType() const;
96 
98  DynamicData_ptr pData);
99 
101  DynamicType_ptr pType);
102 };
103 
104 } // namespace types
105 } // namespace fastrtps
106 } // namespace eprosima
107 
108 #endif // TYPES_DYNAMIC_PUB_SUB_TYPE_H
Class MD5, for calculating MD5 hashes of strings or byte arrays it is not meant to be fast or secure.
Definition: md5.h:55
Definition: DynamicDataPtr.h:27
Definition: DynamicData.h:44
Definition: DynamicPubSubType.h:29
@ MUTABLE
Definition: DynamicPubSubType.h:42
@ APPENDABLE
Definition: DynamicPubSubType.h:41
@ FINAL
Definition: DynamicPubSubType.h:40
RTPS_DllAPI DynamicPubSubType(DynamicType_ptr pDynamicType)
RTPS_DllAPI void deleteData(void *data) override
RTPS_DllAPI void * createData() override
RTPS_DllAPI bool serialize(void *data, eprosima::fastrtps::rtps::SerializedPayload_t *payload) override
Definition: DynamicPubSubType.h:81
DynamicType_ptr dynamic_type_
Definition: DynamicPubSubType.h:34
RTPS_DllAPI bool serialize(void *data, eprosima::fastrtps::rtps::SerializedPayload_t *payload, fastdds::dds::DataRepresentationId_t data_representation) override
RTPS_DllAPI DynamicType_ptr GetDynamicType() const
RTPS_DllAPI ReturnCode_t SetDynamicType(DynamicData_ptr pData)
RTPS_DllAPI bool deserialize(eprosima::fastrtps::rtps::SerializedPayload_t *payload, void *data) override
RTPS_DllAPI bool getKey(void *data, eprosima::fastrtps::rtps::InstanceHandle_t *ihandle, bool force_md5=false) override
RTPS_DllAPI std::function< uint32_t()> getSerializedSizeProvider(void *data, fastdds::dds::DataRepresentationId_t data_representation) override
DynamicData type
Definition: DynamicPubSubType.h:48
RTPS_DllAPI ReturnCode_t SetDynamicType(DynamicType_ptr pType)
enum eprosima::fastrtps::types::DynamicPubSubType::@0 APPENDABLE
MD5 m_md5
Definition: DynamicPubSubType.h:35
unsigned char * m_keyBuffer
Definition: DynamicPubSubType.h:36
RTPS_DllAPI std::function< uint32_t()> getSerializedSizeProvider(void *data) override
Definition: DynamicPubSubType.h:71
Definition: DynamicTypePtr.h:27
This class represents the enumeration ReturnCode_t.
Definition: TypesBase.h:190
eProsima namespace.
Definition: LibrarySettingsAttributes.h:23