|
morph 0.1.0
Asynchronous bridge between GUI thread and business models
|
#include <cassert>#include <cstddef>#include <glaze/glaze.hpp>#include <memory>#include <optional>#include <string>#include <string_view>#include <type_traits>#include <typeindex>#include <utility>#include <vector>#include "../detail/reflected_member.hpp"#include "model_key.hpp"#include "registry.hpp"Go to the source code of this file.
Classes | |
| struct | morph::record::key< Member > |
| Option for BRIDGE_REGISTER_RECORD: the record's key is the named member instead of id. More... | |
| struct | morph::record::keyless |
| Option for BRIDGE_REGISTER_RECORD: the record has no key. More... | |
| struct | morph::record::derivedFrom< S > |
Option for BRIDGE_REGISTER_RECORD: a change to any of S is a change to this record type. More... | |
| struct | morph::record::privateKeys |
| Option for BRIDGE_REGISTER_RECORD: the record's keys must not reach other principals. More... | |
| struct | morph::record::RecordInfo |
| What one BRIDGE_REGISTER_RECORD declared. More... | |
| struct | morph::record::detail::KeyOption< T > |
| Detects a key<> option and exposes its member pointer. More... | |
| struct | morph::record::detail::IsDerivedFrom< T > |
| Detects a derivedFrom<> option. More... | |
Macros | |
| #define | BRIDGE_REGISTER_RECORD(T, NAME, ...) |
| Registers a record type under a wire name, with optional key, derivation and privacy options. | |
Functions | |
| template<typename K> | |
| constexpr bool | morph::record::detail::keyTypeIsString () |
| Whether a key member's raw type is std::string, looking through a wrapped strong id. | |
| template<typename Class, typename Member> | |
| std::string | morph::record::detail::memberKeyName (Member Class::*member) |
| The reflected name of a data member, found by its address in a value-initialised object. | |
| template<typename T> | |
| constexpr std::size_t | morph::record::detail::idIndex () |
| The index of the reflected member named id, or size when there is none. | |
| template<typename T, typename... Opts> | |
| void | morph::record::detail::applyKey (RecordInfo &info) |
Fills the key fields of info from the options. | |
| std::vector< RecordInfo > & | morph::record::detail::mutableRecordRegistry () |
| The process-level record list, appended to by static registrars. | |
| std::vector< RecordInfo > const & | morph::record::detail::recordRegistry () |
| The records declared so far, raw and unvalidated. | |
| template<typename T, typename... Opts> | |
| bool | morph::record::detail::registerRecordOnce (std::string_view name) noexcept |
| Static-init helper for BRIDGE_REGISTER_RECORD. | |
The registry of record types: the rows a server can push changes about.
A record is a plain reflected struct identified by a key member. Registration is a static registrar, like an action's, so it is checked by the same registration-phase latch. The registry stores what was declared; cross-entry validation (duplicate names, derivation cycles, keyless records that an effect names) happens when the registry is read for matching, not here.
Definition in file records.hpp.
| #define BRIDGE_REGISTER_RECORD | ( | T, | |
| NAME, | |||
| ... ) |
Registers a record type under a wire name, with optional key, derivation and privacy options.
The key defaults to the member reflected as id. Options are morph::record::key<&T::m>, morph::record::keyless, morph::record::derivedFrom<S...> and morph::record::privateKeys. Expands to nothing under MORPH_CLIENT_ONLY.
| T | The record type. |
| NAME | The record's wire name. |
| ... | The options. |
Definition at line 239 of file records.hpp.
|
constexpr |
Whether a key member's raw type is std::string, looking through a wrapped strong id.
| K | The key member's type. |
Definition at line 100 of file records.hpp.
|
nodiscard |
The reflected name of a data member, found by its address in a value-initialised object.
| Class | The record type. |
| Member | The member's type. |
| member | The member. |
Definition at line 115 of file records.hpp.
|
constexpr |
The index of the reflected member named id, or size when there is none.
| T | The record type. |
Definition at line 137 of file records.hpp.
| void morph::record::detail::applyKey | ( | RecordInfo & | info | ) |
Fills the key fields of info from the options.
| T | The record type. |
| Opts | The options. |
| info | The entry being built. |
Definition at line 152 of file records.hpp.
|
inline |
The process-level record list, appended to by static registrars.
Definition at line 184 of file records.hpp.
|
inline |
The records declared so far, raw and unvalidated.
Definition at line 191 of file records.hpp.
|
inlinenoexcept |
Static-init helper for BRIDGE_REGISTER_RECORD.
| T | The record type. |
| Opts | Any of key<>, keyless, derivedFrom<>, privateKeys. |
| name | The record's wire name. |
Definition at line 199 of file records.hpp.