Fast RTPS  Version 2.10.6
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 public:
39 
40  typedef DynamicData type;
41 
42  RTPS_DllAPI DynamicPubSubType();
43 
44  RTPS_DllAPI DynamicPubSubType(
45  DynamicType_ptr pDynamicType);
46 
47  RTPS_DllAPI virtual ~DynamicPubSubType();
48 
49  RTPS_DllAPI void* createData() override;
50 
51  RTPS_DllAPI void deleteData (
52  void* data) override;
53 
54  RTPS_DllAPI bool deserialize (
55  eprosima::fastrtps::rtps::SerializedPayload_t* payload,
56  void* data) override;
57 
58  RTPS_DllAPI bool getKey(
59  void* data,
60  eprosima::fastrtps::rtps::InstanceHandle_t* ihandle,
61  bool force_md5 = false) override;
62 
63  RTPS_DllAPI std::function<uint32_t()> getSerializedSizeProvider(
64  void* data) override;
65 
66  RTPS_DllAPI bool serialize(
67  void* data,
68  eprosima::fastrtps::rtps::SerializedPayload_t* payload) override;
69 
70  RTPS_DllAPI void CleanDynamicType();
71 
72  RTPS_DllAPI DynamicType_ptr GetDynamicType() const;
73 
75  DynamicData_ptr pData);
76 
78  DynamicType_ptr pType);
79 };
80 
81 } // namespace types
82 } // namespace fastrtps
83 } // namespace eprosima
84 
85 #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
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
DynamicType_ptr dynamic_type_
Definition: DynamicPubSubType.h:34
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
DynamicData type
Definition: DynamicPubSubType.h:40
RTPS_DllAPI ReturnCode_t SetDynamicType(DynamicType_ptr pType)
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: DynamicTypePtr.h:27
This class represents the enumeration ReturnCode_t.
Definition: TypesBase.h:189
eProsima namespace.
Definition: LibrarySettingsAttributes.h:23