Fast RTPS  Version 2.14.1
Fast RTPS
Loading...
Searching...
No Matches
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 <fastrtps/types/TypesBase.h>
19#include <fastdds/dds/topic/TopicDataType.hpp>
20#include <fastrtps/types/DynamicTypePtr.h>
21#include <fastrtps/types/DynamicDataPtr.h>
22#include <fastrtps/utils/md5.h>
23
24namespace eprosima {
25namespace fastrtps {
26namespace types {
27
28class DynamicPubSubType : public eprosima::fastdds::dds::TopicDataType
29{
30protected:
31
33
36 unsigned char* m_keyBuffer;
37
38 enum
39 {
43 }
44 extensibility_ {APPENDABLE};
45
46public:
47
48 RTPS_DllAPI DynamicPubSubType();
49
50 RTPS_DllAPI DynamicPubSubType(
51 DynamicType_ptr pDynamicType);
52
53 RTPS_DllAPI virtual ~DynamicPubSubType();
54
55 RTPS_DllAPI void* createData() override;
56
57 RTPS_DllAPI void deleteData (
58 void* data) override;
59
60 RTPS_DllAPI bool deserialize (
61 eprosima::fastrtps::rtps::SerializedPayload_t* payload,
62 void* data) override;
63
64 RTPS_DllAPI bool getKey(
65 void* data,
66 eprosima::fastrtps::rtps::InstanceHandle_t* ihandle,
67 bool force_md5 = false) override;
68
69 RTPS_DllAPI std::function<uint32_t()> getSerializedSizeProvider(
70 void* data) override
71 {
72 return getSerializedSizeProvider(data, fastdds::dds::DEFAULT_DATA_REPRESENTATION);
73 }
74
75 RTPS_DllAPI std::function<uint32_t()> getSerializedSizeProvider(
76 void* data,
77 fastdds::dds::DataRepresentationId_t data_representation) override;
78
79 RTPS_DllAPI bool serialize(
80 void* data,
81 eprosima::fastrtps::rtps::SerializedPayload_t* payload) override
82 {
83 return serialize(data, payload, fastdds::dds::DEFAULT_DATA_REPRESENTATION);
84 }
85
86 RTPS_DllAPI bool serialize(
87 void* data,
88 eprosima::fastrtps::rtps::SerializedPayload_t* payload,
89 fastdds::dds::DataRepresentationId_t data_representation) override;
90
91 RTPS_DllAPI void CleanDynamicType();
92
93 RTPS_DllAPI DynamicType_ptr GetDynamicType() const;
94
96 DynamicData_ptr pData);
97
99 DynamicType_ptr pType);
100};
101
102} // namespace types
103} // namespace fastrtps
104} // namespace eprosima
105
106#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 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 bool serialize(void *data, eprosima::fastrtps::rtps::SerializedPayload_t *payload) override
Definition DynamicPubSubType.h:79
RTPS_DllAPI std::function< uint32_t()> getSerializedSizeProvider(void *data, fastdds::dds::DataRepresentationId_t data_representation) override
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 void * createData() override
RTPS_DllAPI std::function< uint32_t()> getSerializedSizeProvider(void *data) override
Definition DynamicPubSubType.h:69
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
Definition DynamicTypePtr.h:27
This class represents the enumeration ReturnCode_t.
Definition TypesBase.h:190
eProsima namespace.
Definition LibrarySettingsAttributes.h:23