Coverage Report

Created: 2022-08-24 06:19

/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 <fastdds/rtps/messages/CDRMessage.h>
26
#include <fastdds/rtps/common/Guid.h>
27
28
#include <vector>
29
30
namespace eprosima {
31
namespace fastrtps {
32
namespace rtps {
33
34
/**
35
 * An interface used in \ref RTPSMessageGroup to handle destinations management
36
 * and message sending.
37
 */
38
class RTPSMessageSenderInterface
39
{
40
public:
41
42
0
    virtual ~RTPSMessageSenderInterface() = default;
43
44
    /**
45
     * Check if the destinations managed by this sender interface have changed.
46
     *
47
     * @return true if destinations have changed, false otherwise.
48
     */
49
    virtual bool destinations_have_changed() const = 0;
50
51
    /**
52
     * Get a GUID prefix representing all destinations.
53
     *
54
     * @return When all the destinations share the same prefix (i.e. belong to the same participant)
55
     * that prefix is returned. When there are no destinations, or they belong to different
56
     * participants, c_GuidPrefix_Unknown is returned.
57
     */
58
    virtual GuidPrefix_t destination_guid_prefix() const = 0;
59
60
    /**
61
     * Get the GUID prefix of all the destination participants.
62
     *
63
     * @return a const reference to a vector with the GUID prefix of all destination participants.
64
     */
65
    virtual const std::vector<GuidPrefix_t>& remote_participants() const = 0;
66
67
    /**
68
     * Get the GUID of all destinations.
69
     *
70
     * @return a const reference to a vector with the GUID of all destinations.
71
     */
72
    virtual const std::vector<GUID_t>& remote_guids() const = 0;
73
74
    /**
75
     * Send a message through this interface.
76
     *
77
     * @param message Pointer to the buffer with the message already serialized.
78
     * @param max_blocking_time_point Future timepoint where blocking send should end.
79
     */
80
    virtual bool send(
81
            CDRMessage_t* message,
82
            std::chrono::steady_clock::time_point max_blocking_time_point) const = 0;
83
84
    /*!
85
     * Lock the object.
86
     */
87
    virtual void lock() = 0;
88
89
    /*!
90
     * Lock the object.
91
     */
92
    virtual void unlock() = 0;
93
94
95
};
96
97
} /* namespace rtps */
98
} /* namespace fastrtps */
99
} /* namespace eprosima */
100
101
#endif // ifndef DOXYGEN_SHOULD_SKIP_THIS_PUBLIC
102
103
#endif /* _FASTDDS_RTPS_MESSAGES_RTPSMESSAGESENDERINTERFACE_HPP_ */