TTTT Analysis
0.1
|
A Value derived from some other Values, not directly from the dataset. More...
#include <value.hpp>
Public Member Functions | |
DerivedValue (const std::string &name, const std::string &alias="") | |
T & | get_value () |
Calculate, if necessary, and return the value held by this object. | |
Public Member Functions inherited from fv::Value< T > | |
Value (const std::string &name, const std::string &alias="") | |
Protected Member Functions | |
virtual void | update_value ()=0 |
Updates the internal value. More... | |
Protected Attributes | |
T | value |
bool | value_valid |
Private Member Functions | |
void | _reset () |
A Value derived from some other Values, not directly from the dataset.
A DerivedValue is generally defined as some function of other Value objects. For example, a Pair is a function of two other Value objects that makes a pair of them. Note that these other Value objects are free to be either ObservedValues or other DerivedValues.
It is desireable from a performance standpoint that each DerivedValue be calculated no more than once per observation. Therefore, when a get_value is called on a DerivedValue, it first checks whether the value that it holds is valid, meaning it has already been calculated for this observation. If so, it simply returns the value. If not, the update_value function is called to calculate the value. and then the newly calculated value is marked as valid and returned.
|
protectedpure virtual |
Updates the internal value.
This function should be overridden by any child class to do the actual work of updating value based on whatever rules the class chooses. Normally, this consists of geting the values from some associated Value objects, doing some calculation on them, and storing the result in value.
Implemented in fv::ConstantValue< T >, fv::PointerValue< T >, fv::BoundValue< T >, fv::CartProduct< FST, SND >, fv::ReduceIndex< T >, fv::Reduce< T >, fv::Filter< T >, fv::Count< T >, fv::Apply< Ret(ArgTypes...)>, fv::Tuple< ArgTypes >, fv::Tuple< ArgTypes... >, fv::TupFilter< ArgTypes >, fv::Map< Ret(ArgTypes...)>, fv::Zip< ArgTypes >, fv::Pair< T1, T2 >, and fv::WrapperVector< T >.