|
VEGO-Engine
0.1
|
DataComponent class to centrally store data about an entity such as stats. More...
#include <DataComponent.h>
Public Member Functions | |
| DataComponent () | |
| The data component only has a default constructor. | |
| template<typename T> | |
| void | setEntry (const std::string &key, const T &value) |
| Set a key-value pair of any type in the data map. | |
| template<typename T> | |
| std::optional< T > | getEntry (std::string key) const |
| Get a value of type T from the data map. | |
DataComponent class to centrally store data about an entity such as stats.
|
inline |
Get a value of type T from the data map.
e.g.
in this case the key is "speed" and the value is returned as an integer
the value() or value_or() is NEEDED to handle the optional return type
| key | The name to retrieve the value from |
|
inline |
Set a key-value pair of any type in the data map.
e.g.
in this case the key is "speed" and the value is set to an integer of 180
| key | The name to store the value under |
| value | The value to store of type T |