expression_tree  3.2
 All Classes Files Functions Variables Typedefs Pages
Public Member Functions | List of all members
expression_tree::cache_on_evaluation< T, ThreadingPolicy >::branch Class Reference

Implementation of a branch class that performs caching on evaluation. More...

#include <expression_tree.h>

Inheritance diagram for expression_tree::cache_on_evaluation< T, ThreadingPolicy >::branch:
Inheritance graph
[legend]
Collaboration diagram for expression_tree::cache_on_evaluation< T, ThreadingPolicy >::branch:
Collaboration graph
[legend]

Public Member Functions

 branch (const typename detail::operation< T >::t &f, const node< T, expression_tree::cache_on_evaluation, ThreadingPolicy > &l, const node< T, expression_tree::cache_on_evaluation, ThreadingPolicy > &r)
 Default constructor.
 
 branch (const branch &o)
 Copy constructor.
 
virtual T evaluate () const
 
virtual void grow ()
 When this branch grows (e.g. has its children modified), forget that the value was cached.
 
- Public Member Functions inherited from expression_tree::detail::default_branch< T, expression_tree::cache_on_evaluation, ThreadingPolicy >
 default_branch (const typename operation< T >::t &f, const node< T, expression_tree::cache_on_evaluation, ThreadingPolicy > &l, const node< T, expression_tree::cache_on_evaluation, ThreadingPolicy > &r)
 Constructor.
 
 default_branch (const default_branch< T, expression_tree::cache_on_evaluation, ThreadingPolicy > &other)
 Copy constructor.
 
virtual std::unique_ptr
< node_impl< T > > 
clone () const
 Clones this object.
 
virtual bool constant () const
 The constness of a branch is determined by the constness of its children.
 
virtual node< T,
expression_tree::cache_on_evaluation,
ThreadingPolicy > & 
left ()
 This branch's left child.
 
virtual node< T,
expression_tree::cache_on_evaluation,
ThreadingPolicy > & 
right ()
 This branch's right child.
 

Additional Inherited Members

- Public Attributes inherited from expression_tree::detail::default_branch< T, expression_tree::cache_on_evaluation, ThreadingPolicy >
node< T,
expression_tree::cache_on_evaluation,
ThreadingPolicy > 
l
 This branch's left child.
 
node< T,
expression_tree::cache_on_evaluation,
ThreadingPolicy > 
r
 This branch's right child.
 
operation< T >::t f
 Operation to be applied to this node's children.
 

Detailed Description

template<typename T, class ThreadingPolicy>
class expression_tree::cache_on_evaluation< T, ThreadingPolicy >::branch

Implementation of a branch class that performs caching on evaluation.

A caching-on-evaluation branch will apply its operation on its children when it is evaluated and cache that value if it is constant (e.g. if its children are of constant value).

Member Function Documentation

template<typename T , class ThreadingPolicy >
virtual T expression_tree::cache_on_evaluation< T, ThreadingPolicy >::branch::evaluate ( ) const
inlinevirtual

If the value of this branch has been cached already, return it. Otherwise, evaluate it and determine if this branch is constant. If it is, considered the value as cached to re-use later.

Reimplemented from expression_tree::detail::default_branch< T, expression_tree::cache_on_evaluation, ThreadingPolicy >.


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