Attributes#
Attributes are similar to properties but are dynamic, i.e., they are not specified by the class and can change type. Like properties, values are restricted to the types in navground::core::Attribute
.
Classes with attributes save/load their attributes from YAML.
#include "navground/core/attribute.h"
A type the holds a dictionary of named attributes
name -> value
This class defines set and get methods to access dynamic attributes.
Subclassed by navground::sim::Agent, navground::sim::World
Public Functions
Gets all attributes.
- Returns:
The attributes.
Sets all attributes.
- Parameters:
values – [in] The attributes.
Set the value of a named attribute.
- Parameters:
name – [in] The name of the property
value – [in] The desired value for the attribute
Gets the value of the specified attribute.
- Parameters:
name – [in] The name of the attribute
- Returns:
The value of the attribute
Checks if the specified attribute is set.
- Parameters:
name – [in] The name of the attribute
- Returns:
True if the attribute is present.
Remove the specified attribute.
- Parameters:
name – [in] The name of the attribute
Remove all attributes.
Gets the value of the specified attribute.
- Parameters:
name – [in] The name
- Template Parameters:
T – The desired type
- Returns:
The value static casted to
T
if possible, else null.