SoPlex Documentation
Loading...
Searching...
No Matches
DIdxSet Class Reference

Dynamic index set. More...

#include <didxset.h>

Inheritance diagram for DIdxSet:
IdxSet

Public Member Functions

Adding
void add (int n)
 adds n uninitialized indices.
 
void add (const IdxSet &sv)
 adds all indices from sv.
 
void add (int n, const int *i)
 adds n indices from i.
 
void addIdx (int i)
 adds index i to the index set
 
void setMax (int newmax=1)
 sets the maximum number of indices.
 
Construction / destruction
 DIdxSet (int n=8)
 default constructor. n gives the initial size of the index space.
 
 DIdxSet (const IdxSet &old)
 copy constructor from IdxSet.
 
 DIdxSet (const DIdxSet &old)
 copy constructor from DIdxSet.
 
DIdxSetoperator= (const IdxSet &sv)
 assignment operator from IdxSet
 
DIdxSetoperator= (const DIdxSet &sv)
 assignment operator from DIdxSet
 
virtual ~DIdxSet ()
 destructor.
 
- Public Member Functions inherited from IdxSet
 IdxSet (int n, int imem[], int l=0)
 constructor.
 
 IdxSet ()
 default constructor.
 
virtual ~IdxSet ()
 destructor.
 
IdxSetoperator= (const IdxSet &set)
 assignment operator.
 
 IdxSet (const IdxSet &)
 copy constructor.
 
int index (int n) const
 access n 'th index.
 
int size () const
 returns the number of used indices.
 
int max () const
 returns the maximal number of indices which can be stored in IdxSet.
 
int dim () const
 returns the maximal index.
 
int pos (int i) const
 returns the position of index i.
 
void add (int n)
 appends n uninitialized indices.
 
void add (const IdxSet &set)
 appends all indices of set.
 
void add (int n, const int i[])
 appends n indices in i.
 
void addIdx (int i)
 appends index i.
 
void remove (int n, int m)
 removes indices at position numbers n through m.
 
void remove (int n)
 removes n 'th index.
 
void clear ()
 removes all indices.
 
bool isConsistent () const
 consistency check.
 

Additional Inherited Members

- Protected Attributes inherited from IdxSet
int num
 number of used indices
 
int len
 length of array idx
 
int * idx
 array of indices
 
bool freeArray
 true iff idx should be freed inside of this object
 

Detailed Description

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.

Definition at line 51 of file didxset.h.

Constructor & Destructor Documentation

◆ DIdxSet() [1/3]

DIdxSet ( int n = 8)
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().

◆ DIdxSet() [2/3]

DIdxSet ( const IdxSet & old)
explicit

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().

◆ DIdxSet() [3/3]

DIdxSet ( const DIdxSet & old)

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().

◆ ~DIdxSet()

~DIdxSet ( )
virtual

destructor.

Definition at line 71 of file didxset.cpp.

References IdxSet::idx, and soplex::spx_free().

Member Function Documentation

◆ add() [1/3]

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().

◆ add() [2/3]

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().

◆ add() [3/3]

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().

◆ addIdx()

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().

◆ operator=() [1/2]

DIdxSet & operator= ( const DIdxSet & sv)

assignment operator from DIdxSet

Definition at line 128 of file didxset.h.

References IdxSet::operator=(), DIdxSet::setMax(), and IdxSet::size().

◆ operator=() [2/2]

DIdxSet & operator= ( const IdxSet & sv)

assignment operator from IdxSet

Definition at line 117 of file didxset.h.

References IdxSet::operator=(), DIdxSet::setMax(), and IdxSet::size().

◆ setMax()

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::add(), DIdxSet::add(), DIdxSet::addIdx(), DIdxSet::operator=(), and DIdxSet::operator=().