#include <mc_rtc/Schema.h>
Public Types | |
using | FormElements = gui::details::FormElements |
Public Member Functions | |
template<typename T , typename Schema , T Schema::* ptr, ValueFlag Flags = ValueFlag::All, bool HasChoices = false> | |
bool | registerValue (details::MemberPointerWrapper< ptr >, const std::string &name, const std::string &description, const std::integral_constant< ValueFlag, Flags > &={}, const details::Choices< HasChoices > &choices={}) |
Public Attributes | |
size_t | values_count = 0 |
std::function< void(const void *self, Configuration &out)> | save = [](const void *, Configuration &) {} |
std::function< void(const void *self, MessagePackBuilder &builder)> | write |
std::function< void(void *self, const Configuration &in)> | load = [](void *, const Configuration &) {} |
std::function< void(const void *self, FormElements &form)> | buildForm = [](const void *, FormElements &) {} |
std::function< void(const Configuration &in, Configuration &out)> | formToStd |
std::function< bool(const void *lhs, const void *rhs)> | areEqual = [](const void *, const void *) { return true; } |
Helper to implement a Schema methods
Inside a schema-enabled struct, an Operations singleton should be created
When a member variable is added to the struct, it should be statically registered to the Operations singleton
When deriving a schema-enabled struct, an Operations singleton specific to this derived struct should be created and it should refer the base operations
It is advised to use the provided macros to deal with that boilerplate, namely:
|
inline |
FIXME Add a saveSchema function FIXME Add logging operation? Register a value
Schema | Schema this value belongs to |
ptr | Member pointer in the Schema object |
Flags | Control some features of the value in the schema |
HasChoices | If true, we expect choices to be provided for the value instead of an open form |
name | Name of the value |
description | Description for the value |
choices | Possible choices when |
HasChoices | is true |
std::function<bool(const void * lhs, const void * rhs)> mc_rtc::schema::Operations::areEqual = [](const void *, const void *) { return true; } |
Compare two objects
std::function<void(const void * self, FormElements & form)> mc_rtc::schema::Operations::buildForm = [](const void *, FormElements &) {} |
Build a Form to load the object
std::function<void(const Configuration & in, Configuration & out)> mc_rtc::schema::Operations::formToStd |
Convert a form configuration to the configuration expected by load
std::function<void(void * self, const Configuration & in)> mc_rtc::schema::Operations::load = [](void *, const Configuration &) {} |
Load from a configuration object
std::function<void(const void * self, Configuration & out)> mc_rtc::schema::Operations::save = [](const void *, Configuration &) {} |
Save to a configuration object
size_t mc_rtc::schema::Operations::values_count = 0 |
Name of members in the schema
std::function<void(const void * self, MessagePackBuilder & builder)> mc_rtc::schema::Operations::write |
Write to a MessagePackBuilder