/src/Fast-DDS/include/fastdds/dds/subscriber/ReadCondition.hpp
Line | Count | Source (jump to first uncovered line) |
1 | | // Copyright 2022 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 ReadCondition.hpp |
17 | | */ |
18 | | |
19 | | #ifndef FASTDDS_DDS_SUBSCRIBER__READCONDITION_HPP |
20 | | #define FASTDDS_DDS_SUBSCRIBER__READCONDITION_HPP |
21 | | |
22 | | #include <cassert> |
23 | | |
24 | | #include <fastdds/dds/core/condition/Condition.hpp> |
25 | | #include <fastdds/dds/subscriber/InstanceState.hpp> |
26 | | #include <fastdds/dds/subscriber/SampleState.hpp> |
27 | | #include <fastdds/dds/subscriber/ViewState.hpp> |
28 | | #include <fastdds/fastdds_dll.hpp> |
29 | | |
30 | | namespace eprosima { |
31 | | namespace fastdds { |
32 | | namespace dds { |
33 | | |
34 | | namespace detail { |
35 | | |
36 | | class ReadConditionImpl; |
37 | | |
38 | | } // namespace detail |
39 | | |
40 | | class DataReader; |
41 | | |
42 | | /** |
43 | | * @brief A Condition specifically dedicated to read operations and attached to one DataReader. |
44 | | * |
45 | | * ReadCondition objects allow an application to specify the data samples it is interested in (by specifying the |
46 | | * desired sample_states, view_states, and instance_states). |
47 | | * The condition will only be triggered when suitable information is available. |
48 | | * They are to be used in conjunction with a WaitSet as normal conditions. |
49 | | * More than one ReadCondition may be attached to the same DataReader. |
50 | | */ |
51 | | class ReadCondition : public Condition |
52 | | { |
53 | | friend class detail::ReadConditionImpl; |
54 | | |
55 | | public: |
56 | | |
57 | | ReadCondition(); |
58 | | |
59 | | ~ReadCondition() override; |
60 | | |
61 | | // Non-copyable |
62 | | ReadCondition( |
63 | | const ReadCondition&) = delete; |
64 | | ReadCondition& operator =( |
65 | | const ReadCondition&) = delete; |
66 | | |
67 | | // Non-movable |
68 | | ReadCondition( |
69 | | ReadCondition&&) = delete; |
70 | | ReadCondition& operator =( |
71 | | ReadCondition&&) = delete; |
72 | | |
73 | | /** |
74 | | * @brief Retrieves the trigger_value of the Condition |
75 | | * @return true if trigger_value is set to 'true', 'false' otherwise |
76 | | */ |
77 | | FASTDDS_EXPORTED_API bool get_trigger_value() const noexcept override; |
78 | | |
79 | | /** |
80 | | * @brief Retrieves the DataReader associated with the ReadCondition. |
81 | | * |
82 | | * Note that there is exactly one DataReader associated with each ReadCondition. |
83 | | * |
84 | | * @return pointer to the DataReader associated with this ReadCondition. |
85 | | */ |
86 | | FASTDDS_EXPORTED_API DataReader* get_datareader() const noexcept; |
87 | | |
88 | | /** |
89 | | * @brief Retrieves the set of sample_states taken into account to determine the trigger_value of this condition. |
90 | | * |
91 | | * @return the sample_states specified when the ReadCondition was created. |
92 | | */ |
93 | | FASTDDS_EXPORTED_API SampleStateMask get_sample_state_mask() const noexcept; |
94 | | |
95 | | /** |
96 | | * @brief Retrieves the set of view_states taken into account to determine the trigger_value of this condition. |
97 | | * |
98 | | * @return the view_states specified when the ReadCondition was created. |
99 | | */ |
100 | | FASTDDS_EXPORTED_API ViewStateMask get_view_state_mask() const noexcept; |
101 | | |
102 | | /** |
103 | | * @brief Retrieves the set of instance_states taken into account to determine the trigger_value of this condition. |
104 | | * |
105 | | * @return the instance_states specified when the ReadCondition was created. |
106 | | */ |
107 | | FASTDDS_EXPORTED_API InstanceStateMask get_instance_state_mask() const noexcept; |
108 | | |
109 | | detail::ReadConditionImpl* get_impl() const noexcept |
110 | 0 | { |
111 | 0 | assert((bool)impl_); |
112 | 0 | return impl_.get(); |
113 | 0 | } |
114 | | |
115 | | protected: |
116 | | |
117 | | //! Class implementation |
118 | | std::shared_ptr<detail::ReadConditionImpl> impl_; |
119 | | |
120 | | }; |
121 | | |
122 | | } // namespace dds |
123 | | } // namespace fastdds |
124 | | } // namespace eprosima |
125 | | |
126 | | #endif // FASTDDS_DDS_SUBSCRIBER__READCONDITION_HPP |