GiNaCRA  0.6.4
GiNaCRA::SymbolDB Class Reference

Class encapsulating the global variable and the global parameter list. More...

#include <SymbolDB.h>

Collaboration diagram for GiNaCRA::SymbolDB:

Public Member Functions

 SymbolDB (std::string stdname)
 Constructs the lookup table for variables.
const symbol operator[] (unsigned i) const
 Returns the i-th variable.
unsigned operator[] (const symbol &v) const
 Returns the index belonging to the given variable s (in lexicographic order).
unsigned addSymbol ()
 Add a symbol with the standardname and a indexnumber.
unsigned addSymbol (std::string name)
 Add a symbol with name name.
unsigned addSymbol (symbol s)
std::list< symbol > getSymbolList () const
std::vector< symbol > getSymbolVector () const
unsigned size ()

Protected Attributes

vector< symbol > mVariables
std::map< symbol, unsigned,
GiNaC::ex_is_less > 
mSymbollist
std::string mStdName

Detailed Description

Class encapsulating the global variable and the global parameter list.

Author:
Ulrich Loup
Since:
2011-12-07
Version:
2011-12-15

Notation is following http://www.possibility.com/Cpp/CppCodingStandard.html.

Definition at line 46 of file SymbolDB.h.


Constructor & Destructor Documentation

GiNaCRA::SymbolDB::SymbolDB ( std::string  stdname)

Constructs the lookup table for variables.

The variables are sorted lexicographically.

Parameters:
stdnameThe standard name new symbols get
Runtime complexity:
O( n*log(n) ) where n is the number of variables

Definition at line 45 of file SymbolDB.cpp.


Member Function Documentation

Add a symbol with the standardname and a indexnumber.

Returns:
the indexnumber.

Definition at line 64 of file SymbolDB.cpp.

References mStdName, mSymbollist, mVariables, and size().

Referenced by GiNaCRA::VariableListPool::addParameter(), GiNaCRA::VariableListPool::addVariable(), GiNaCRA::VariableListPool::ensureNrVariables(), and GiNaCRA::VariableListPool::Initialize().

unsigned GiNaCRA::SymbolDB::addSymbol ( std::string  name)

Add a symbol with name name.

Parameters:
name
Returns:
the indexnumber

Definition at line 76 of file SymbolDB.cpp.

References mSymbollist, mVariables, and size().

unsigned GiNaCRA::SymbolDB::addSymbol ( symbol  s)
Parameters:
s
Returns:

Definition at line 88 of file SymbolDB.cpp.

References mSymbollist, mVariables, and size().

std::list<symbol> GiNaCRA::SymbolDB::getSymbolList ( ) const [inline]
Runtime complexity:
linear
Returns:
the symbollist as a list.

Definition at line 104 of file SymbolDB.h.

References mVariables.

Referenced by GiNaCRA::VariableListPool::getVariableList().

std::vector<symbol> GiNaCRA::SymbolDB::getSymbolVector ( ) const [inline]
Runtime complexity:
linear
Returns:
the symbollist as a vector

Definition at line 113 of file SymbolDB.h.

References mVariables.

Referenced by GiNaCRA::VariableListPool::getVariables().

const symbol GiNaCRA::SymbolDB::operator[] ( unsigned  i) const

Returns the i-th variable.

Parameters:
i
Returns:
the i-th variable

Definition at line 53 of file SymbolDB.cpp.

References mVariables.

unsigned GiNaCRA::SymbolDB::operator[] ( const symbol &  v) const

Returns the index belonging to the given variable s (in lexicographic order).

Parameters:
v
Returns:
the index belonging to v
Runtime complexity:
O( log(n) ) where n is the number of variables
Exceptions:
throw(out_of_range);

Definition at line 58 of file SymbolDB.cpp.

References mSymbollist.

unsigned GiNaCRA::SymbolDB::size ( ) [inline]

Definition at line 118 of file SymbolDB.h.

References mVariables.

Referenced by addSymbol(), and GiNaCRA::VariableListPool::ensureNrVariables().


Field Documentation

std::string GiNaCRA::SymbolDB::mStdName [protected]

Definition at line 126 of file SymbolDB.h.

Referenced by addSymbol().

std::map<symbol, unsigned, GiNaC::ex_is_less> GiNaCRA::SymbolDB::mSymbollist [protected]

Definition at line 125 of file SymbolDB.h.

Referenced by addSymbol(), and operator[]().

vector<symbol> GiNaCRA::SymbolDB::mVariables [protected]

Definition at line 124 of file SymbolDB.h.

Referenced by addSymbol(), getSymbolList(), getSymbolVector(), operator[](), and size().


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