Darwin Neuroevolution Framework
|
A variant type (tagged-union) with PropertySet fields. More...
#include <properties.h>
Public Member Functions | |
TAG | tag () const |
The tag value indicating the active PropertySet case. | |
void | selectCase (TAG tag) |
Selects the active PropertySet case. | |
const PropertySet * | activeCase () const |
Returns the active PropertySet. | |
PropertySet * | activeCase () |
Returns the active PropertySet. | |
json | toJson () const |
Serialize to a json object. More... | |
void | fromJson (const json &json_obj) |
Deserialize from a json object. More... | |
void | copyFrom (const PropertySetVariant &src) |
Transfer values between two property set variants. | |
A variant type (tagged-union) with PropertySet fields.
The PropertySetVariant offers a simple solution for grouping a set of mutually exclusive property sets. The tag type (normally an enum) tracks which field (case) is active.
First, we need a scalar tag type:
The variant type must derive from PropertySetVariant, and the CASE(tag, name, type)
macro is used to declare the variant fields (cases):
Finally, the variant type is intended to be used inside a PropertySet, using the VARIANT(name, type, default_case, description)
macro to declare variant fields.
|
inline |
Deserialize from a json object.
The deserialization is not strict:
|
inline |
Serialize to a json object.