Darwin Neuroevolution Framework
Public Member Functions | List of all members
core::Property Class Referenceabstract

Reflection interface to a property in a PropertySet. More...

#include <properties.h>

Inherited by core::TypedProperty< T >, and core::VariantProperty< T >.

Public Member Functions

const string & name () const
 Property name.
 
const string & description () const
 Property description.
 
PropertySetparent () const
 The PropertySet which contains this property.
 
virtual string value () const =0
 The property value, formatted as a string.
 
virtual string defaultValue () const =0
 The default property value, formatted as a string.
 
virtual PropertySetchildPropertySet () const
 Return the optional child PropertySet, or nullptr
 
virtual void setValue (const string &str)=0
 Update the current value from a string representation.
 
virtual vector< string > knownValues () const =0
 The list of known possible values (when available, for example enums)
 
virtual void copyFrom (const Property &src)=0
 Copies values between properties of the same runtime type. More...
 
virtual json toJson () const =0
 Serialize the property value to a json object.
 
virtual void fromJson (const json &json_obj)=0
 Deserialize the property value from a json object.
 
template<class T >
const T & nativeValue () const
 Type-safe accessor to the native property value. More...
 
template<class T >
bool isA () const
 Returns true if the property wraps a T value.
 

Detailed Description

Reflection interface to a property in a PropertySet.

See also
PropertySet

Member Function Documentation

◆ copyFrom()

virtual void core::Property::copyFrom ( const Property src)
pure virtual

Copies values between properties of the same runtime type.

Exceptions
std::bad_castif the types don't match

◆ nativeValue()

template<class T >
const T& core::Property::nativeValue ( ) const
inline

Type-safe accessor to the native property value.

Exceptions
core::Exceptionif the runtime type doesn't match

The documentation for this class was generated from the following file: