DataManager.hpp

DataManager handles a set of DataNode objects with the same tracking settings.

template<typename VAL_TYPE, data... MODS>
class DataManager
#include <DataManager.hpp>

DataManagers handle sets of DataNode objects that all have the same tracking settings.

Public Functions

inline DataManager()
inline ~DataManager()
inline auto begin()
inline auto end()
inline auto begin() const
inline auto end() const
inline size_t GetSize() const
Returns:

the number of DataNodes in this DataManager

inline auto &GetNodes() const
Returns:

the std::map mapping node names (strings) to DataNodes

inline bool HasNode(const std::string &name)
inline node_t &New(const std::string &name)

Creates and adds a new DataNode

Parameters:

name – the name of the DataNode

inline void Delete(const std::string &name)

Deletes the DataNode with the specified name. Throws an error if there is no node with that name in this manager.

Parameters:

name – the name of the DataNode to delete

inline const node_t &Get(const std::string &name) const
Parameters:

name – the name of the DataNode

Returns:

a const reference to the DataNode with the specified name Throws an error if there is no node with that name in this manager

inline node_t &Get(const std::string &name)
Parameters:

name – the name of the DataNode

Returns:

a reference to the node with the specified name

template<typename ...Ts>
inline void AddData(const std::string &name, Ts... extra)

Adds data to a node in the DataManager

.

Example:

DataManager<int, data::Current, data::Range> my_data_manager;
my_data_manager.Add("my_node_name");
my_data_manager.AddData("my_node_name", 1, 2, 3, 4, 5);

Parameters:
  • name – the node to add the data to.

  • extra – All subsequent arguments are the data to add to that node, and should be of whatever type all of the nodes in this manger expect.

inline void ResetAll()

Resets all nodes in this manager. For nodes without the data::Archive attribute, this clears all of their data except current. For nodes with the data::Archive attribute, this creates a new vector to start storing data, retaining the old one in the archive.

Private Types

using data_t = VAL_TYPE
using node_t = DataNode<data_t, MODS...>

Private Members

std::map<std::string, node_t*> node_map