HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
observable.hpp
1// Copyright Take Vos 2022.
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 "group_ptr.hpp"
8#include "notifier.hpp"
9#include <memory>
10#include <vector>
11#include <string>
12
13namespace hi::inline v1 {
14
19
20 void const * const ptr;
21 path_type const& path;
22};
23
28class observable : public enable_group_ptr<observable, void(observable_msg)> {
29public:
30 constexpr virtual ~observable() = default;
31 observable(observable const&) = delete;
32 observable(observable&&) = delete;
33 observable& operator=(observable const&) = delete;
34 observable& operator=(observable&&) = delete;
35 constexpr observable() noexcept = default;
36
42 [[nodiscard]] virtual void const *read() const noexcept = 0;
43
50 [[nodiscard]] virtual void *copy(void const *ptr) const noexcept = 0;
51
57 virtual void commit(void *ptr) noexcept = 0;
58
64 virtual void abort(void *ptr) const noexcept = 0;
65
68 virtual void read_lock() const noexcept = 0;
69
72 virtual void read_unlock() const noexcept = 0;
73
76 virtual void write_lock() const noexcept = 0;
77
80 virtual void write_unlock() const noexcept = 0;
81};
82
83} // namespace hi::inline v1
DOXYGEN BUG.
Definition algorithm.hpp:15
Enable a class to be used in a group_ptr.
Definition group_ptr.hpp:37
Definition observable.hpp:15
An abstract observable object.
Definition observable.hpp:28
virtual void const * read() const noexcept=0
Get a pointer to the current value.