Fast DDS  Version 3.6.1.0
Fast DDS
WaitSet.hpp
1 // Copyright 2021 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 
20 #ifndef FASTDDS_DDS_CORE_CONDITION__WAITSET_HPP
21 #define FASTDDS_DDS_CORE_CONDITION__WAITSET_HPP
22 
23 #include <memory>
24 
25 #include <fastdds/dds/core/condition/Condition.hpp>
26 #include <fastdds/dds/core/ReturnCode.hpp>
27 #include <fastdds/rtps/common/Time_t.hpp>
28 #include <fastdds/fastdds_dll.hpp>
29 
30 namespace eprosima {
31 namespace fastdds {
32 namespace dds {
33 
34 // Forward declaration of implementation details
35 namespace detail {
36 struct WaitSetImpl;
37 } // namespace detail
38 
44 class WaitSet
45 {
46 public:
47 
48  FASTDDS_EXPORTED_API WaitSet();
49 
50  FASTDDS_EXPORTED_API ~WaitSet();
51 
53  const WaitSet&) = delete;
55  WaitSet&&) = delete;
57  const WaitSet&) = delete;
59  WaitSet&&) = delete;
60 
66  FASTDDS_EXPORTED_API ReturnCode_t attach_condition(
67  const Condition& cond);
68 
69 
75  FASTDDS_EXPORTED_API ReturnCode_t detach_condition(
76  const Condition& cond);
77 
87  FASTDDS_EXPORTED_API ReturnCode_t wait(
88  ConditionSeq& active_conditions,
89  const dds::Duration_t timeout) const;
90 
96  FASTDDS_EXPORTED_API ReturnCode_t get_conditions(
97  ConditionSeq& attached_conditions) const;
98 
99 private:
100 
101  std::unique_ptr<detail::WaitSetImpl> impl_;
102 };
103 
104 } // namespace dds
105 } // namespace fastdds
106 } // namespace eprosima
107 
108 #endif // FASTDDS_DDS_CORE_CONDITION__WAITSET_HPP
The Condition class is the root base class for all the conditions that may be attached to a WaitSet.
Definition: Condition.hpp:42
The WaitSet class allows an application to wait until one or more of the attached Condition objects h...
Definition: WaitSet.hpp:45
FASTDDS_EXPORTED_API ReturnCode_t get_conditions(ConditionSeq &attached_conditions) const
Retrieves the list of attached conditions.
WaitSet & operator=(const WaitSet &)=delete
FASTDDS_EXPORTED_API ReturnCode_t detach_condition(const Condition &cond)
Detaches a Condition from the WaitSet.
FASTDDS_EXPORTED_API ReturnCode_t attach_condition(const Condition &cond)
Attaches a Condition to the Wait Set.
FASTDDS_EXPORTED_API ReturnCode_t wait(ConditionSeq &active_conditions, const dds::Duration_t timeout) const
Allows an application thread to wait for the occurrence of certain conditions.
WaitSet(const WaitSet &)=delete
FASTDDS_EXPORTED_API WaitSet()
FASTDDS_EXPORTED_API ~WaitSet()
Definition: DomainParticipant.hpp:46
int32_t ReturnCode_t
Definition: DDSReturnCode.hpp:59
std::vector< Condition * > ConditionSeq
Definition: Condition.hpp:68
Structure Time_t, used to describe times at a DDS level.
Definition: Time_t.hpp:36