iceoryx_doc  1.0.1
user_trigger.hpp
1 // Copyright (c) 2020 by Robert Bosch GmbH. All rights reserved.
2 // Copyright (c) 2020 - 2021 by Apex.AI Inc. All rights reserved.
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 // SPDX-License-Identifier: Apache-2.0
17 #ifndef IOX_POSH_POPO_USER_TRIGGER_HPP
18 #define IOX_POSH_POPO_USER_TRIGGER_HPP
19 
20 #include "iceoryx_posh/popo/trigger.hpp"
21 #include "iceoryx_posh/popo/wait_set.hpp"
22 
23 #include <atomic>
24 #include <mutex>
25 
26 namespace iox
27 {
28 namespace popo
29 {
35 {
36  public:
37  UserTrigger() noexcept;
38  UserTrigger(const UserTrigger& rhs) = delete;
39  UserTrigger(UserTrigger&& rhs) = delete;
40  UserTrigger& operator=(const UserTrigger& rhs) = delete;
41  UserTrigger& operator=(UserTrigger&& rhs) = delete;
42 
45  void trigger() noexcept;
46 
50  bool hasTriggered() const noexcept;
51 
52  friend class NotificationAttorney;
53 
54  private:
57  void invalidateTrigger(const uint64_t uniqueTriggerId) noexcept;
58 
61  void enableEvent(iox::popo::TriggerHandle&& triggerHandle) noexcept;
62 
64  void disableEvent() noexcept;
65 
66  private:
67  TriggerHandle m_trigger;
68 };
69 
70 } // namespace popo
71 } // namespace iox
72 
73 #endif // IOX_POSH_POPO_USER_TRIGGER_HPP
Class which allows accessing private methods to friends of NotificationAttorney. Used for example by ...
Definition: notification_attorney.hpp:33
TriggerHandle is threadsafe without restrictions in a single process. Not qualified for inter process...
Definition: trigger_handle.hpp:38
An event based trigger which can be used by the application developer directly. If you would like to ...
Definition: user_trigger.hpp:35
void trigger() noexcept
If it is attached it will trigger otherwise it will do nothing.
bool hasTriggered() const noexcept
Checks if the UserTrigger was triggered.
Definition: service_description.hpp:29