14#include "sygah-consteval.hpp"
15#include "sygah-metadata.hpp"
42template<
typename T>
requires std::integral<T> || std::floating_point<T>
55template<num_literal _min, num_literal _max, num_literal _init = _min>
62 decltype(_min.value)
min = _min.value;
63 decltype(_max.value)
max = _max.value;
64 decltype(_init.value)
init = _init.value;
69 static _consteval
auto min() {
return _min.value; }
71 static _consteval
auto max() {
return _max.value; }
73 static _consteval
auto init() {
return _init.value; }
108 constexpr operator T&()
noexcept {
return value;}
110 constexpr operator const T&()
const noexcept {
return value;}
148 state = std::move(other.state);
176 state = std::move(other.state);
199 constexpr operator T&()
noexcept {
return state;}
201 constexpr operator const T&()
const noexcept {
return state;}
238#define tag(TAG) struct tag_##TAG {enum {TAG}; }
255template<
typename ... Tags>
407 using persistent<std::array<T, N>>::operator=;
409 constexpr const auto& operator[](std::size_t i)
const noexcept
413 constexpr auto& operator[](std::size_t i)
noexcept
417 static _consteval
auto size()
noexcept
450 using occasional<std::array<T, N>>::operator=;
452 constexpr const auto& operator[](std::size_t i)
const noexcept
456 constexpr auto& operator[](std::size_t i)
noexcept
460 static _consteval
auto size()
noexcept
464 void set_updated()
noexcept
483 enum {bang, impulse};
484 void operator()() {
value =
true;}
485 void reset() {
value =
false;}
#define tag(TAG)
Helper struct for defining recognized tags. This is immediately undefed, so don't try to use it!
Definition sygah-endpoints.hpp:238
static _consteval auto min()
Returns the minimum value of the range.
Definition sygah-endpoints.hpp:69
static _consteval auto range()
Returns a struct with min, max, and init members containing the range.
Definition sygah-endpoints.hpp:59
bool updated
Flag indicating if the state has been changed.
Definition sygah-endpoints.hpp:134
constexpr T * operator->() noexcept
Mutable member access operator; provides access to the members of the underlying state.
Definition sygah-endpoints.hpp:217
constexpr auto & operator=(T &&t) noexcept
Move assignment from the underlying type.
Definition sygah-endpoints.hpp:209
T type
The underlying type.
Definition sygah-endpoints.hpp:130
constexpr occasional(const occasional< T > &other)
Copy constructor from another occasional.
Definition sygah-endpoints.hpp:158
constexpr auto & operator=(occasional< T > &&other)
Move assignment from another occasional.
Definition sygah-endpoints.hpp:172
static _consteval auto max()
Returns the maximum value of the range.
Definition sygah-endpoints.hpp:71
constexpr auto & operator=(const T &t) noexcept
Copy assignment from the underlying type.
Definition sygah-endpoints.hpp:211
constexpr persistent(const T &t) noexcept
Copy constructor from T
Definition sygah-endpoints.hpp:100
constexpr auto & operator=(T &&t) noexcept
Move assignment from T
Definition sygah-endpoints.hpp:102
constexpr occasional() noexcept
Default constructor; state is default initialized and updated is false.
Definition sygah-endpoints.hpp:137
constexpr T & value() noexcept
Mutable value access.
Definition sygah-endpoints.hpp:221
constexpr persistent() noexcept
Default constuctor defers to T's empty initializer.
Definition sygah-endpoints.hpp:94
constexpr const T & value() const noexcept
Immutable value access.
Definition sygah-endpoints.hpp:223
constexpr occasional(occasional< T > &&other)
Move constructor from another occasional.
Definition sygah-endpoints.hpp:144
T state
The wrapped state.
Definition sygah-endpoints.hpp:132
constexpr occasional(T &&t) noexcept
Move constructor from the underlying type.
Definition sygah-endpoints.hpp:205
T type
The underlying type.
Definition sygah-endpoints.hpp:90
constexpr auto & operator=(const occasional< T > &other)
Copy assignment from another occasional.
Definition sygah-endpoints.hpp:187
constexpr T & operator*() noexcept
Mutable dereference operator; provides access to the underlying state.
Definition sygah-endpoints.hpp:213
constexpr void reset() noexcept
Clear the updated flag. This can also be achieved by assignment from empty braces,...
Definition sygah-endpoints.hpp:225
constexpr occasional(const T &t) noexcept
Copy constructor from the underlying type.
Definition sygah-endpoints.hpp:207
static _consteval auto init()
Returns the initial value of the range.
Definition sygah-endpoints.hpp:73
T value
The wrapped value.
Definition sygah-endpoints.hpp:92
T value
The value of the constant.
Definition sygah-endpoints.hpp:48
T type
The underlying numeric type.
Definition sygah-endpoints.hpp:46
constexpr auto & operator=(const T &t) noexcept
Copy assignment from T
Definition sygah-endpoints.hpp:104
constexpr persistent(T &&t) noexcept
Move constructor from T
Definition sygah-endpoints.hpp:98
_consteval num_literal(T f)
Constructor enabling initialization from a literal constant.
Definition sygah-endpoints.hpp:50
A multi-dimensional numeric endpoint with user customizeable range and occasional message semantics.
Definition sygah-endpoints.hpp:449
A multi-dimensional numeric endpoint with user customizeable range and persistent value semantics.
Definition sygah-endpoints.hpp:406
A semantically value-less endpoint that signals an event.
Definition sygah-endpoints.hpp:481
Document a textual description of an entity, e.g. an endpoint, component or binding.
Definition sygah-metadata.hpp:35
Document the name of an entity, e.g. an endpoint, component, or binding.
Definition sygah-metadata.hpp:33
A wrapper around a numeric literal that enables using floats as template parameters.
Definition sygah-endpoints.hpp:44
Wrapper around a type T with optional-like semantics and persistent state.
Definition sygah-endpoints.hpp:128
A wrapper around a value-like type.
Definition sygah-endpoints.hpp:88
Document the expected minimum, maximum, and initial value of an endpoint.
Definition sygah-endpoints.hpp:57
A numeric endpoint with user customizeable range and occasional value semantics.
Definition sygah-endpoints.hpp:376
A numeric endpoint with user customizeable range and persistent value semantics.
Definition sygah-endpoints.hpp:348
A wrapper around a string lteral that enables using strings as template parameters.
Definition sygah-string_literal.hpp:25
Apply the tag helpers classes Tags to an entity, especially an endpoint.
Definition sygah-endpoints.hpp:256
A text string endpoint with occasional message semantics.
Definition sygah-endpoints.hpp:320
A text string endpoint with persistent value semantics.
Definition sygah-endpoints.hpp:304
A two-state integer endpoint with persistent value semantics.
Definition sygah-endpoints.hpp:289