RTC Toolkit  1.0.0
ddsCommon.hpp
Go to the documentation of this file.
1 
11 #ifndef RTCTK_COMPONENTFRAMEWORK_DATAPATH_DDS_COMMON_HPP_
12 #define RTCTK_COMPONENTFRAMEWORK_DATAPATH_DDS_COMMON_HPP_
13 
24 #ifdef USE_RTI_DDS
25 #pragma GCC diagnostic push
26 #pragma GCC diagnostic ignored "-Wregister"
27 
28 #include "agnostictopicif.h"
29 #include "agnostictopicifSupport.h"
30 
31 #include <ndds/ndds_cpp.h>
32 #include <ndds/ndds_namespace_cpp.h>
33 
34 #pragma GCC diagnostic pop
35 using namespace DDS;
36 
37 namespace rtctk::componentFramework {
38 using TypedDataWriter = rtctk::AgnosticTopic::DataWriter;
39 using TypedDataReader = rtctk::AgnosticTopic::DataReader;
40 } // namespace rtctk::componentFramework
41 
42 #else
43 //#include "rtctk/fastdds/agnostictopicif.h"
45 
46 #include <fastdds/dds/publisher/DataWriter.hpp>
47 #include <fastdds/dds/publisher/Publisher.hpp>
48 #include <fastdds/dds/publisher/PublisherListener.hpp>
49 
50 #include <fastdds/dds/subscriber/DataReader.hpp>
51 #include <fastdds/dds/subscriber/DataReaderListener.hpp>
52 #include <fastdds/dds/subscriber/Subscriber.hpp>
53 #include <fastdds/dds/subscriber/SubscriberListener.hpp>
54 
55 #include <fastdds/dds/core/LoanableSequence.hpp>
56 #include <fastdds/dds/domain/DomainParticipant.hpp>
57 #include <fastdds/dds/domain/DomainParticipantFactory.hpp>
58 #include <fastrtps/types/TypesBase.h>
59 
60 #include <fastdds/dds/core/condition/WaitSet.hpp>
61 #include <fastdds/dds/core/status/StatusMask.hpp>
62 
63 #include <fastdds/dds/domain/qos/DomainParticipantFactoryQos.hpp>
64 
65 #include <fastdds/rtps/transport/UDPv4TransportDescriptor.h>
66 
67 // using namespace eprosima::fastrtps;
68 using namespace eprosima::fastdds::dds;
69 using namespace eprosima::fastrtps::types;
70 
71 using eprosima::fastrtps::Duration_t;
72 
75 
76 #define STATUS_MASK_NONE StatusMask::none()
77 #define STATUS_MASK_ALL StatusMask::all()
78 #define DATA_AVAILABLE_STATUS StatusMask::data_available()
79 
80 #define RETCODE_OK ReturnCode_t::RETCODE_OK
81 
82 #define DDS_HANDLE_NIL eprosima::fastrtps::rtps::c_InstanceHandle_Unknown
83 #define DDS_RETCODE_TIMEOUT ReturnCode_t::RETCODE_TIMEOUT
84 #define RETCODE_NO_DATA ReturnCode_t::RETCODE_NO_DATA
85 #define DDS_RETCODE_OK ReturnCode_t::RETCODE_OK
86 
87 namespace rtctk::componentFramework {
88 using TypedDataWriter = eprosima::fastdds::dds::DataWriter;
89 using TypedDataReader = eprosima::fastdds::dds::DataReader;
90 } // namespace rtctk::componentFramework
91 using DDS_Long = long;
92 using DDS_UnsignedLong = unsigned long;
93 
94 namespace rtctk {
95 FASTDDS_SEQUENCE(AgnosticTopicSeq, AgnosticTopic);
96 }
97 
98 FASTDDS_SEQUENCE(SampleInfoSeq, SampleInfo);
99 
100 #endif
101 
102 namespace rtctk::componentFramework {
103 std::string RetcodeToString(ReturnCode_t retcode);
104 
105 const char* GetTopicName(DataWriter* writer);
106 const char* GetTopicName(DataReader* reader);
107 } // namespace rtctk::componentFramework
108 
109 #endif //#ifndef RTCTK_COMPONENTFRAMEWORK_DATAPATH_DDS_COMMON_HPP_
rtctk::componentFramework::TypedDataWriter
eprosima::fastdds::dds::DataWriter TypedDataWriter
Definition: ddsCommon.hpp:88
rtctk::componentFramework::RetcodeToString
std::string RetcodeToString(ReturnCode_t retcode)
Definition: ddsCommon.cpp:16
agnostictopicif.h
rtctk::componentFramework
Definition: commandReplier.cpp:20
FASTDDS_SEQUENCE
FASTDDS_SEQUENCE(SampleInfoSeq, SampleInfo)
rtctk::componentFramework::TypedDataReader
eprosima::fastdds::dds::DataReader TypedDataReader
Definition: ddsCommon.hpp:89
agnostictopicifPubSubTypes.h
rtctk::AgnosticTopic
This class represents the structure AgnosticTopic defined by the user in the IDL file.
Definition: agnostictopicif.h:72
DDS_Long
long DDS_Long
Definition: ddsCommon.hpp:91
DDS_UnsignedLong
unsigned long DDS_UnsignedLong
Definition: ddsCommon.hpp:92
rtctk
Definition: agnostictopicifPubSubTypes.cpp:31
rtctk::componentFramework::GetTopicName
const char * GetTopicName(DataWriter *writer)
Definition: ddsCommon.cpp:24