| Fast DDS Version 3.3.0 Fast DDS

Loading...
Searching...
No Matches
Types.hpp
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
18
19#ifndef FASTDDS_RTPS_COMMON__TYPES_HPP
20#define FASTDDS_RTPS_COMMON__TYPES_HPP
21
22#include <cstdint>
23#include <iostream>
24#include <stddef.h>
25#include <stdint.h>
26
27#include <fastdds/fastdds_dll.hpp>
28
29#include <fastdds/rtps/common/ProductVersion_t.hpp>
30#include <fastdds/rtps/common/VendorId_t.hpp>
31
32 namespace eprosima {
33 namespace fastdds {
34 namespace rtps {
35
39 enum Endianness_t
40{
42 BIGEND = 0x1,
44 LITTLEEND = 0x0
45};
46
48 typedef enum ReliabilityKind_t
49{
50 RELIABLE,
51 BEST_EFFORT
52} ReliabilityKind_t;
53
55 typedef enum DurabilityKind_t
56{
57 VOLATILE,
58 TRANSIENT_LOCAL,
59 TRANSIENT,
60 PERSISTENT
61} DurabilityKind_t;
62
64 typedef enum EndpointKind_t
65{
66 READER,
67 WRITER
68} EndpointKind_t;
69
71 typedef enum TopicKind_t
72{
73 NO_KEY,
74 WITH_KEY
75} TopicKind_t;
76
77#if FASTDDS_IS_BIG_ENDIAN_TARGET
78 constexpr Endianness_t DEFAULT_ENDIAN = BIGEND;
79#else
80 constexpr Endianness_t DEFAULT_ENDIAN = LITTLEEND;
81#endif // if FASTDDS_IS_BIG_ENDIAN_TARGET
82
83 using octet = unsigned char;
84// typedef unsigned int uint;
85// typedef unsigned short ushort;
86 using SubmessageFlag = unsigned char;
87 using BuiltinEndpointSet_t = uint32_t;
88 using NetworkConfigSet_t = uint32_t;
89 using Count_t = uint32_t;
90
91#define BIT0 0x01u
92#define BIT1 0x02u
93#define BIT2 0x04u
94#define BIT3 0x08u
95#define BIT4 0x10u
96#define BIT5 0x20u
97#define BIT6 0x40u
98#define BIT7 0x80u
99
100#define BIT(i) (1U << static_cast<unsigned>(i))
101
103 struct FASTDDS_EXPORTED_API ProtocolVersion_t
104{
105 octet m_major;
106 octet m_minor;
107
108 ProtocolVersion_t()
109 :
110#if HAVE_SECURITY
111 // As imposed by DDSSEC11-93
112 ProtocolVersion_t(2, 3)
113#else
114 ProtocolVersion_t(2, 2)
115#endif // if HAVE_SECURITY
116 {
117 }
118
119 ProtocolVersion_t(
120 octet maj,
121 octet min)
122 : m_major(maj)
123 , m_minor(min)
124 {
125 }
126
127 bool operator ==(
128 const ProtocolVersion_t& v) const
129 {
130 return m_major == v.m_major && m_minor == v.m_minor;
131 }
132
133 bool operator !=(
134 const ProtocolVersion_t& v) const
135 {
136 return m_major != v.m_major || m_minor != v.m_minor;
137 }
138
139};
140
147 inline std::ostream& operator <<(
148 std::ostream& output,
149 const ProtocolVersion_t& pv)
150{
151 return output << static_cast<int>(pv.m_major) << "." << static_cast<int>(pv.m_minor);
152}
153
154 const ProtocolVersion_t c_ProtocolVersion_2_0{2, 0};
155 const ProtocolVersion_t c_ProtocolVersion_2_1{2, 1};
156 const ProtocolVersion_t c_ProtocolVersion_2_2{2, 2};
157 const ProtocolVersion_t c_ProtocolVersion_2_3{2, 3};
158
159 const ProtocolVersion_t c_ProtocolVersion;
160
161} // namespace rtps
162} // namespace fastdds
163} // namespace eprosima
164
165#endif // FASTDDS_RTPS_COMMON__TYPES_HPP
eprosima::fastdds::rtps
Contains the RTPS protocol implementation.
eprosima::fastdds::rtps::BuiltinEndpointSet_t
uint32_t BuiltinEndpointSet_t
Definition Types.hpp:87
eprosima::fastdds::rtps::operator<<
std::ostream & operator<<(std::ostream &output, BuiltinTransports transports)
Definition BuiltinTransports.hpp:118
eprosima::fastdds::rtps::Endianness_t
Endianness_t
This enumeration represents endianness types.
Definition Types.hpp:40
eprosima::fastdds::rtps::LITTLEEND
@ LITTLEEND
Little endianness.
Definition Types.hpp:44
eprosima::fastdds::rtps::BIGEND
@ BIGEND
Big endianness.
Definition Types.hpp:42
eprosima::fastdds::rtps::octet
unsigned char octet
Definition Types.hpp:83
eprosima::fastdds::rtps::ReliabilityKind_t
ReliabilityKind_t
Reliability enum used for internal purposes.
Definition Types.hpp:49
eprosima::fastdds::rtps::BEST_EFFORT
@ BEST_EFFORT
Definition Types.hpp:51
eprosima::fastdds::rtps::RELIABLE
@ RELIABLE
Definition Types.hpp:50
eprosima::fastdds::rtps::c_ProtocolVersion_2_3
const ProtocolVersion_t c_ProtocolVersion_2_3
Definition Types.hpp:157
eprosima::fastdds::rtps::Count_t
uint32_t Count_t
Definition Types.hpp:89
eprosima::fastdds::rtps::DEFAULT_ENDIAN
constexpr Endianness_t DEFAULT_ENDIAN
Definition Types.hpp:80
eprosima::fastdds::rtps::EndpointKind_t
EndpointKind_t
Endpoint kind.
Definition Types.hpp:65
eprosima::fastdds::rtps::WRITER
@ WRITER
Definition Types.hpp:67
eprosima::fastdds::rtps::READER
@ READER
Definition Types.hpp:66
eprosima::fastdds::rtps::c_ProtocolVersion
const ProtocolVersion_t c_ProtocolVersion
Definition Types.hpp:159
eprosima::fastdds::rtps::c_ProtocolVersion_2_0
const ProtocolVersion_t c_ProtocolVersion_2_0
Definition Types.hpp:154
eprosima::fastdds::rtps::c_ProtocolVersion_2_1
const ProtocolVersion_t c_ProtocolVersion_2_1
Definition Types.hpp:155
eprosima::fastdds::rtps::NetworkConfigSet_t
uint32_t NetworkConfigSet_t
Definition Types.hpp:88
eprosima::fastdds::rtps::SubmessageFlag
unsigned char SubmessageFlag
Definition Types.hpp:86
eprosima::fastdds::rtps::c_ProtocolVersion_2_2
const ProtocolVersion_t c_ProtocolVersion_2_2
Definition Types.hpp:156
eprosima::fastdds::rtps::TopicKind_t
TopicKind_t
Topic kind.
Definition Types.hpp:72
eprosima::fastdds::rtps::WITH_KEY
@ WITH_KEY
Definition Types.hpp:74
eprosima::fastdds::rtps::NO_KEY
@ NO_KEY
Definition Types.hpp:73
eprosima::fastdds::rtps::DurabilityKind_t
DurabilityKind_t
Durability kind.
Definition Types.hpp:56
eprosima::fastdds::rtps::TRANSIENT
@ TRANSIENT
Transient Durability.
Definition Types.hpp:59
eprosima::fastdds::rtps::TRANSIENT_LOCAL
@ TRANSIENT_LOCAL
Transient Local Durability.
Definition Types.hpp:58
eprosima::fastdds::rtps::PERSISTENT
@ PERSISTENT
NOT IMPLEMENTED.
Definition Types.hpp:60
eprosima::fastdds::rtps::VOLATILE
@ VOLATILE
Volatile Durability.
Definition Types.hpp:57
eprosima::fastdds
eprosima
eProsima namespace.
eprosima::fastdds::rtps::ProtocolVersion_t
Structure ProtocolVersion_t, contains the protocol version.
Definition Types.hpp:104
eprosima::fastdds::rtps::ProtocolVersion_t::m_major
octet m_major
Definition Types.hpp:105
eprosima::fastdds::rtps::ProtocolVersion_t::ProtocolVersion_t
ProtocolVersion_t()
Definition Types.hpp:108
eprosima::fastdds::rtps::ProtocolVersion_t::ProtocolVersion_t
ProtocolVersion_t(octet maj, octet min)
Definition Types.hpp:119
eprosima::fastdds::rtps::ProtocolVersion_t::m_minor
octet m_minor
Definition Types.hpp:106