TTTT Analysis  0.1
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
fv::DerivedValue< T > Class Template Referenceabstract

A Value derived from some other Values, not directly from the dataset. More...

#include <value.hpp>

Inheritance diagram for fv::DerivedValue< T >:
Inheritance graph
[legend]
Collaboration diagram for fv::DerivedValue< T >:
Collaboration graph
[legend]

Public Member Functions

 DerivedValue (const std::string &name, const std::string &alias="")
 
void log ()
 
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="")
 
void enable_logging (const std::function< std::string(T)> &value_to_string=[](T){return "";})
 
void disable_logging ()
 

Protected Member Functions

virtual void update_value ()=0
 Updates the internal value. More...
 

Protected Attributes

value
 
- Protected Attributes inherited from fv::Value< T >
std::function< std::string(T)> value_to_string
 

Detailed Description

template<typename T>
class fv::DerivedValue< T >

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.

Member Function Documentation

◆ update_value()

template<typename T>
virtual void fv::DerivedValue< T >::update_value ( )
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::Combinations< T, Size >, fv::ReduceIndex< T >, fv::Reduce< T >, fv::TupFilter< ArgTypes >, fv::Filter< T >, fv::Count< T >, fv::Apply< Ret(ArgTypes...)>, fv::DeTupVector< N, ArgTypes >, fv::DeTup< N, ArgTypes >, fv::Tuple< ArgTypes >, fv::Map< Ret(ArgTypes...)>, fv::Zip< ArgTypes >, fv::Pair< T1, T2 >, and fv::WrapperVector< T >.


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