|
OOFEM 3.0
|
#include <dictionary.h>
Public Member Functions | |
| Dictionary () | |
| Constructor, creates empty dictionary. | |
| ~Dictionary () | |
| Destructor. | |
| Dictionary (const Dictionary &other) | |
| copy constructor | |
| Dictionary & | operator= (const Dictionary &other) |
| copy assignment constructor | |
| void | clear () |
| Clears the receiver. | |
| Pair * | add (int aKey, double value) |
| double & | at (int aKey) |
| double | at (int aKey) const |
| bool | includes (int aKey) const |
| void | printYourself () |
| Prints the receiver on screen. | |
| void | formatAsString (std ::string &str) |
| Formats itself as string. | |
| int | giveSize () |
| Returns number of pairs of receiver. | |
| void | saveContext (DataStream &stream) |
| void | restoreContext (DataStream &stream) |
Protected Attributes | |
| Pair * | first |
| First pair. | |
| Pair * | last |
| Last pair. | |
Friends | |
| std::ostream & | operator<< (std ::ostream &out, const Dictionary &r) |
This class implements a linked list whose entries are Pairs (see below).
Dictionaries are typically used by degrees of freedom for storing their unknowns. A dictionary stores its pairs in a linked list form. It knows the first pair (attribute 'first') of the list. It also knows the last one (attribute 'last') in order to append an additional pair fast.
Definition at line 58 of file dictionary.h.
|
inline |
Constructor, creates empty dictionary.
Definition at line 68 of file dictionary.h.
Referenced by Dictionary(), operator<<, and operator=().
| oofem::Dictionary::~Dictionary | ( | ) |
|
inline |
copy constructor
Definition at line 73 of file dictionary.h.
References add(), Dictionary(), first, oofem::Pair::giveKey(), oofem::Pair::giveNext(), and oofem::Pair::giveValue().
| Pair * oofem::Dictionary::add | ( | int | aKey, |
| double | value ) |
Adds a new Pair with given keyword and value into receiver.
| aKey | key of new pair |
| value | value of new pair |
Definition at line 79 of file dictionary.C.
References first, includes(), last, and OOFEM_ERROR.
Referenced by oofem::AdditiveManufacturingProblem::add_element_if_not_exists2(), oofem::AdditiveManufacturingProblem::add_node_if_not_exists2(), at(), Dictionary(), oofem::OOFEMTXTInputRecord::giveField(), oofem::XMLInputRecord::giveField(), and operator=().
| double & oofem::Dictionary::at | ( | int | aKey | ) |
Returns the value of the pair which key is aKey. If requested key doesn't exist, it is created with assigned value 0.
| aKey | Key for pair. |
Definition at line 103 of file dictionary.C.
References add(), first, oofem::Pair::giveKey(), oofem::Pair::giveNext(), and oofem::Pair::giveValue().
Referenced by restoreContext().
| double oofem::Dictionary::at | ( | int | aKey | ) | const |
Definition at line 121 of file dictionary.C.
References first, oofem::Pair::giveKey(), oofem::Pair::giveNext(), oofem::Pair::giveValue(), and OOFEM_ERROR.
| void oofem::Dictionary::clear | ( | ) |
Clears the receiver.
Definition at line 52 of file dictionary.C.
Referenced by oofem::OOFEMTXTInputRecord::giveField(), operator=(), restoreContext(), and ~Dictionary().
| void oofem::Dictionary::formatAsString | ( | std ::string & | str | ) |
Formats itself as string.
Definition at line 168 of file dictionary.C.
References first, oofem::Pair::giveKey(), oofem::Pair::giveNext(), and oofem::Pair::giveValue().
| int oofem::Dictionary::giveSize | ( | ) |
Returns number of pairs of receiver.
Definition at line 67 of file dictionary.C.
References first, and oofem::Pair::giveNext().
| bool oofem::Dictionary::includes | ( | int | aKey | ) | const |
Checks if dictionary includes given key
| aKey | Dictionary key. |
Definition at line 135 of file dictionary.C.
References first, oofem::Pair::giveKey(), and oofem::Pair::giveNext().
Referenced by add().
|
inline |
copy assignment constructor
Definition at line 82 of file dictionary.h.
References add(), clear(), Dictionary(), first, oofem::Pair::giveKey(), oofem::Pair::giveNext(), and oofem::Pair::giveValue().
| void oofem::Dictionary::printYourself | ( | ) |
Prints the receiver on screen.
Definition at line 152 of file dictionary.C.
References first, oofem::Pair::giveNext(), and oofem::Pair::printYourself().
| void oofem::Dictionary::restoreContext | ( | DataStream & | stream | ) |
Restores the receiver contents (state) from given stream.
| throws | an ContextIOERR exception if error encountered |
Definition at line 218 of file dictionary.C.
References at(), oofem::CIO_IOERR, clear(), oofem::DataStream::read(), and THROW_CIOERR.
| void oofem::Dictionary::saveContext | ( | DataStream & | stream | ) |
Saves the receiver contends (state) to given stream.
| throws | an ContextIOERR exception if error encountered |
Definition at line 182 of file dictionary.C.
References oofem::CIO_IOERR, first, oofem::Pair::giveKey(), oofem::Pair::giveNext(), oofem::Pair::giveValue(), THROW_CIOERR, and oofem::DataStream::write().
|
friend |
Definition at line 247 of file dictionary.C.
References Dictionary(), first, oofem::Pair::giveKey(), oofem::Pair::giveNext(), and oofem::Pair::giveValue().
|
protected |
First pair.
Definition at line 62 of file dictionary.h.
Referenced by add(), at(), at(), clear(), Dictionary(), Dictionary(), formatAsString(), giveSize(), includes(), operator<<, operator=(), printYourself(), and saveContext().
|
protected |
Last pair.
Definition at line 64 of file dictionary.h.
Referenced by add(), clear(), and Dictionary().