/src/Fast-DDS/include/fastdds/rtps/messages/RTPSMessageSenderInterface.hpp
Line | Count | Source (jump to first uncovered line) |
1 | | // Copyright 2019 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 | | |
15 | | /** |
16 | | * @file RTPSMessageSenderInterface.hpp |
17 | | * |
18 | | */ |
19 | | |
20 | | #ifndef FASTDDS_RTPS_MESSAGES__RTPSMESSAGESENDERINTERFACE_HPP |
21 | | #define FASTDDS_RTPS_MESSAGES__RTPSMESSAGESENDERINTERFACE_HPP |
22 | | |
23 | | #ifndef DOXYGEN_SHOULD_SKIP_THIS_PUBLIC |
24 | | |
25 | | #include <chrono> |
26 | | #include <vector> |
27 | | |
28 | | #include <fastdds/rtps/common/Guid.hpp> |
29 | | #include <fastdds/rtps/transport/NetworkBuffer.hpp> |
30 | | |
31 | | namespace eprosima { |
32 | | namespace fastdds { |
33 | | namespace rtps { |
34 | | |
35 | | struct CDRMessage_t; |
36 | | |
37 | | /** |
38 | | * Interface to handle destinations management and message sending. |
39 | | */ |
40 | | class RTPSMessageSenderInterface |
41 | | { |
42 | | public: |
43 | | |
44 | 0 | virtual ~RTPSMessageSenderInterface() = default; |
45 | | |
46 | | /** |
47 | | * Check if the destinations managed by this sender interface have changed. |
48 | | * |
49 | | * @return true if destinations have changed, false otherwise. |
50 | | */ |
51 | | virtual bool destinations_have_changed() const = 0; |
52 | | |
53 | | /** |
54 | | * Get a GUID prefix representing all destinations. |
55 | | * |
56 | | * @return When all the destinations share the same prefix (i.e. belong to the same participant) |
57 | | * that prefix is returned. When there are no destinations, or they belong to different |
58 | | * participants, c_GuidPrefix_Unknown is returned. |
59 | | */ |
60 | | virtual GuidPrefix_t destination_guid_prefix() const = 0; |
61 | | |
62 | | /** |
63 | | * Get the GUID prefix of all the destination participants. |
64 | | * |
65 | | * @return a const reference to a vector with the GUID prefix of all destination participants. |
66 | | */ |
67 | | virtual const std::vector<GuidPrefix_t>& remote_participants() const = 0; |
68 | | |
69 | | /** |
70 | | * Get the GUID of all destinations. |
71 | | * |
72 | | * @return a const reference to a vector with the GUID of all destinations. |
73 | | */ |
74 | | virtual const std::vector<GUID_t>& remote_guids() const = 0; |
75 | | |
76 | | /** |
77 | | * Send a message through this interface. |
78 | | * |
79 | | * @param buffers Vector of NetworkBuffers to send with data already serialized. |
80 | | * @param total_bytes Total number of bytes to send. Should be equal to the sum of the @c size field of all buffers. |
81 | | * @param max_blocking_time_point Future timepoint where blocking send should end. |
82 | | */ |
83 | | virtual bool send( |
84 | | const std::vector<eprosima::fastdds::rtps::NetworkBuffer>& buffers, |
85 | | const uint32_t& total_bytes, |
86 | | std::chrono::steady_clock::time_point max_blocking_time_point) const = 0; |
87 | | |
88 | | /*! |
89 | | * Lock the object. |
90 | | */ |
91 | | virtual void lock() = 0; |
92 | | |
93 | | /*! |
94 | | * Lock the object. |
95 | | */ |
96 | | virtual void unlock() = 0; |
97 | | |
98 | | |
99 | | }; |
100 | | |
101 | | } // namespace rtps |
102 | | } // namespace fastdds |
103 | | } // namespace eprosima |
104 | | |
105 | | #endif // ifndef DOXYGEN_SHOULD_SKIP_THIS_PUBLIC |
106 | | |
107 | | #endif // FASTDDS_RTPS_MESSAGES__RTPSMESSAGESENDERINTERFACE_HPP |