Fast DDS  Version 3.6.1.0
Fast DDS
RTPSDomain.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 
19 #ifndef FASTDDS_RTPS__RTPSDOMAIN_HPP
20 #define FASTDDS_RTPS__RTPSDOMAIN_HPP
21 
22 #include <atomic>
23 #include <mutex>
24 #include <set>
25 
26 #include <fastdds/LibrarySettings.hpp>
27 #include <fastdds/rtps/attributes/RTPSParticipantAttributes.hpp>
28 #include <fastdds/rtps/attributes/ThreadSettings.hpp>
29 #include <fastdds/rtps/common/Types.hpp>
30 #include <fastdds/rtps/history/IPayloadPool.hpp>
31 #include <fastdds/rtps/history/IChangePool.hpp>
32 
33 namespace eprosima {
34 namespace fastdds {
35 namespace rtps {
36 
37 class RTPSParticipantImpl;
38 class RTPSParticipant;
39 class RTPSParticipantListener;
40 class RTPSWriter;
41 class WriterAttributes;
42 class WriterHistory;
43 class WriterListener;
44 class RTPSReader;
45 class ReaderAttributes;
46 class ReaderHistory;
47 class ReaderListener;
48 class RTPSDomainImpl;
49 
56 {
57 public:
58 
67  FASTDDS_EXPORTED_API static void set_filewatch_thread_config(
68  const fastdds::rtps::ThreadSettings& watch_thread,
69  const fastdds::rtps::ThreadSettings& callback_thread);
70 
79  FASTDDS_EXPORTED_API static void stopAll();
80 
91  FASTDDS_EXPORTED_API static RTPSParticipant* createParticipant(
92  uint32_t domain_id,
93  const RTPSParticipantAttributes& attrs,
94  RTPSParticipantListener* plisten = nullptr);
95 
107  FASTDDS_EXPORTED_API static RTPSParticipant* createParticipant(
108  uint32_t domain_id,
109  bool enabled,
110  const RTPSParticipantAttributes& attrs,
111  RTPSParticipantListener* plisten = nullptr);
112 
128  uint32_t domain_id,
129  bool enabled,
130  const RTPSParticipantAttributes& attrs,
131  RTPSParticipantListener* plisten = nullptr);
132 
146  FASTDDS_EXPORTED_API static RTPSWriter* createRTPSWriter(
147  RTPSParticipant* p,
148  WriterAttributes& watt,
149  WriterHistory* hist,
150  WriterListener* listen = nullptr);
151 
166  FASTDDS_EXPORTED_API static RTPSWriter* createRTPSWriter(
167  RTPSParticipant* p,
168  const EntityId_t& entity_id,
169  WriterAttributes& watt,
170  WriterHistory* hist,
171  WriterListener* listen = nullptr);
172 
178  FASTDDS_EXPORTED_API static bool removeRTPSWriter(
179  RTPSWriter* writer);
180 
192  FASTDDS_EXPORTED_API static RTPSReader* createRTPSReader(
193  RTPSParticipant* p,
194  ReaderAttributes& ratt,
195  ReaderHistory* hist,
196  ReaderListener* listen = nullptr);
197 
210  FASTDDS_EXPORTED_API static RTPSReader* createRTPSReader(
211  RTPSParticipant* p,
212  ReaderAttributes& ratt,
213  const std::shared_ptr<IPayloadPool>& payload_pool,
214  ReaderHistory* hist,
215  ReaderListener* listen = nullptr);
216 
230  FASTDDS_EXPORTED_API static RTPSReader* createRTPSReader(
231  RTPSParticipant* p,
232  const EntityId_t& entity_id,
233  ReaderAttributes& ratt,
234  const std::shared_ptr<IPayloadPool>& payload_pool,
235  ReaderHistory* hist,
236  ReaderListener* listen = nullptr);
237 
243  FASTDDS_EXPORTED_API static bool removeRTPSReader(
244  RTPSReader* reader);
245 
251  FASTDDS_EXPORTED_API static bool removeRTPSParticipant(
252  RTPSParticipant* p);
253 
260  FASTDDS_EXPORTED_API static bool get_library_settings(
261  fastdds::LibrarySettings& library_settings);
262 
270  FASTDDS_EXPORTED_API static bool set_library_settings(
271  const fastdds::LibrarySettings& library_settings);
272 
273 private:
274 
275  RTPSDomain() = delete;
276 
280  ~RTPSDomain() = delete;
281 };
282 
283 } // namespace rtps
284 } // namespace fastdds
285 } // namespace eprosima
286 
287 #endif // FASTDDS_RTPS__RTPSDOMAIN_HPP
Class LibraySettings, used by the user to define the Fast DDS library behaviour.
Definition: LibrarySettings.hpp:38
Class RTPSDomain,it manages the creation and destruction of RTPSParticipant RTPSWriter and RTPSReader...
Definition: RTPSDomain.hpp:56
static FASTDDS_EXPORTED_API RTPSReader * createRTPSReader(RTPSParticipant *p, ReaderAttributes &ratt, const std::shared_ptr< IPayloadPool > &payload_pool, ReaderHistory *hist, ReaderListener *listen=nullptr)
Create a RTPReader in a participant using a custom payload pool.
static RTPSParticipant * create_client_server_participant(uint32_t domain_id, bool enabled, const RTPSParticipantAttributes &attrs, RTPSParticipantListener *plisten=nullptr)
Create a RTPSParticipant as default server or client if ROS_MASTER_URI environment variable is set.
static FASTDDS_EXPORTED_API void stopAll()
Method to shut down all RTPSParticipants, readers, writers, etc.
static FASTDDS_EXPORTED_API void set_filewatch_thread_config(const fastdds::rtps::ThreadSettings &watch_thread, const fastdds::rtps::ThreadSettings &callback_thread)
Method to set the configuration of the threads created by the file watcher for the environment file.
static FASTDDS_EXPORTED_API bool set_library_settings(const fastdds::LibrarySettings &library_settings)
Set the library settings-.
static FASTDDS_EXPORTED_API RTPSWriter * createRTPSWriter(RTPSParticipant *p, const EntityId_t &entity_id, WriterAttributes &watt, WriterHistory *hist, WriterListener *listen=nullptr)
Create a RTPSWriter in a participant.
static FASTDDS_EXPORTED_API bool removeRTPSParticipant(RTPSParticipant *p)
Remove a RTPSParticipant and delete all its associated Writers, Readers, resources,...
static FASTDDS_EXPORTED_API bool get_library_settings(fastdds::LibrarySettings &library_settings)
Get the library settings.
static FASTDDS_EXPORTED_API bool removeRTPSReader(RTPSReader *reader)
Remove a RTPSReader.
static FASTDDS_EXPORTED_API RTPSReader * createRTPSReader(RTPSParticipant *p, ReaderAttributes &ratt, ReaderHistory *hist, ReaderListener *listen=nullptr)
Create a RTPSReader in a participant.
static FASTDDS_EXPORTED_API RTPSWriter * createRTPSWriter(RTPSParticipant *p, WriterAttributes &watt, WriterHistory *hist, WriterListener *listen=nullptr)
Create a RTPSWriter in a participant.
static FASTDDS_EXPORTED_API RTPSParticipant * createParticipant(uint32_t domain_id, bool enabled, const RTPSParticipantAttributes &attrs, RTPSParticipantListener *plisten=nullptr)
Create a RTPSParticipant.
static FASTDDS_EXPORTED_API bool removeRTPSWriter(RTPSWriter *writer)
Remove a RTPSWriter.
static FASTDDS_EXPORTED_API RTPSParticipant * createParticipant(uint32_t domain_id, const RTPSParticipantAttributes &attrs, RTPSParticipantListener *plisten=nullptr)
Create a RTPSParticipant.
static FASTDDS_EXPORTED_API RTPSReader * createRTPSReader(RTPSParticipant *p, const EntityId_t &entity_id, ReaderAttributes &ratt, const std::shared_ptr< IPayloadPool > &payload_pool, ReaderHistory *hist, ReaderListener *listen=nullptr)
Create a RTPSReader in a participant using a custom payload pool.
Class RTPSParticipantAttributes used to define different aspects of a RTPSParticipant.
Definition: RTPSParticipantAttributes.hpp:429
Class RTPSParticipant, contains the public API for a RTPSParticipant.
Definition: RTPSParticipant.hpp:77
Class RTPSParticipantListener with virtual method that the user can overload to respond to certain ev...
Definition: RTPSParticipantListener.hpp:40
Class RTPSReader, manages the reception of data from its matched writers.
Definition: RTPSReader.hpp:54
Class RTPSWriter, manages the sending of data to the readers.
Definition: RTPSWriter.hpp:62
Class ReaderAttributes, to define the attributes of a RTPSReader.
Definition: ReaderAttributes.hpp:59
Class ReaderHistory, container of the different CacheChanges of a reader.
Definition: ReaderHistory.hpp:39
Class ReaderListener, to be used by the user to override some of is virtual method to program actions...
Definition: ReaderListener.hpp:45
Class WriterAttributes, defining the attributes of a RTPSWriter.
Definition: WriterAttributes.hpp:76
Class WriterHistory, container of the different CacheChanges of a writer.
Definition: WriterHistory.hpp:47
Class WriterListener with virtual method so the user can implement callbacks to certain events.
Definition: WriterListener.hpp:40
Structure EntityId_t, entity id part of GUID_t.
Definition: EntityId_t.hpp:77
Struct ThreadSettings to specify various thread settings.
Definition: ThreadSettings.hpp:37