TnxViewModelBase class

The non-template part of a view model: its target, and how readers reach its values.

Derived classes

template<typename T>
class TnxViewModel
One set of a view model's values, readable by bindings while it lives. Set from any thread.

Constructors, destructors, conversion operators

TnxViewModelBase(const TnxViewModelBase&) deleted
TnxViewModelBase(TnxViewModels::TypeInfo type, void* values) protected
A view model of type whose values are at values (the derived class's).
~TnxViewModelBase() protected

Public functions

auto operator=(const TnxViewModelBase&) -> TnxViewModelBase& deleted
auto GetTarget() const -> GGUI::BindTarget
What bindings to its values read: TnxBind and TnxContext use it.
auto GetTypeName() const -> std::string_view
Its type's TNX_VIEW_MODEL name.

Protected functions

void Publish()
Readable from now on: called once the values exist.
void Withdraw()
Not readable any more: called before the values go.

Protected variables

std::mutex Lock
values are written on any thread and read by UI updates