Fast RTPS  Version 2.14.1
Fast RTPS
Loading...
Searching...
No Matches
Domain.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
20#ifndef DOMAIN_H_
21#define DOMAIN_H_
22
23#include <fastdds/dds/topic/TopicDataType.hpp>
24#include <fastrtps/attributes/ParticipantAttributes.h>
25#include <mutex>
26
27#ifdef USE_DEPRECATION
28#if defined(__GNUC__) || defined(__clang__)
29#define DEPRECATED __attribute__ ((deprecated))
30#elif defined(_MSC_VER)
31#define DEPRECATED __declspec(deprecated)
32#else
33#define DEPRECATED
34#endif // if defined(__GNUC__) || defined(__clang__)
35#else
36#define DEPRECATED
37#endif // ifdef USE_DEPRECATION
38
39namespace eprosima {
40namespace fastrtps {
41
42class ParticipantListener;
43class Participant;
44class ParticipantImpl;
45class Publisher;
46class PublisherAttributes;
47class PublisherListener;
48class Subscriber;
49class SubscriberAttributes;
50class SubscriberListener;
51
52namespace types {
53class DynamicPubSubType;
54} // namespace types
55
60class Domain
61{
62public:
63
70 RTPS_DllAPI DEPRECATED static Participant* createParticipant(
71 const std::string& participant_profile,
72 ParticipantListener* listen = nullptr);
73
80 RTPS_DllAPI DEPRECATED static Participant* createParticipant(
81 const ParticipantAttributes& att,
82 ParticipantListener* listen = nullptr);
83
85 RTPS_DllAPI static void getDefaultParticipantAttributes(
86 ParticipantAttributes& participant_attributes);
87
95 RTPS_DllAPI static Publisher* createPublisher(
96 Participant* part,
97 const std::string& publisher_profile,
98 PublisherListener* listen = nullptr);
99
107 RTPS_DllAPI static Publisher* createPublisher(
108 Participant* part,
109 const PublisherAttributes& att,
110 PublisherListener* listen = nullptr);
111
113 RTPS_DllAPI static void getDefaultPublisherAttributes(
114 PublisherAttributes& publisher_attributes);
115
123 RTPS_DllAPI static Subscriber* createSubscriber(
124 Participant* part,
125 const std::string& subscriber_profile,
126 SubscriberListener* listen = nullptr);
127
135 RTPS_DllAPI static Subscriber* createSubscriber(
136 Participant* part,
137 const SubscriberAttributes& att,
138 SubscriberListener* listen = nullptr);
139
141 RTPS_DllAPI static void getDefaultSubscriberAttributes(
142 SubscriberAttributes& subscriber_attributes);
143
149 RTPS_DllAPI static bool removeParticipant(
150 Participant* part);
151
157 RTPS_DllAPI static bool removePublisher(
158 Publisher* pub);
159
165 RTPS_DllAPI static bool removeSubscriber(
166 Subscriber* sub);
167
175 RTPS_DllAPI static bool getRegisteredType(
176 Participant* part,
177 const char* typeName,
178 fastdds::dds::TopicDataType** type);
179
186 RTPS_DllAPI static bool registerType(
187 Participant* part,
188 fastdds::dds::TopicDataType* type);
189
196 RTPS_DllAPI static bool registerDynamicType(
197 Participant* part,
199
206 RTPS_DllAPI static bool unregisterType(
207 Participant* part,
208 const char* typeName);
209
213 RTPS_DllAPI static void stopAll();
214
220 RTPS_DllAPI static bool loadXMLProfilesFile(
221 const std::string& xml_profile_file);
222
229 RTPS_DllAPI static bool loadXMLProfilesString(
230 const char* data,
231 size_t length);
232
233private:
234
235 typedef std::pair<Participant*, ParticipantImpl*> t_p_Participant;
236
237 Domain();
238
239 virtual ~Domain();
240
241 static std::mutex m_mutex;
242
243 static std::vector<t_p_Participant> m_participants;
244
245 static bool default_xml_profiles_loaded;
246};
247
248} /* namespace */
249} /* namespace eprosima */
250
251#endif /* DOMAIN_H_ */
Class Domain, use to interact with the Publisher Subscriber API of the Fast RTPS implementation.
Definition Domain.h:61
static RTPS_DllAPI Publisher * createPublisher(Participant *part, const PublisherAttributes &att, PublisherListener *listen=nullptr)
Create a Publisher in a Participant.
static RTPS_DllAPI void getDefaultParticipantAttributes(ParticipantAttributes &participant_attributes)
Fills participant_attributes with the default values.
static RTPS_DllAPI bool removeParticipant(Participant *part)
Remove a Participant and all associated publishers and subscribers.
static RTPS_DllAPI bool removePublisher(Publisher *pub)
Remove a Publisher.
static RTPS_DllAPI void getDefaultPublisherAttributes(PublisherAttributes &publisher_attributes)
Fills publisher_attributes with the default values.
static RTPS_DllAPI bool registerType(Participant *part, fastdds::dds::TopicDataType *type)
Register a type in a participant.
static RTPS_DllAPI bool getRegisteredType(Participant *part, const char *typeName, fastdds::dds::TopicDataType **type)
Return a registered type.
static RTPS_DllAPI void getDefaultSubscriberAttributes(SubscriberAttributes &subscriber_attributes)
Fills subscriber_attributes with the default values.
static RTPS_DllAPI bool loadXMLProfilesString(const char *data, size_t length)
Load profiles from XML string.
RTPS_DllAPI static DEPRECATED Participant * createParticipant(const ParticipantAttributes &att, ParticipantListener *listen=nullptr)
Create a Participant.
RTPS_DllAPI static DEPRECATED Participant * createParticipant(const std::string &participant_profile, ParticipantListener *listen=nullptr)
Create a Participant from a profile name.
static RTPS_DllAPI bool loadXMLProfilesFile(const std::string &xml_profile_file)
Load profiles from XML file.
static RTPS_DllAPI bool removeSubscriber(Subscriber *sub)
Remove a Subscriber.
static RTPS_DllAPI void stopAll()
Stop and remove all participants, publishers and subscribers in this Domain.
static RTPS_DllAPI Subscriber * createSubscriber(Participant *part, const std::string &subscriber_profile, SubscriberListener *listen=nullptr)
Create a Subscriber in a Participant from a profile name.
static RTPS_DllAPI bool registerDynamicType(Participant *part, types::DynamicPubSubType *type)
Register a type in a participant.
static RTPS_DllAPI bool unregisterType(Participant *part, const char *typeName)
Unregister a type in a participant.
static RTPS_DllAPI Subscriber * createSubscriber(Participant *part, const SubscriberAttributes &att, SubscriberListener *listen=nullptr)
Create a Subscriber in a Participant.
static RTPS_DllAPI Publisher * createPublisher(Participant *part, const std::string &publisher_profile, PublisherListener *listen=nullptr)
Create a Publisher in a Participant from a profile name.
Class ParticipantAttributes, used by the user to define the attributes of a Participant.
Definition ParticipantAttributes.h:35
Class Participant used to group Publishers and Subscribers into a single working unit.
Definition Participant.h:47
Class ParticipantListener, overrides behaviour towards certain events.
Definition ParticipantListener.h:37
Class PublisherAttributes, used by the user to define the attributes of a Publisher.
Definition PublisherAttributes.h:41
Class Publisher, used to send data to associated subscribers.
Definition Publisher.h:47
Class PublisherListener, allows the end user to implement callbacks triggered by certain events.
Definition PublisherListener.h:37
Class SubscriberAttributes, used by the user to define the attributes of a Subscriber.
Definition SubscriberAttributes.h:39
Class Subscriber, contains the public API that allows the user to control the reception of messages.
Definition Subscriber.h:44
Class SubscriberListener, it should be used by the end user to implement specific callbacks to certai...
Definition SubscriberListener.h:41
Definition DynamicPubSubType.h:29
eProsima namespace.
Definition LibrarySettingsAttributes.h:23