Empirical
Public Member Functions | List of all members
emp::DataManager< VAL_TYPE, MODS > Class Template Reference

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

#include <DataManager.h>

Public Member Functions

 DataManager ()
 
 ~DataManager ()
 
size_t GetSize () const
 Returns the number of DataNodes in this DataManager. More...
 
auto & GetNodes () const
 Returns the std::map mapping node names (strings) to DataNodes. More...
 
bool HasNode (const std::string &name)
 
node_tNew (const std::string &name)
 Creates and adds a new DataNode, with the name specified in. More...
 
void Delete (const std::string &name)
 
const node_tGet (const std::string &name) const
 
node_tGet (const std::string &name)
 
template<typename... Ts>
void AddData (const std::string &name, Ts...extra)
 
void ResetAll ()
 

Detailed Description

template<typename VAL_TYPE, emp::data... MODS>
class emp::DataManager< VAL_TYPE, MODS >

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

Constructor & Destructor Documentation

template<typename VAL_TYPE, emp::data... MODS>
emp::DataManager< VAL_TYPE, MODS >::DataManager ( )
inline
template<typename VAL_TYPE, emp::data... MODS>
emp::DataManager< VAL_TYPE, MODS >::~DataManager ( )
inline

Member Function Documentation

template<typename VAL_TYPE, emp::data... MODS>
template<typename... Ts>
void emp::DataManager< VAL_TYPE, MODS >::AddData ( const std::string &  name,
Ts...  extra 
)
inline

Adds data to a node in the DataManager.

Parameters
nameis the node to add the data to. All subsequent arguments are the data to add to that node, and should be of whatever type all of the nodes in this maanger expect.

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);

template<typename VAL_TYPE, emp::data... MODS>
void emp::DataManager< VAL_TYPE, MODS >::Delete ( const std::string &  name)
inline

Deletes the DataNode with the name

Parameters
name.Throws an error if there is no node with that name in this manager.
template<typename VAL_TYPE, emp::data... MODS>
const node_t& emp::DataManager< VAL_TYPE, MODS >::Get ( const std::string &  name) const
inline

Returns a const reference to the node named

Parameters
name.Throws an error if there is no node with that name in this manager
template<typename VAL_TYPE, emp::data... MODS>
node_t& emp::DataManager< VAL_TYPE, MODS >::Get ( const std::string &  name)
inline

Returns a reference to the node named

Parameters
name.Throws an error if there is no node with that name in this manager
template<typename VAL_TYPE, emp::data... MODS>
auto& emp::DataManager< VAL_TYPE, MODS >::GetNodes ( ) const
inline

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

template<typename VAL_TYPE, emp::data... MODS>
size_t emp::DataManager< VAL_TYPE, MODS >::GetSize ( ) const
inline

Returns the number of DataNodes in this DataManager.

template<typename VAL_TYPE, emp::data... MODS>
bool emp::DataManager< VAL_TYPE, MODS >::HasNode ( const std::string &  name)
inline
template<typename VAL_TYPE, emp::data... MODS>
node_t& emp::DataManager< VAL_TYPE, MODS >::New ( const std::string &  name)
inline

Creates and adds a new DataNode, with the name specified in.

Parameters
name.
template<typename VAL_TYPE, emp::data... MODS>
void emp::DataManager< VAL_TYPE, MODS >::ResetAll ( )
inline

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.


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