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

Reduce a Value of type vector<T> to just a T. More...

#include <value.hpp>

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

Public Member Functions

 Reduce (Function< T(std::vector< T >)> &reduce, Value< std::vector< T > > *v, const std::string alias="")
 
 Reduce (Function< T(std::vector< T >)> &reduce, const std::string &v_name, const std::string alias="")
 
- Public Member Functions inherited from fv::DerivedValue< T >
 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="")
 
- Public Member Functions inherited from fv::GenValue
 GenValue (const std::string &name, const std::string &alias)
 
const std::string & get_name ()
 

Protected Attributes

Value< std::vector< T > > * v
 
- Protected Attributes inherited from fv::DerivedValue< T >
value
 
bool value_valid
 

Private Member Functions

void update_value ()
 Updates the internal value. More...
 
virtual void verify_integrity ()
 This function serves to check that this Value has been created with real, i.e. More...
 

Private Attributes

Function< T(std::vector< T >)> & reduce
 

Additional Inherited Members

- Static Public Member Functions inherited from fv::GenValue
static void reset ()
 
static GenValueget_value (const std::string &name)
 
static void alias (const std::string &name, GenValue *value)
 
static GenValuealias (const std::string &name)
 
static std::string summary ()
 
- Static Protected Attributes inherited from fv::GenValue
static std::map< const std::string, GenValue * > values
 A static mapping containing all created Value objects. More...
 
static std::map< const std::string, GenValue * > aliases
 Composite value names are typically nested. More...
 

Detailed Description

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

Reduce a Value of type vector<T> to just a T.

This is useful functionality to model, for instance, calculating the maximum element of a vector, or a the mean. See child classes for specific implementations.

Member Function Documentation

§ update_value()

template<typename T>
void fv::Reduce< T >::update_value ( )
inlineprivatevirtual

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.

Implements fv::DerivedValue< T >.

§ verify_integrity()

template<typename T>
virtual void fv::Reduce< T >::verify_integrity ( )
inlineprivatevirtual

This function serves to check that this Value has been created with real, i.e.

non null, arguments. This is to avoid segfaulting when a dynamic_cast fails. If no checks need to be made, simple override this method with a no-op. If checks fail, the function should utilize the CRITICAL macro with a meaningfull error message stating what failed and especially the name of the current value.

Implements fv::GenValue.

Reimplemented in fv::ElementOf< T >, fv::Range< T >, fv::Mean< T >, fv::Min< T >, and fv::Max< T >.


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