6.31 ABA_NONDUPLPOOL< BaseType, CoType > Class Template Reference

class ABA_NONDUPLPOOL provides an ABA_STANDARDPOOL with the additional feature that the same constraint is at most stored once in the pool. For constraints and variables inserted in this pool the virtual member functions name(), hashKey(), and equal() of the base class ABA_CONVAR have to be defined

#include <nonduplpool.h>

Inheritance diagram for ABA_NONDUPLPOOL< BaseType, CoType >::


PIC


Public Member Functions

Private Member Functions

Private Attributes

6.31.1 Detailed Description

template<class BaseType, class CoType> class ABA_NONDUPLPOOL< BaseType, CoType >

class ABA_NONDUPLPOOL provides an ABA_STANDARDPOOL with the additional feature that the same constraint is at most stored once in the pool. For constraints and variables inserted in this pool the virtual member functions name(), hashKey(), and equal() of the base class ABA_CONVAR have to be defined

Parameters:

hash_
A hash table for a fast access to the pool slot storing a constraint/variable.
nDuplications_
The number of insertions of constraints/variables that were rejected since the constraint/variable is stored already in the pool.

Definition at line 52 of file nonduplpool.h.

6.31.2 Constructor & Destructor Documentation

6.31.2.1 template<class BaseType, class CoType> ABA_NONDUPLPOOL< BaseType, CoType >::ABA_NONDUPLPOOL (ABA_MASTER * master, int size, bool autoRealloc = false)

The constructor for an empty pool.

Parameters:

master
A pointer to the corresponding master of the optimization.
size
The maximal number of items which can be inserted in the pool without reallocation.
autoRealloc
If this argument is true an automatic reallocation is performed if the pool is full.

6.31.2.2 template<class BaseType, class CoType> virtual ABA_NONDUPLPOOL< BaseType, CoType >::~ABA_NONDUPLPOOL () [virtual]

The destructor.

6.31.2.3 template<class BaseType, class CoType> ABA_NONDUPLPOOL< BaseType, CoType >::ABA_NONDUPLPOOL (const ABA_NONDUPLPOOL< BaseType, CoType > & rhs) [private]

6.31.3 Member Function Documentation

6.31.3.1 template<class BaseType, class CoType> virtual ABA_POOLSLOT<BaseType, CoType>* ABA_NONDUPLPOOL< BaseType, CoType >::insert (BaseType * cv) [virtual]

Before the function insert() tries to insert a constraint/variable in the pool, it checks if the constraint/variable is already contained in the pool. If the constraint/variable cv is contained in the pool, it is deleted.

Returns:

A pointer to the pool slot where the item has been inserted, or a pointer to the pool slot if the item is already contained in the pool, or 0 if the insertion failed.

Parameters:

cv
The constraint/variable being inserted.

Reimplemented from ABA_STANDARDPOOL< BaseType, CoType >.

6.31.3.2 template<class BaseType, class CoType> virtual ABA_POOLSLOT<BaseType, CoType>* ABA_NONDUPLPOOL< BaseType, CoType >::present (BaseType * cv) [virtual]

Checks if a constraint/variables is already contained in the pool.

Returns:

A pointer to the pool slot storing a constraint/variable that is equivalent to cv according to the function ABA_CONVAR::equal(). If there is no such constraint/variable 0 is returned.

Parameters:

cv
A pointer to a constraint/variable for which it should be checked if an equivalent item is already contained in the pool.

6.31.3.3 template<class BaseType, class CoType> virtual void ABA_NONDUPLPOOL< BaseType, CoType >::increase (int size) [virtual]

Enlarges the pool to store.

To avoid fatal errors we do not allow decreasing the size of the pool. This function redefines the virtual function of the base class ABA_STANDARDPOOL because we have to reallocate the hash table.

Parameters:

size
The new size of the pool.

Reimplemented from ABA_STANDARDPOOL< BaseType, CoType >.

6.31.3.4 template<class BaseType, class CoType> void ABA_NONDUPLPOOL< BaseType, CoType >::statistics (int & nDuplications, int & nCollisions) const

Determines the number of constraints that have not been inserted into the pool, because an equivalent was already present.

Also the number of collisions in the hash table is computed. If this number is high, it might indicate that your hash function is not chosen very well.

Parameters:

nDuplications
The number of constraints that have not been inserted into the pool because an equivalent one was already present.
nCollisions
The number of collisions in the hash table.

6.31.3.5 template<class BaseType, class CoType> virtual int ABA_NONDUPLPOOL< BaseType, CoType >::softDeleteConVar (ABA_POOLSLOT< BaseType, CoType > * slot) [private, virtual]

Has to be redefined because the slot has to be removed from the hash table if the constraint/variable can be deleted.

Returns:

0 If the constraint/variable could be deleted.

1 otherwise.

Parameters:

slot
A pointer to the pool slot from wich the constraint/variable should be deleted.

Reimplemented from ABA_POOL< BaseType, CoType >.

6.31.3.6 template<class BaseType, class CoType> virtual void ABA_NONDUPLPOOL< BaseType, CoType >::hardDeleteConVar (ABA_POOLSLOT< BaseType, CoType > * slot) [private, virtual]

Has to be redefined because the pool slot has to be removed from the hash table.

Parameters:

slot
A pointer to the pool slot from wich the constraint/variable should be deleted.

Reimplemented from ABA_POOL< BaseType, CoType >.

6.31.3.7 template<class BaseType, class CoType> const ABA_NONDUPLPOOL& ABA_NONDUPLPOOL< BaseType, CoType >::operator= (const ABA_NONDUPLPOOL< BaseType, CoType > & rhs) [private]

6.31.4 Member Data Documentation

6.31.4.1 template<class BaseType, class CoType> ABA_HASH<unsigned, ABA_POOLSLOT<BaseType, CoType>*> ABA_NONDUPLPOOL< BaseType, CoType >::hash_ [private]

Definition at line 142 of file nonduplpool.h.

6.31.4.2 template<class BaseType, class CoType> int ABA_NONDUPLPOOL< BaseType, CoType >::nDuplications_ [private]

Definition at line 143 of file nonduplpool.h.

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