93 newPair =
new Pair(k, v);
110 Pair *next, *newPair;
114 if ( next->
giveKey() == aKey ) {
121 newPair = this->
add(aKey, 0);
134 if ( next->
giveKey() == aKey ) {
150 printf(
"Dictionary : \n");
193 if ( !stream.
write(nitems) ) {
202 if ( !stream.
write(key) ) {
206 if ( !stream.
write(value) ) {
232 if ( !stream.
read(size) ) {
237 for (
int i = 1; i <= size; i++ ) {
238 if ( !stream.
read(key) ) {
242 if ( !stream.
read(value) ) {
246 this->
at(key) = value;
int giveKey()
Returns the receiver key.
void printYourself()
Prints the receiver on screen.
int giveSize()
Returns number of pairs of receiver.
double & at(int aKey)
Returns the value of the pair which key is aKey.
The purpose of DataStream abstract class is to allow to store/restore context to different streams...
friend std::ostream & operator<<(std::ostream &out, const Dictionary &r)
bool includes(int aKey)
Checks if dictionary includes given key.
contextIOResultType saveContext(DataStream &stream, ContextMode mode, void *obj=NULL)
Saves the receiver contends (state) to given stream.
void formatAsString(std::string &str)
Formats itself as string.
Pair * giveNext()
Returns pointer to the next pair.
virtual int read(int *data, int count)=0
Reads count integer values into array pointed by data.
double & giveValue()
Returns associated value.
virtual int write(const int *data, int count)=0
Writes count integer values from array pointed by data.
void printYourself()
Prints receiver to screen.
void clear()
Clears the receiver.
Pair * add(int aKey, double value)
Adds a new Pair with given keyword and value into receiver.
This class implements a linked list whose entries are Pairs (see below).
long ContextMode
Context mode (mask), defining the type of information written/read to/from context.
This class implements key/value associations - the key and its associated value.
void append(Pair *p)
Appends a given pair to itself (sets the pointer to next pair to given Pair).
the oofem namespace is to define a context or scope in which all oofem names are defined.
contextIOResultType restoreContext(DataStream &stream, ContextMode mode, void *obj=NULL)
Restores the receiver contents (state) from given stream.