Library for big numbers from http://www.ttmath.org/

Dependents:   PIDHeater82 Conceptcontroller_v_1_0 AlarmClockApp COG4050_adxl355_tilt ... more

Embed: (wiki syntax)

« Back to documentation index

History< ValueType > Class Template Reference

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

Definition at line 605 of file ttmathobjects.h.


Constructor & Destructor Documentation

History (  )

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

Definition at line 634 of file ttmathobjects.h.

History ( typename buffer_type::size_type  new_size )

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

Definition at line 644 of file ttmathobjects.h.


Member Function Documentation

void 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

Definition at line 655 of file ttmathobjects.h.

bool 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

Definition at line 676 of file ttmathobjects.h.

bool 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)

Definition at line 700 of file ttmathobjects.h.