GEOS  3.8.0dev
Public Member Functions | List of all members
ttmath::History< ValueType > Class Template Reference

#include <ttmathobjects.h>

Public Member Functions

 History ()
 History (typename buffer_type::size_type new_size)
void Add (const ValueType &key, const ValueType &value, ErrorCode err)
bool Get (const ValueType &key, ValueType &value, ErrorCode &err)
bool Remove (const ValueType &key)

Detailed Description

template<class ValueType>
class ttmath::History< ValueType >

objects of the class History are used to keep values in functions which take a lot of time during calculating, for instance in the function Factorial(x)

it means that when we're calculating e.g. Factorial(1000) and the Factorial finds that we have calculated it before, the value (result) is taken from the history

Constructor & Destructor Documentation

template<class ValueType>
ttmath::History< ValueType >::History ( )

default constructor default max size of the History's container is 15 items

template<class ValueType>
ttmath::History< ValueType >::History ( typename buffer_type::size_type  new_size)

a constructor which takes another value of the max size of the History's container

Member Function Documentation

template<class ValueType>
void ttmath::History< ValueType >::Add ( const ValueType &  key,
const ValueType &  value,
ErrorCode  err 

this method adds one item into the History if the size of the container is greater than buffer_max_size the first item will be removed

template<class ValueType>
bool ttmath::History< ValueType >::Get ( const ValueType &  key,
ValueType &  value,
ErrorCode err 

this method checks whether we have an item which has the key equal 'key'

if there's such item the method sets the 'value' and the 'err' and returns true otherwise it returns false and 'value' and 'err' remain unchanged

template<class ValueType>
bool ttmath::History< ValueType >::Remove ( const ValueType &  key)

this methods deletes an item

we assume that there is only one item with the 'key' (this methods removes the first one)

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