carl  24.04
Computer ARithmetic Library
carl::Pool< Element > Class Template Reference

#include <Pool.h>

Inheritance diagram for carl::Pool< Element >:
Collaboration diagram for carl::Pool< Element >:

Public Member Functions

void print () const
 
std::pair< typename FastPointerSet< Element >::iterator, bool > insert (ElementPtr _element, bool _assertFreshness=false)
 Inserts the given element into the pool, if it does not yet occur in there. More...
 
ConstElementPtr add (ElementPtr _element)
 Adds the given element to the pool, if it does not yet occur in there. More...
 

Protected Member Functions

 Pool (unsigned _capacity=10000)
 Constructor of the pool. More...
 
 ~Pool ()
 
virtual void assignId (ElementPtr, std::size_t)
 Assigns a unique id to the generated element. More...
 

Private Types

using ElementPtr = Element *
 
using ConstElementPtr = const Element *
 

Private Attributes

unsigned mIdAllocator = 1
 id allocator More...
 
FastPointerSet< Element > mPool
 The formula pool. More...
 
std::mutex mMutexPool
 Mutex to avoid multiple access to the pool. More...
 

Detailed Description

template<typename Element>
class carl::Pool< Element >

Definition at line 20 of file Pool.h.

Member Typedef Documentation

◆ ConstElementPtr

template<typename Element >
using carl::Pool< Element >::ConstElementPtr = const Element*
private

Definition at line 25 of file Pool.h.

◆ ElementPtr

template<typename Element >
using carl::Pool< Element >::ElementPtr = Element*
private

Definition at line 24 of file Pool.h.

Constructor & Destructor Documentation

◆ Pool()

template<typename Element >
carl::Pool< Element >::Pool ( unsigned  _capacity = 10000)
inlineexplicitprotected

Constructor of the pool.

Parameters
_capacityExpected necessary capacity of the pool.

Definition at line 47 of file Pool.h.

◆ ~Pool()

template<typename Element >
carl::Pool< Element >::~Pool ( )
inlineprotected

Definition at line 51 of file Pool.h.

Member Function Documentation

◆ add()

template<typename Element >
ConstElementPtr carl::Pool< Element >::add ( ElementPtr  _element)
inline

Adds the given element to the pool, if it does not yet occur in there.

Note, that this method uses the allocator which is locked before calling.

Parameters
_elementThe element to add to the pool.
Returns
The given element, if it did not yet occur in the pool; The equivalent element already occurring in the pool, otherwise.

Definition at line 113 of file Pool.h.

Here is the call graph for this function:

◆ assignId()

template<typename Element >
virtual void carl::Pool< Element >::assignId ( ElementPtr  ,
std::size_t   
)
inlineprotectedvirtual

Assigns a unique id to the generated element.

Note that this method serves as a callback for subclasses. The actual assignment of the id is done there.

Parameters
_elementThe element for which to add the id.
_idA unique id.

Reimplemented in carl::BVTermPool, and carl::BVConstraintPool.

Definition at line 67 of file Pool.h.

Here is the caller graph for this function:

◆ insert()

template<typename Element >
std::pair<typename FastPointerSet<Element>::iterator, bool> carl::Pool< Element >::insert ( ElementPtr  _element,
bool  _assertFreshness = false 
)
inline

Inserts the given element into the pool, if it does not yet occur in there.

Parameters
_elementThe element to add to the pool.
_assertFreshnessWhen true, an assertion fails if the element is not fresh (i.e., if it already occurs in the pool).
Returns
The position of the given element in the pool and true, if it did not yet occur in the pool; The position of the equivalent element in the pool and false, otherwise.

Definition at line 89 of file Pool.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ print()

template<typename Element >
void carl::Pool< Element >::print ( ) const
inline

Definition at line 72 of file Pool.h.

Field Documentation

◆ mIdAllocator

template<typename Element >
unsigned carl::Pool< Element >::mIdAllocator = 1
private

id allocator

Definition at line 31 of file Pool.h.

◆ mMutexPool

template<typename Element >
std::mutex carl::Pool< Element >::mMutexPool
mutableprivate

Mutex to avoid multiple access to the pool.

Definition at line 35 of file Pool.h.

◆ mPool

template<typename Element >
FastPointerSet<Element> carl::Pool< Element >::mPool
private

The formula pool.

Definition at line 33 of file Pool.h.


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