Fast DDS  Version 3.6.1.0
Fast DDS
Topic.hpp
1 // Copyright 2020 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 FASTDDS_DDS_TOPIC__TOPIC_HPP
20 #define FASTDDS_DDS_TOPIC__TOPIC_HPP
21 
22 #include <fastdds/fastdds_dll.hpp>
23 #include <fastdds/dds/core/Entity.hpp>
24 #include <fastdds/dds/core/ReturnCode.hpp>
25 #include <fastdds/dds/core/status/BaseStatus.hpp>
26 #include <fastdds/dds/topic/TopicDescription.hpp>
27 #include <fastdds/dds/topic/qos/TopicQos.hpp>
28 
29 namespace dds {
30 namespace topic {
31 
32 class Topic;
33 
34 } // namespace topic
35 } // namespace dds
36 
37 namespace eprosima {
38 namespace fastdds {
39 namespace dds {
40 
41 class DomainParticipant;
42 class TopicListener;
43 class DomainParticipantImpl;
44 class TopicProxy;
45 
52 class Topic : public DomainEntity, public TopicDescription
53 {
54  friend class TopicProxy;
55  friend class DomainParticipantImpl;
56 
61  Topic(
62  const std::string& topic_name,
63  const std::string& type_name,
64  TopicProxy* p,
65  const StatusMask& mask = StatusMask::all());
66 
67  Topic(
69  const std::string& topic_name,
70  const std::string& type_name,
71  const TopicQos& qos = TOPIC_QOS_DEFAULT,
72  TopicListener* listener = nullptr,
73  const StatusMask& mask = StatusMask::all());
74 
75 public:
76 
77  virtual ~Topic();
78 
84  virtual DomainParticipant* get_participant() const override;
85 
94  InconsistentTopicStatus& status);
95 
101  FASTDDS_EXPORTED_API const TopicQos& get_qos() const;
102 
109  FASTDDS_EXPORTED_API ReturnCode_t get_qos(
110  TopicQos& qos) const;
111 
121  FASTDDS_EXPORTED_API ReturnCode_t set_qos(
122  const TopicQos& qos);
123 
129  FASTDDS_EXPORTED_API const TopicListener* get_listener() const;
130 
138  FASTDDS_EXPORTED_API ReturnCode_t set_listener(
139  TopicListener* listener,
140  const StatusMask& mask = StatusMask::all());
141 
142  TopicDescriptionImpl* get_impl() const override;
143 
144 protected:
145 
147 
148  friend class ::dds::topic::Topic;
149 
150 };
151 
152 } // namespace dds
153 } // namespace fastdds
154 } // namespace eprosima
155 
156 #endif // FASTDDS_DDS_TOPIC__TOPIC_HPP
The DomainEntity class is a subclass of Entity created in order to differentiate between DomainPartic...
Definition: Entity.hpp:176
Class DomainParticipant used to group Publishers and Subscribers into a single working unit.
Definition: DomainParticipant.hpp:86
StatusMask is a bitmap or bitset field.
Definition: StatusMask.hpp:48
static StatusMask all()
Get all StatusMasks.
Definition: StatusMask.hpp:104
Class TopicDescription, represents the fact that both publications and subscriptions are tied to a si...
Definition: TopicDescription.hpp:38
Class Topic, represents the fact that both publications and subscriptions are tied to a single data-t...
Definition: Topic.hpp:53
FASTDDS_EXPORTED_API const TopicListener * get_listener() const
Retrieves the attached TopicListener.
friend class TopicProxy
Definition: Topic.hpp:54
FASTDDS_EXPORTED_API ReturnCode_t get_qos(TopicQos &qos) const
Retrieves the Topic Qos.
FASTDDS_EXPORTED_API ReturnCode_t get_inconsistent_topic_status(InconsistentTopicStatus &status)
Allows the application to retrieve the INCONSISTENT_TOPIC_STATUS status of a Topic.
virtual DomainParticipant * get_participant() const override
Getter for the DomainParticipant.
FASTDDS_EXPORTED_API ReturnCode_t set_qos(const TopicQos &qos)
Allows modifying the Topic Qos.
TopicDescriptionImpl * get_impl() const override
FASTDDS_EXPORTED_API ReturnCode_t set_listener(TopicListener *listener, const StatusMask &mask=StatusMask::all())
Modifies the TopicListener.
FASTDDS_EXPORTED_API const TopicQos & get_qos() const
Allows accessing the Topic Qos.
TopicProxy * impl_
Definition: Topic.hpp:146
friend class DomainParticipantImpl
Definition: Topic.hpp:55
Class TopicListener, it should be used by the end user to implement specific callbacks to certain act...
Definition: TopicListener.hpp:37
Class TopicQos, containing all the possible Qos that can be set for a determined Topic.
Definition: TopicQos.hpp:40
Definition: DomainParticipant.hpp:46
FASTDDS_EXPORTED_API const TopicQos TOPIC_QOS_DEFAULT
int32_t ReturnCode_t
Definition: DDSReturnCode.hpp:59
A struct storing the base status.
Definition: BaseStatus.hpp:30