123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202 |
- #ifndef _FASTDDS_RTPS_DOMAIN_H_
- #define _FASTDDS_RTPS_DOMAIN_H_
- #include <fastdds/rtps/common/Types.h>
- #include <fastdds/rtps/attributes/RTPSParticipantAttributes.h>
- #include <atomic>
- #include <mutex>
- #include <set>
- namespace eprosima {
- namespace fastrtps {
- namespace rtps {
- class RTPSParticipantImpl;
- class RTPSParticipant;
- class RTPSParticipantListener;
- class RTPSWriter;
- class WriterAttributes;
- class WriterHistory;
- class WriterListener;
- class RTPSReader;
- class ReaderAttributes;
- class ReaderHistory;
- class ReaderListener;
- class RTPSDomainImpl;
- class RTPSDomain
- {
- friend class RTPSDomainImpl;
- public:
-
- RTPS_DllAPI static void stopAll();
-
- RTPS_DllAPI static RTPSParticipant* createParticipant(
- uint32_t domain_id,
- const RTPSParticipantAttributes& attrs,
- RTPSParticipantListener* plisten = nullptr);
-
- RTPS_DllAPI static RTPSParticipant* createParticipant(
- uint32_t domain_id,
- bool enabled,
- const RTPSParticipantAttributes& attrs,
- RTPSParticipantListener* plisten = nullptr);
-
- RTPS_DllAPI static RTPSWriter* createRTPSWriter(
- RTPSParticipant* p,
- WriterAttributes& watt,
- WriterHistory* hist,
- WriterListener* listen = nullptr);
-
- RTPS_DllAPI static bool removeRTPSWriter(
- RTPSWriter* writer);
-
- RTPS_DllAPI static RTPSReader* createRTPSReader(
- RTPSParticipant* p,
- ReaderAttributes& ratt,
- ReaderHistory* hist,
- ReaderListener* listen = nullptr);
-
- RTPS_DllAPI static bool removeRTPSReader(
- RTPSReader* reader);
-
- RTPS_DllAPI static bool removeRTPSParticipant(
- RTPSParticipant* p);
-
- static inline void setMaxRTPSParticipantId(
- uint32_t maxRTPSParticipantId)
- {
- m_maxRTPSParticipantID = maxRTPSParticipantId;
- }
-
- static RTPSParticipant* clientServerEnvironmentCreationOverride(
- uint32_t domain_id,
- const RTPSParticipantAttributes& attrs,
- RTPSParticipantListener* listen );
- private:
- typedef std::pair<RTPSParticipant*, RTPSParticipantImpl*> t_p_RTPSParticipant;
- RTPSDomain() = delete;
-
- ~RTPSDomain() = delete;
-
- static inline uint32_t getNewId()
- {
- return m_maxRTPSParticipantID++;
- }
- static void removeRTPSParticipant_nts(
- t_p_RTPSParticipant&);
- static std::mutex m_mutex;
- static std::atomic<uint32_t> m_maxRTPSParticipantID;
- static std::vector<t_p_RTPSParticipant> m_RTPSParticipants;
- static std::set<uint32_t> m_RTPSParticipantIDs;
- };
- }
- }
- }
- #endif
|