HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
observable_not.hpp
1// Copyright Take Vos 2020.
2// Distributed under the Boost Software License, Version 1.0.
3// (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt)
4
5#pragma once
6
7#include "observable_unary.hpp"
8
9namespace tt::detail {
10
11template<typename OT>
12class observable_not final : public observable_unary<bool,OT> {
13public:
14 observable_not(std::shared_ptr<observable_base<OT>> const &operand) noexcept :
16
17 virtual bool load() const noexcept override {
18 ttlet lock = std::scoped_lock(observable_unary<bool,OT>::_mutex);
19 return !this->_operand_cache;
20 }
21
22 virtual bool store(bool const &new_value) noexcept override {
23 return this->_operand->store(static_cast<OT>(!new_value));
24 }
25};
26
27}
Observable abstract base class.
Definition observable_base.hpp:30
Definition observable_not.hpp:12
virtual bool load() const noexcept override
Get the current value.
Definition observable_not.hpp:17
Definition observable_unary.hpp:12