OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
oofem::Dictionary Class Reference

This class implements a linked list whose entries are Pairs (see below). More...

#include <dictionary.h>

+ Collaboration diagram for oofem::Dictionary:

Public Member Functions

 Dictionary ()
 Constructor, creates empty dictionary. More...
 
 ~Dictionary ()
 Destructor. More...
 
void clear ()
 Clears the receiver. More...
 
Pairadd (int aKey, double value)
 Adds a new Pair with given keyword and value into receiver. More...
 
double & at (int aKey)
 Returns the value of the pair which key is aKey. More...
 
bool includes (int aKey)
 Checks if dictionary includes given key. More...
 
void printYourself ()
 Prints the receiver on screen. More...
 
void formatAsString (std::string &str)
 Formats itself as string. More...
 
int giveSize ()
 Returns number of pairs of receiver. More...
 
contextIOResultType saveContext (DataStream &stream, ContextMode mode, void *obj=NULL)
 Saves the receiver contends (state) to given stream. More...
 
contextIOResultType restoreContext (DataStream &stream, ContextMode mode, void *obj=NULL)
 Restores the receiver contents (state) from given stream. More...
 

Protected Attributes

Pairfirst
 First pair. More...
 
Pairlast
 Last pair. More...
 

Friends

std::ostream & operator<< (std::ostream &out, const Dictionary &r)
 

Detailed Description

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.

Constructor & Destructor Documentation

oofem::Dictionary::Dictionary ( )
inline

Constructor, creates empty dictionary.

Definition at line 68 of file dictionary.h.

References oofem::operator<<().

oofem::Dictionary::~Dictionary ( )

Destructor.

Definition at line 45 of file dictionary.C.

References clear().

Member Function Documentation

void oofem::Dictionary::clear ( )
void oofem::Dictionary::formatAsString ( std::string &  str)

Formats itself as string.

Definition at line 161 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().

contextIOResultType oofem::Dictionary::restoreContext ( DataStream stream,
ContextMode  mode,
void *  obj = NULL 
)

Restores the receiver contents (state) from given stream.

Returns
contextIOResultType value.
Exceptions
throwsan ContextIOERR exception if error encountered

Definition at line 218 of file dictionary.C.

References at(), oofem::CIO_IOERR, oofem::CIO_OK, clear(), oofem::DataStream::read(), and THROW_CIOERR.

Referenced by oofem::MasterDof::restoreContext().

contextIOResultType oofem::Dictionary::saveContext ( DataStream stream,
ContextMode  mode,
void *  obj = NULL 
)

Saves the receiver contends (state) to given stream.

Returns
contextIOResultType value.
Exceptions
throwsan ContextIOERR exception if error encountered

Definition at line 175 of file dictionary.C.

References oofem::CIO_IOERR, oofem::CIO_OK, first, oofem::Pair::giveKey(), oofem::Pair::giveNext(), oofem::Pair::giveValue(), THROW_CIOERR, and oofem::DataStream::write().

Referenced by oofem::MasterDof::saveContext().

Friends And Related Function Documentation

std :: ostream& operator<< ( std::ostream &  out,
const Dictionary r 
)
friend

Definition at line 253 of file dictionary.C.

Member Data Documentation

Pair* oofem::Dictionary::first
protected

First pair.

Definition at line 62 of file dictionary.h.

Referenced by add(), at(), clear(), formatAsString(), giveSize(), includes(), oofem::operator<<(), printYourself(), and saveContext().

Pair* oofem::Dictionary::last
protected

Last pair.

Definition at line 64 of file dictionary.h.

Referenced by add(), and clear().


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

This page is part of the OOFEM documentation. Copyright (c) 2011 Borek Patzak
Project e-mail: info@oofem.org
Generated at Tue Jan 2 2018 20:07:34 for OOFEM by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2011