Coverage Report

Created: 2025-06-13 06:46

/src/Fast-DDS/include/fastdds/rtps/attributes/WriterAttributes.hpp
Line
Count
Source (jump to first uncovered line)
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
15
/**
16
 * @file WriterAttributes.hpp
17
 *
18
 */
19
#ifndef FASTDDS_RTPS_ATTRIBUTES__WRITERATTRIBUTES_HPP
20
#define FASTDDS_RTPS_ATTRIBUTES__WRITERATTRIBUTES_HPP
21
22
#include <functional>
23
24
#include <fastdds/dds/core/policy/QosPolicies.hpp>
25
#include <fastdds/rtps/attributes/EndpointAttributes.hpp>
26
#include <fastdds/rtps/common/Guid.hpp>
27
#include <fastdds/rtps/common/Time_t.hpp>
28
#include <fastdds/rtps/flowcontrol/FlowControllerConsts.hpp>
29
#include <fastdds/utils/collections/ResourceLimitedContainerConfig.hpp>
30
31
namespace eprosima {
32
namespace fastdds {
33
namespace rtps {
34
35
typedef enum RTPSWriterPublishMode : octet
36
{
37
    SYNCHRONOUS_WRITER,
38
    ASYNCHRONOUS_WRITER
39
} RTPSWriterPublishMode;
40
41
42
/**
43
 * Struct WriterTimes, defining the times associated with the Reliable Writers events.
44
 * @ingroup RTPS_ATTRIBUTES_MODULE
45
 */
46
struct WriterTimes
47
{
48
    bool operator ==(
49
            const WriterTimes& b) const
50
0
    {
51
0
        return (initial_heartbeat_delay == b.initial_heartbeat_delay) &&
52
0
               (heartbeat_period == b.heartbeat_period) &&
53
0
               (nack_response_delay == b.nack_response_delay) &&
54
0
               (nack_supression_duration == b.nack_supression_duration);
55
0
    }
56
57
    /// Initial heartbeat delay. Default value 12ms.
58
    dds::Duration_t initial_heartbeat_delay {0, 12 * 1000 * 1000};
59
    /// Periodic HB period, default value 3s.
60
    dds::Duration_t heartbeat_period {3, 0};
61
    /// Delay to apply to the response of a ACKNACK message, default value 5ms.
62
    dds::Duration_t nack_response_delay {0, 5 * 1000 * 1000};
63
    /// This time allows the RTPSWriter to ignore nack messages too soon after the data as sent, default value 0s.
64
    dds::Duration_t nack_supression_duration {0, 0};
65
66
};
67
68
/**
69
 * Class WriterAttributes, defining the attributes of a RTPSWriter.
70
 * @ingroup RTPS_ATTRIBUTES_MODULE
71
 */
72
class WriterAttributes
73
{
74
public:
75
76
    WriterAttributes()
77
0
        : liveliness_kind(fastdds::dds::LivelinessQosPolicyKind::AUTOMATIC_LIVELINESS_QOS)
78
0
        , liveliness_lease_duration(TIME_T_INFINITE_SECONDS, TIME_T_INFINITE_NANOSECONDS)
79
0
        , liveliness_announcement_period(TIME_T_INFINITE_SECONDS, TIME_T_INFINITE_NANOSECONDS)
80
0
        , mode(SYNCHRONOUS_WRITER)
81
0
        , disable_heartbeat_piggyback(false)
82
0
        , disable_positive_acks(false)
83
0
        , keep_duration(TIME_T_INFINITE_SECONDS, TIME_T_INFINITE_NANOSECONDS)
84
0
    {
85
0
        endpoint.endpointKind = WRITER;
86
0
        endpoint.durabilityKind = TRANSIENT_LOCAL;
87
0
        endpoint.reliabilityKind = RELIABLE;
88
0
    }
89
90
    virtual ~WriterAttributes()
91
0
    {
92
0
    }
93
94
    //!Attributes of the associated endpoint.
95
    EndpointAttributes endpoint;
96
97
    //!Writer Times (only used for RELIABLE).
98
    WriterTimes times;
99
100
    //! Liveliness kind
101
    fastdds::dds::LivelinessQosPolicyKind liveliness_kind;
102
103
    //! Liveliness lease duration
104
    dds::Duration_t liveliness_lease_duration;
105
106
    //! Liveliness announcement period
107
    dds::Duration_t liveliness_announcement_period;
108
109
    //!Indicates if the Writer is synchronous or asynchronous
110
    RTPSWriterPublishMode mode;
111
112
    //! Disable the sending of heartbeat piggybacks.
113
    bool disable_heartbeat_piggyback;
114
115
    //! Define the allocation behaviour for matched-reader-dependent collections.
116
    ResourceLimitedContainerConfig matched_readers_allocation;
117
118
    //! Disable the sending of positive ACKs
119
    bool disable_positive_acks;
120
121
    //! Keep duration to keep a sample before considering it has been acked
122
    dds::Duration_t keep_duration;
123
124
    //! Flow controller name. Default: fastdds::rtps::FASTDDS_FLOW_CONTROLLER_DEFAULT.
125
    std::string flow_controller_name = fastdds::rtps::FASTDDS_FLOW_CONTROLLER_DEFAULT;
126
127
    //! Whether to send data to each matched reader separately.
128
    bool separate_sending = false;
129
};
130
131
} // namespace rtps
132
} // namespace fastdds
133
} // namespace eprosima
134
135
#endif // FASTDDS_RTPS_ATTRIBUTES__WRITERATTRIBUTES_HPP