Dynamic index set. More...
#include <didxset.h>
Public Member Functions | |
Adding | |
void | add (int n) |
adds n uninitialized indices. More... | |
void | add (const IdxSet &sv) |
adds all indices from sv . More... | |
void | add (int n, const int *i) |
adds n indices from i . More... | |
void | addIdx (int i) |
adds index i to the index set More... | |
void | setMax (int newmax=1) |
sets the maximum number of indices. More... | |
Construction / destruction | |
DIdxSet (int n=8) | |
default constructor. n gives the initial size of the index space. More... | |
DIdxSet (const IdxSet &old) | |
copy constructor from IdxSet. More... | |
DIdxSet (const DIdxSet &old) | |
copy constructor from DIdxSet. More... | |
DIdxSet & | operator= (const IdxSet &sv) |
assignment operator from IdxSet More... | |
DIdxSet & | operator= (const DIdxSet &sv) |
assignment operator from DIdxSet More... | |
virtual | ~DIdxSet () |
destructor. More... | |
Public Member Functions inherited from IdxSet | |
IdxSet (int n, int imem[], int l=0) | |
constructor. More... | |
IdxSet () | |
default constructor. More... | |
virtual | ~IdxSet () |
destructor. More... | |
IdxSet & | operator= (const IdxSet &set) |
assignment operator. More... | |
IdxSet (const IdxSet &) | |
copy constructor. More... | |
int | index (int n) const |
access n 'th index. More... | |
int | size () const |
returns the number of used indices. More... | |
int | max () const |
returns the maximal number of indices which can be stored in IdxSet. More... | |
int | dim () const |
returns the maximal index. More... | |
int | pos (int i) const |
returns the position of index i . More... | |
void | add (int n) |
appends n uninitialized indices. More... | |
void | add (const IdxSet &set) |
appends all indices of set . More... | |
void | add (int n, const int i[]) |
appends n indices in i . More... | |
void | addIdx (int i) |
appends index i . More... | |
void | remove (int n, int m) |
removes indices at position numbers n through m . More... | |
void | remove (int n) |
removes n 'th index. More... | |
void | clear () |
removes all indices. More... | |
bool | isConsistent () const |
consistency check. More... | |
Additional Inherited Members | |
Protected Attributes inherited from IdxSet | |
int | num |
number of used indices More... | |
int | len |
length of array idx More... | |
int * | idx |
array of indices More... | |
bool | freeArray |
true iff idx should be freed inside of this object More... | |
Dynamic index set.
Class DIdxSet provides dynamic IdxSet in the sense, that no restrictions are posed on the use of methods add(). However, method indexMem() has been moved to the private members. This is because DIdxSet adds its own memory management to class IdxSet and the user must not interfere with it.
Upon construction of an DIdxSet, memory is allocated automatically. The memory consumption can be controlled with methods max() and setMax(). Finally, the destructor will release all allocated memory.
|
explicit |
default constructor. n
gives the initial size of the index space.
Definition at line 64 of file didxset.cpp.
References IdxSet::idx, IdxSet::len, and soplex::spx_alloc().
copy constructor from IdxSet.
Definition at line 44 of file didxset.cpp.
References IdxSet::idx, IdxSet::len, IdxSet::operator=(), IdxSet::size(), and soplex::spx_alloc().
copy constructor from DIdxSet.
Definition at line 54 of file didxset.cpp.
References IdxSet::idx, IdxSet::len, IdxSet::operator=(), IdxSet::size(), and soplex::spx_alloc().
|
virtual |
destructor.
Definition at line 71 of file didxset.cpp.
References IdxSet::idx, and soplex::spx_free().
void add | ( | const IdxSet & | sv | ) |
adds all indices from sv
.
Definition at line 68 of file didxset.h.
References IdxSet::add(), IdxSet::max(), DIdxSet::setMax(), and IdxSet::size().
void add | ( | int | n | ) |
adds n
uninitialized indices.
Definition at line 59 of file didxset.h.
References IdxSet::add(), IdxSet::max(), DIdxSet::setMax(), and IdxSet::size().
void add | ( | int | n, |
const int * | i | ||
) |
adds n
indices from i
.
Definition at line 79 of file didxset.h.
References IdxSet::add(), IdxSet::max(), DIdxSet::setMax(), and IdxSet::size().
void addIdx | ( | int | i | ) |
adds index i
to the index set
Definition at line 88 of file didxset.h.
References IdxSet::addIdx(), IdxSet::max(), DIdxSet::setMax(), and IdxSet::size().
assignment operator from DIdxSet
Definition at line 128 of file didxset.h.
References IdxSet::operator=(), DIdxSet::setMax(), and IdxSet::size().
assignment operator from IdxSet
Definition at line 117 of file didxset.h.
References IdxSet::operator=(), DIdxSet::setMax(), and IdxSet::size().
void setMax | ( | int | newmax = 1 | ) |
sets the maximum number of indices.
This methods resets the memory consumption of the DIdxSet to newmax
. However, if newmax
< size(), it is reset to size() only.
Definition at line 31 of file didxset.cpp.
References IdxSet::idx, IdxSet::len, IdxSet::max(), IdxSet::size(), and soplex::spx_realloc().
Referenced by DIdxSet::add(), DIdxSet::addIdx(), and DIdxSet::operator=().