Fast RTPS  Version 2.5.0
Fast RTPS
TopicAttributes.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 
19 #ifndef TOPICPARAMETERS_H_
20 #define TOPICPARAMETERS_H_
21 
22 #include <string>
23 
24 #include <fastdds/rtps/common/Types.h>
25 #include <fastrtps/qos/QosPolicies.h>
26 
27 
28 namespace eprosima {
29 namespace fastrtps{
30 
36 {
37 public:
38 
43  : topicKind(rtps::NO_KEY)
44  , topicName("UNDEF")
45  , topicDataType("UNDEF")
46  , auto_fill_type_object(true)
48  {
49  }
50 
53  const char* name,
54  const char* dataType,
55  rtps::TopicKind_t tKind= rtps::NO_KEY)
56  {
57  topicKind = tKind;
58  topicName = name;
59  topicDataType = dataType;
60  auto_fill_type_object = true;
62  }
63 
64  virtual ~TopicAttributes() {}
65 
66  bool operator==(const TopicAttributes& b) const
67  {
68  return (this->topicKind == b.topicKind) &&
69  (this->topicName == b.topicName) &&
70  (this->topicDataType == b.topicDataType) &&
71  (this->historyQos == b.historyQos);
72  }
73 
78  const string_255& getTopicDataType() const {
79  return topicDataType;
80  }
81 
86  rtps::TopicKind_t getTopicKind() const {
87  return topicKind;
88  }
89 
94  const string_255& getTopicName() const {
95  return topicName;
96  }
97 
99  rtps::TopicKind_t topicKind;
118 
123  bool checkQos() const;
124 };
125 
126 #ifndef DOXYGEN_SHOULD_SKIP_THIS_PUBLIC
127 
134 bool inline operator!=(const TopicAttributes& t1, const TopicAttributes& t2)
135 {
136  if(t1.topicKind != t2.topicKind
137  || t1.topicName != t2.topicName
138  || t1.topicDataType != t2.topicDataType
139  || t1.historyQos.kind != t2.historyQos.kind
140  || (t1.historyQos.kind == KEEP_LAST_HISTORY_QOS && t1.historyQos.depth != t2.historyQos.depth))
141  {
142  return true;
143  }
144  return false;
145 }
146 #endif
147 
148 } /* namespace fastrtps */
149 } /* namespace eprosima */
150 
151 #endif /* TOPICPARAMETERS_H_ */
Class TopicAttributes, used by the user to define the attributes of the topic associated with a Publi...
Definition: TopicAttributes.h:36
TopicAttributes()
Default constructor.
Definition: TopicAttributes.h:42
TypeObjectV1 type
Type Object XTYPES 1.1.
Definition: TopicAttributes.h:111
HistoryQosPolicy historyQos
QOS Regarding the History to be saved.
Definition: TopicAttributes.h:105
virtual ~TopicAttributes()
Definition: TopicAttributes.h:64
TypeIdV1 type_id
Type Identifier XTYPES 1.1.
Definition: TopicAttributes.h:109
bool auto_fill_type_object
Tries to complete type identifier and type object (TypeObjectV1)
Definition: TopicAttributes.h:115
const string_255 & getTopicName() const
Get the topic name.
Definition: TopicAttributes.h:94
bool auto_fill_type_information
Tries to complete type information (TypeObjectV2)
Definition: TopicAttributes.h:117
string_255 topicName
Topic Name.
Definition: TopicAttributes.h:101
const string_255 & getTopicDataType() const
Get the topic data type.
Definition: TopicAttributes.h:78
xtypes::TypeInformation type_information
XTYPES 1.2.
Definition: TopicAttributes.h:113
TopicAttributes(const char *name, const char *dataType, rtps::TopicKind_t tKind=rtps::NO_KEY)
Constructor, you need to provide the topic name and the topic data type.
Definition: TopicAttributes.h:52
rtps::TopicKind_t topicKind
TopicKind_t, default value NO_KEY.
Definition: TopicAttributes.h:99
bool checkQos() const
Method to check whether the defined QOS are correct.
string_255 topicDataType
Topic Data Type.
Definition: TopicAttributes.h:103
ResourceLimitsQosPolicy resourceLimitsQos
QOS Regarding the resources to allocate.
Definition: TopicAttributes.h:107
rtps::TopicKind_t getTopicKind() const
Get the topic kind.
Definition: TopicAttributes.h:86
bool operator==(const TopicAttributes &b) const
Definition: TopicAttributes.h:66
fastdds::dds::xtypes::TypeInformation TypeInformation
Definition: QosPolicies.h:106
constexpr HistoryQosPolicyKind KEEP_LAST_HISTORY_QOS
Definition: QosPolicies.h:78
fastdds::dds::TypeObjectV1 TypeObjectV1
Definition: QosPolicies.h:103
fastdds::dds::TypeIdV1 TypeIdV1
Definition: QosPolicies.h:102
fastdds::dds::ResourceLimitsQosPolicy ResourceLimitsQosPolicy
Definition: QosPolicies.h:81
bool operator!=(const TopicAttributes &t1, const TopicAttributes &t2)
Check if two topic attributes are not equal.
Definition: TopicAttributes.h:134
fastdds::dds::HistoryQosPolicy HistoryQosPolicy
Definition: QosPolicies.h:80
eProsima namespace.
Definition: LibrarySettingsAttributes.h:23