#include <ArrayBuffer.h>

Public Member Functions | |
| ArrayBuffer () | |
| Constructs an empty ArrayBuffer, without initial memory allocation. | |
| ArrayBuffer (INDEX size) | |
| Constructs an empty ArrayBuffer, allocating memory for up to size elements. | |
| void | init () |
| Reinitializes the array, clearing it, and without initial memory allocation. | |
| void | init (INDEX size) |
| Reinitializes the array, clearing it, and allocating memory for up to size elements. | |
| void | clear () |
| Clears the buffer. | |
| const E & | top () const |
| Returns the newest element of the buffer. | |
| E & | top () |
| Returns the newest element of the buffer. | |
| void | push (E e) |
| Puts a new element in the buffer. | |
| void | pop () |
| Removes the newest element from the buffer. | |
| E | popRet () |
| Removes the newest element from the buffer and returns it. | |
| bool | empty () const |
| Returns true if the buffer is empty, false otherwise. | |
| INDEX | size () const |
| Returns number of elements in the buffer. | |
| const E & | operator[] (INDEX i) const |
| Returns a reference to the element at position i. | |
| E & | operator[] (INDEX i) |
| Returns a reference to the element at position i. | |
| void | compactCopy (Array< E, INDEX > &A2) const |
| Generates a compact copy holding the current elements. | |
| void | compactCpycon (Array< E, INDEX > &A2) const |
| Generates a compact copy holding the current elements. | |
| void | compactMemcpy (Array< E, INDEX > &A2) const |
| Generates a compact copy holding the current elements. | |
| INDEX | linearSearch (const E &x) const |
| Performs a linear search for element x. | |
| INDEX | linearSearch (const E &x, Comparer< E > &comp) const |
| Performs a linear search for element x with comparer comp. | |
Private Attributes | |
| INDEX | num |
| The number of elements in te buffer. | |
This is a growable array (with some initial size s) which starts out being empty. Using stack functions you can put elements into and out of it. The initial array size is automatically expanded if neccessary, but never automatically shrunken. You may also access the elements it contains using the []-operator. Tha valid indices are 0..(s - 1).
Definition at line 69 of file ArrayBuffer.h.
| ogdf::ArrayBuffer< E, INDEX >::ArrayBuffer | ( | ) | [inline] |
Constructs an empty ArrayBuffer, without initial memory allocation.
Definition at line 73 of file ArrayBuffer.h.
| ogdf::ArrayBuffer< E, INDEX >::ArrayBuffer | ( | INDEX | size | ) | [inline, explicit] |
Constructs an empty ArrayBuffer, allocating memory for up to size elements.
Definition at line 75 of file ArrayBuffer.h.
| void ogdf::ArrayBuffer< E, INDEX >::init | ( | ) | [inline] |
Reinitializes the array, clearing it, and without initial memory allocation.
Reimplemented from ogdf::Array< E, INDEX >.
Definition at line 78 of file ArrayBuffer.h.
| void ogdf::ArrayBuffer< E, INDEX >::init | ( | INDEX | size | ) | [inline] |
Reinitializes the array, clearing it, and allocating memory for up to size elements.
Reimplemented from ogdf::Array< E, INDEX >.
Definition at line 80 of file ArrayBuffer.h.
| void ogdf::ArrayBuffer< E, INDEX >::clear | ( | ) | [inline] |
| const E& ogdf::ArrayBuffer< E, INDEX >::top | ( | ) | const [inline] |
| E& ogdf::ArrayBuffer< E, INDEX >::top | ( | ) | [inline] |
| void ogdf::ArrayBuffer< E, INDEX >::push | ( | E | e | ) | [inline] |
| void ogdf::ArrayBuffer< E, INDEX >::pop | ( | ) | [inline] |
| E ogdf::ArrayBuffer< E, INDEX >::popRet | ( | ) | [inline] |
Removes the newest element from the buffer and returns it.
Definition at line 100 of file ArrayBuffer.h.
| bool ogdf::ArrayBuffer< E, INDEX >::empty | ( | ) | const [inline] |
| INDEX ogdf::ArrayBuffer< E, INDEX >::size | ( | ) | const [inline] |
Returns number of elements in the buffer.
Reimplemented from ogdf::Array< E, INDEX >.
Definition at line 106 of file ArrayBuffer.h.
| const E& ogdf::ArrayBuffer< E, INDEX >::operator[] | ( | INDEX | i | ) | const [inline] |
Returns a reference to the element at position i.
Reimplemented from ogdf::Array< E, INDEX >.
Definition at line 109 of file ArrayBuffer.h.
| E& ogdf::ArrayBuffer< E, INDEX >::operator[] | ( | INDEX | i | ) | [inline] |
Returns a reference to the element at position i.
Reimplemented from ogdf::Array< E, INDEX >.
Definition at line 114 of file ArrayBuffer.h.
| void ogdf::ArrayBuffer< E, INDEX >::compactCopy | ( | Array< E, INDEX > & | A2 | ) | const [inline] |
Generates a compact copy holding the current elements.
Creates a copy of the ArrayBuffer and stores it into the given Array A. A has exactly the neccessary size to hold all elements in the buffer.
This method uses an elementwise operator=. If you need a bitcopy of the buffer, use compactMemcpy instead; if you need a traditional array copy (using the Array's copy-constructor) use compactCpyCon instead.
Definition at line 131 of file ArrayBuffer.h.
| void ogdf::ArrayBuffer< E, INDEX >::compactCpycon | ( | Array< E, INDEX > & | A2 | ) | const [inline] |
Generates a compact copy holding the current elements.
Creates a copy of the ArrayBuffer and stores it into the given Array A. A has exactly the neccessary size to hold all elements in the buffer.
This method uses the Array's copy constructur. If you need a bitcopy of the buffer, use compactMemcpy instead; if you neeed a elementwise operator=-copy, use compactCopy instead.
Definition at line 153 of file ArrayBuffer.h.
| void ogdf::ArrayBuffer< E, INDEX >::compactMemcpy | ( | Array< E, INDEX > & | A2 | ) | const [inline] |
Generates a compact copy holding the current elements.
Creates a copy of the ArrayBuffer and stores it into the given Array A. A has exactly the neccessary size to hold all elements in the buffer.
This method uses memcpy. If you need a traditional arraycopy using a copy constructur, use compactCopy instead; if you neeed a elementwise operator=-copy, use compactCopy instead.
Definition at line 176 of file ArrayBuffer.h.
| INDEX ogdf::ArrayBuffer< E, INDEX >::linearSearch | ( | const E & | x | ) | const [inline] |
Performs a linear search for element x.
Warning: linear running time! Note that the linear search runs from back to front.
Reimplemented from ogdf::Array< E, INDEX >.
Definition at line 191 of file ArrayBuffer.h.
| INDEX ogdf::ArrayBuffer< E, INDEX >::linearSearch | ( | const E & | x, | |
| Comparer< E > & | comp | |||
| ) | const [inline] |
Performs a linear search for element x with comparer comp.
Warning: linear running time! Note that the linear search runs from back to front.
Reimplemented from ogdf::Array< E, INDEX >.
Definition at line 205 of file ArrayBuffer.h.
INDEX ogdf::ArrayBuffer< E, INDEX >::num [private] |