$darkmode
Public Member Functions | |
| Confable (const Confable &) noexcept | |
| Confable (Confable &&) noexcept=default | |
| Confable & | operator= (const Confable &other) noexcept |
| Confable & | operator= (Confable &&other) noexcept |
| virtual void | reset_schema () |
| Schema & | schema () |
| const Schema & | schema () const |
| virtual void | validate_or_throw (const Conf &c) const |
| virtual bool | validate (const Conf &c, std::optional< SchemaError > &err) const |
| virtual void | from_conf (const Conf &c) |
| virtual void | to_json (Json &j) const |
| Json | to_json () const |
Protected Member Functions | |
| virtual Schema | schema_impl () |
|
virtual |
Deserialize a Confable from a Conf.
Unless you have special needs, it is recommended to implement
Schema schema_impl()
and use the default implementation of this.
Reimplemented in cloe::Frustum, cloe::Command, cloe::component::NormalDistribution< T >, cloe::utility::ContactMap< D >, cloe::utility::ContactMap< Duration >, cloe::Stack, cloe::VehicleConf, cloe::FromSimulator, and cloe::PersistentConfable.
|
virtual |
Reset the internal schema cache.
This causes schema_impl to be called next time the schema is requested.
Reimplemented in cloe::Stack.
| Schema & Confable::schema | ( | ) |
Return the object schema for deserialization.
This method uses schema_impl under the hood, which the object should implement.
| const Schema & Confable::schema | ( | ) | const |
Return the object schema for description and validation.
This method uses schema_impl under the hood, which the object should implement.
|
protectedvirtual |
Return a new instance of the schema for this object.
This schema is then stored in schema_. This is called every time the object is created or moved, since Schema contains references to fields that (should be) in the object.
Reimplemented in cloe::component::NormalDistribution< T >, cloe::LaneBoundary, and cloe::Frustum.
| Json Confable::to_json | ( | ) | const |
|
virtual |
Serialize a Confable to Json.
Note: If you implement this type, make sure to either use CONFABLE_FRIENDS or a using Confable::to_json statement in your derived type.
Reimplemented in cloe::LaneBoundary, and cloe::Frustum.
|
virtual |
Validate a Conf without applying it and without throwing.
By default, this uses the validate() method on schema(). If you want to guarantee anything extending beyond what's possible with schema, you can do that here.
This method should NOT call from_conf without also overriding from_conf to prevent infinite recursion.
This method should not reset err unless the method returns false.
| c | JSON to validate |
| err | reference to store error in |
Reimplemented in cloe::Stack, and cloe::LoggingConf.
|
virtual |
Validate a Conf without applying it.
By default, this uses the validate_or_throw() method on schema(). If you want to guarantee anything extending beyond what's possible with schema, you can do that here.
This method should NOT call from_conf without also overriding from_conf to prevent infinite recursion.
Reimplemented in cloe::Stack.