Coverage Report

Created: 2022-08-24 06:19

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