Empirical
|
#include <DataFile.h>
Public Member Functions | |
ContainerDataFile (const std::string &filename, const std::string &b="", const std::string &s=",", const std::string &e="\n") | |
~ContainerDataFile () | |
void | SetUpdateContainerFun (const fun_update_container_t fun) |
void | PrintHeaderKeys () |
Print a header containing the name of each column. More... | |
void | PrintHeaderComment (const std::string &cstart="# ") |
Print a header containing comments describing all of the columns. More... | |
const container_t | GetCurrentRows () const |
void | OutputLine (const data_t d) |
void | Update () override |
Run all of the functions and print the results as a new line in the file. More... | |
void | Update (size_t update) |
Update the file with an additional set of lines. More... | |
size_t | Add (const std::function< void(std::ostream &, data_t)> &fun, const std::string &key, const std::string &desc) |
template<typename T > | |
size_t | AddContainerFun (const std::function< T(const data_t)> &fun, const std::string &key="", const std::string &desc="") |
Add a function that returns a value to be printed to the file. More... | |
const std::string & | GetFilename () const |
Get the filename used for this file. More... | |
const std::string & | GetLineBegin () const |
Returns the string that is printed at the beginning of each line. More... | |
const std::string & | GetSpacer () const |
Returns the string that is printed between elements on each line (i.e. the delimeter). More... | |
const std::string & | GetLineEnd () const |
Returns the string that is printed at the end of each line. More... | |
void | SetTiming (time_fun_t fun) |
void | SetTimingOnce (size_t print_time) |
void | SetTimingRepeat (size_t step) |
Setup this file to print every 'step' updates. More... | |
void | SetTimingRange (size_t first, size_t step, size_t last) |
Setup this file to print only in a specified time range, and a given frequency (step). More... | |
void | SetLineBegin (const std::string &_in) |
Print. More... | |
void | SetSpacer (const std::string &_in) |
Print. More... | |
void | SetLineEnd (const std::string &_in) |
Print. More... | |
void | SetupLine (const std::string &b, const std::string &s, const std::string &e) |
Set line begin character (. More... | |
size_t | Add (const std::function< void(std::ostream &)> &fun, const std::string &key, const std::string &desc) |
template<typename T > | |
size_t | AddFun (const std::function< T()> &fun, const std::string &key="", const std::string &desc="") |
Add a function that returns a value to be printed to the file. More... | |
template<typename T > | |
size_t | AddVar (const T &var, const std::string &key="", const std::string &desc="") |
Add a function that always prints the current value of. More... | |
template<typename VAL_TYPE , emp::data... MODS> | |
size_t | AddCurrent (DataNode< VAL_TYPE, MODS... > &node, const std::string &key="", const std::string &desc="", const bool &reset=false, const bool &pull=false) |
template<typename VAL_TYPE , emp::data... MODS> | |
size_t | AddMean (DataNode< VAL_TYPE, MODS... > &node, const std::string &key="", const std::string &desc="", const bool &reset=false, const bool &pull=false) |
template<typename VAL_TYPE , emp::data... MODS> | |
size_t | AddTotal (DataNode< VAL_TYPE, MODS... > &node, const std::string &key="", const std::string &desc="", const bool &reset=false, const bool &pull=false) |
template<typename VAL_TYPE , emp::data... MODS> | |
size_t | AddMin (DataNode< VAL_TYPE, MODS... > &node, const std::string &key="", const std::string &desc="", const bool &reset=false, const bool &pull=false) |
template<typename VAL_TYPE , emp::data... MODS> | |
size_t | AddMax (DataNode< VAL_TYPE, MODS... > &node, const std::string &key="", const std::string &desc="", const bool &reset=false, const bool &pull=false) |
template<typename VAL_TYPE , emp::data... MODS> | |
size_t | AddVariance (DataNode< VAL_TYPE, MODS... > &node, const std::string &key="", const std::string &desc="", const bool &reset=false, const bool &pull=false) |
template<typename VAL_TYPE , emp::data... MODS> | |
size_t | AddStandardDeviation (DataNode< VAL_TYPE, MODS... > &node, const std::string &key="", const std::string &desc="", const bool &reset=false, const bool &pull=false) |
template<typename VAL_TYPE , emp::data... MODS> | |
size_t | AddSkew (DataNode< VAL_TYPE, MODS... > &node, const std::string &key="", const std::string &desc="", const bool &reset=false, const bool &pull=false) |
template<typename VAL_TYPE , emp::data... MODS> | |
size_t | AddKurtosis (DataNode< VAL_TYPE, MODS... > &node, const std::string &key="", const std::string &desc="", const bool &reset=false, const bool &pull=false) |
template<typename VAL_TYPE , emp::data... MODS> | |
void | AddStats (DataNode< VAL_TYPE, MODS... > &node, const std::string &key="", const std::string &desc="", const bool &reset=false, const bool &pull=false) |
template<typename VAL_TYPE , emp::data... MODS> | |
void | AddAllStats (DataNode< VAL_TYPE, MODS... > &node, const std::string &key="", const std::string &desc="", const bool &reset=false, const bool &pull=false) |
template<typename VAL_TYPE , emp::data... MODS> | |
size_t | AddHistBin (DataNode< VAL_TYPE, MODS... > &node, size_t bin_id, const std::string &key="", const std::string &desc="", const bool &reset=false, const bool &pull=false) |
template<typename VAL_TYPE , emp::data... MODS> | |
size_t | AddInferiority (DataNode< VAL_TYPE, MODS... > &node, const std::string &key="", const std::string &desc="", const bool &reset=false, const bool &pull=false) |
Protected Types | |
using | container_t = typename std::remove_reference< CONTAINER >::type |
using | raw_container_t = typename remove_ptr_type< container_t >::type |
using | data_t = typename raw_container_t::value_type |
using | container_fun_t = void(std::ostream &, data_t) |
using | fun_update_container_t = std::function< container_t(void)> |
using | fun_t = void(std::ostream &) |
using | time_fun_t = std::function< bool(size_t)> |
Protected Attributes | |
fun_update_container_t | update_container_fun |
container_t | current_rows |
FunctionSet< container_fun_t > | container_funs |
emp::vector< std::string > | container_keys |
emp::vector< std::string > | container_descs |
std::string | filename |
Name of the file that we are printing to (if one exists) More... | |
std::ostream * | os |
Stream to print to. More... | |
FunctionSet< fun_t > | funs |
Set of functions to call, one per column in the file. More... | |
emp::vector< std::string > | keys |
Keywords associated with each column. More... | |
emp::vector< std::string > | descs |
Full description for each column. More... | |
time_fun_t | timing_fun |
Function to determine updates to print on (default: all) More... | |
std::string | line_begin |
What should we print at the start of each line? More... | |
std::string | line_spacer |
What should we print between entries? More... | |
std::string | line_end |
What should we print at the end of each line? More... | |
Sometimes you may want a data file where a set of functions is run on every item in a container every time you write to the file. ContainerDataFiles do that.
Note: CONTAINER type can be a pointer to a container and the datafile will handle derefeferencing it appropriately.
|
protected |
|
protected |
|
protected |
|
protectedinherited |
|
protected |
|
protected |
|
protectedinherited |
|
inline |
|
inline |
|
inlineinherited |
If a function takes an ostream, pass in the correct one. Generic function for adding a column to the DataFile. In practice, you probably want to call one of the more specific ones.
|
inline |
If a function takes an ostream, pass in the correct one. Generic function for adding a column to the DataFile. In practice, you probably want to call one of the more specific ones.
|
inlineinherited |
Add multiple functions that pull all stats measurements (mean, variance, min, max, skew, and kurtosis) from the DataNode
node | Requires that |
node | have the data::Stats or data::FullStats modifier. |
key | and |
desc | will have the name of the stat appended to the beginning. Note: excludes standard deviation, because it is easily calculated from variance |
|
inline |
Add a function that returns a value to be printed to the file.
|
inlineinherited |
Add a function that always pulls the current value from the DataNode
node. | Requires that |
node | have the data::Current modifier. If |
reset | is set true, we will call Reset on that DataNode after pulling the current value from the node |
|
inlineinherited |
Add a function that returns a value to be printed to the file.
|
inlineinherited |
Add a function that always pulls the count of the
bin_id | 'th bin of the histogram from |
node. | Requires that |
node | have the data::Histogram modifier and at least bins. If |
reset | is set true, we will call Reset on that DataNode after pulling the current value from the node |
|
inlineinherited |
Add a function that always pulls the inferiority (mean divided by max) from the DataNode
node. | Requires that |
node | have the data::Range or data::FullRange modifier. If |
reset | is set true, we will call Reset on that DataNode after pulling the current value from the node |
|
inlineinherited |
Add a function that always pulls the kurtosis from the DataNode
node | Requires that |
node | have the data::Stats or data::FullStats modifier. |
|
inlineinherited |
Add a function that always pulls the maximum value from the DataNode
node. | Requires that |
node | have the data::Range or data::FullRange modifier. If |
reset | is set true, we will call Reset on that DataNode after pulling the current value from the node |
|
inlineinherited |
Add a function that always pulls the mean value from the DataNode
node. | Requires that |
node | have the data::Range or data::FullRange modifier. If |
reset | is set true, we will call Reset on that DataNode after pulling the current value from the node |
|
inlineinherited |
Add a function that always pulls the minimum value from the DataNode
node. | Requires that |
node | have the data::Range or data::FullRange modifier. If |
reset | is set true, we will call Reset on that DataNode after pulling the current value from the node |
|
inlineinherited |
Add a function that always pulls the skewness from the DataNode
node | Requires that |
node | have the data::Stats or data::FullStats modifier. |
|
inlineinherited |
Add a function that always pulls the standard deviation from the DataNode
node | Requires that |
node | have the data::Stats or data::FullStats modifier. |
|
inlineinherited |
Add multiple functions that pull common stats measurements (mean, variance, min, and max) from the DataNode
node. | Requires that |
node | have the data::Stats or data::FullStats modifier. |
key | and |
desc | will have the name of the stat appended to the beginning. Note: excludes standard deviation, because it is easily calculated from variance |
|
inlineinherited |
Add a function that always pulls the total value from the DataNode
node. | Requires that |
node | have the data::Range or data::FullRange modifier. If |
reset | is set true, we will call Reset on that DataNode after pulling the current value from the node |
|
inlineinherited |
Add a function that always prints the current value of.
var. |
|
inlineinherited |
Add a function that always pulls the variance from the DataNode
node | Requires that |
node | have the data::Stats or data::FullStats modifier. |
|
inline |
|
inlineinherited |
Get the filename used for this file.
|
inlineinherited |
Returns the string that is printed at the beginning of each line.
|
inlineinherited |
Returns the string that is printed at the end of each line.
|
inlineinherited |
Returns the string that is printed between elements on each line (i.e. the delimeter).
|
inline |
|
inlinevirtual |
Print a header containing comments describing all of the columns.
Reimplemented from emp::DataFile.
|
inlinevirtual |
Print a header containing the name of each column.
Reimplemented from emp::DataFile.
|
inlineinherited |
Print.
_in | at the beginning of each line. |
|
inlineinherited |
Print.
_in | at the end of each line. |
|
inlineinherited |
Print.
_in | between elements (i.e. make |
_in | the delimeter). |
|
inlineinherited |
Provide a timing function with a bool(size_t update) signature. The timing function is called with the update, and returns a bool to indicate if files should print this update.
|
inlineinherited |
Setup this file to print only once, at the specified update. Note that this timing function can be replaced at any time, even after being triggered.
|
inlineinherited |
Setup this file to print only in a specified time range, and a given frequency (step).
|
inlineinherited |
Setup this file to print every 'step' updates.
|
inline |
Tell this file what function to run to update the contents of the container that data is being calculated on.
|
inlineinherited |
Set line begin character (.
b),column | delimeter ( |
s),and | line end character ( |
e) |
|
inlineoverridevirtual |
Run all of the functions and print the results as a new line in the file.
Reimplemented from emp::DataFile.
|
inline |
Update the file with an additional set of lines.
|
protected |
|
protected |
|
protected |
|
protected |
|
protectedinherited |
Full description for each column.
|
protectedinherited |
Name of the file that we are printing to (if one exists)
|
protectedinherited |
Set of functions to call, one per column in the file.
|
protectedinherited |
Keywords associated with each column.
|
protectedinherited |
What should we print at the start of each line?
|
protectedinherited |
What should we print at the end of each line?
|
protectedinherited |
What should we print between entries?
|
protectedinherited |
Stream to print to.
|
protectedinherited |
Function to determine updates to print on (default: all)
|
protected |