23 #ifndef libmath_library_h
24 #define libmath_library_h
26 #include <math++/error.h>
49 TFunction(
const std::string& AName,
const std::string& AExprStr = std::string());
53 T call(
const T& AParam,
const TLibrary<T>& ALibrary,
unsigned ALimit = 64)
const;
55 void name(
const std::string&);
56 std::string name()
const;
58 void expression(
const TNode<T> *ACopyOf);
59 void expression(
const std::string& AExprStr);
75 TConstant(
const std::string& AName,
const T& AValue = T());
77 void name(
const std::string&);
78 std::string name()
const;
102 typedef std::list<TFunction<T> > TFunctionList;
103 typedef std::list<TConstant<T> > TConstantList;
105 TFunctionList FFunctions;
106 TConstantList FConstants;
108 void removeIf(
const std::string& AName,
bool AReplaceIfExists);
120 void remove(
const std::string& AName);
135 T
call(
const std::string& AName,
const T& AParam)
const;
137 T
value(
const std::string& AName)
const;
147 template<
typename T> std::ostream& operator<<(std::ostream&, const math::TFunction<T>&);
149 #include <math++/library.tcc>
TConstant< T > constant(const std::string &AName) const
returns reference to requested constant, throws if not fuond
T call(const std::string &AName, const T &AParam) const
call() looks for a function AName calls it using AParam and returns its result. It throws on lookup e...
bool hasFunction(const std::string &AName) const
returns true, if function (AName) exists
bool hasConstant(const std::string &AName) const
returns true, if constant (AName) exists
T value(const std::string &AName) const
value() look for a constant AName and returns its value. It throws on lookup error.
unsigned functions() const
returns the number of functions stored in this library.
void insert(const TFunction< T > &, bool AReplaceIfExists=false)
inserts given function into library, it throws if it's duplicated
unsigned constants() const
returns the number of constants stored in this library.