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