carl  24.04
Computer ARithmetic Library
carl::BVTermPool Class Reference

#include <BVTermPool.h>

Inheritance diagram for carl::BVTermPool:
Collaboration diagram for carl::BVTermPool:

Public Types

using Term = BVTermContent
 
using TermPtr = Term *
 
using ConstTermPtr = const Term *
 

Public Member Functions

 BVTermPool ()
 
 BVTermPool (const BVTermPool &)=delete
 
BVTermPooloperator= (const BVTermPool &)=delete
 
ConstTermPtr create ()
 
ConstTermPtr create (BVTermType _type, BVValue &&_value)
 
ConstTermPtr create (BVTermType _type, const BVVariable &_variable)
 
ConstTermPtr create (BVTermType _type, const BVTerm &_operand, std::size_t _index=0)
 
ConstTermPtr create (BVTermType _type, const BVTerm &_first, const BVTerm &_second)
 
ConstTermPtr create (BVTermType _type, const BVTerm &_operand, std::size_t _first, std::size_t _last)
 
void assignId (TermPtr _term, std::size_t _id) override
 Assigns a unique id to the generated element. More...
 
void print () const
 
std::pair< typename FastPointerSet< BVTermContent >::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...
 

Static Public Member Functions

static BVTermPoolgetInstance ()
 Returns the single instance of this class by reference. More...
 

Private Types

using ElementPtr = BVTermContent *
 
using ConstElementPtr = const BVTermContent *
 

Private Attributes

friend Singleton< BVTermPool >
 
ConstTermPtr mpInvalid
 
unsigned mIdAllocator
 id allocator More...
 
FastPointerSet< BVTermContentmPool
 The formula pool. More...
 
std::mutex mMutexPool
 Mutex to avoid multiple access to the pool. More...
 

Detailed Description

Definition at line 13 of file BVTermPool.h.

Member Typedef Documentation

◆ ConstElementPtr

using carl::Pool< BVTermContent >::ConstElementPtr = const BVTermContent *
privateinherited

Definition at line 25 of file Pool.h.

◆ ConstTermPtr

Definition at line 20 of file BVTermPool.h.

◆ ElementPtr

using carl::Pool< BVTermContent >::ElementPtr = BVTermContent *
privateinherited

Definition at line 24 of file Pool.h.

◆ Term

Definition at line 18 of file BVTermPool.h.

◆ TermPtr

Definition at line 19 of file BVTermPool.h.

Constructor & Destructor Documentation

◆ BVTermPool() [1/2]

carl::BVTermPool::BVTermPool ( )

Definition at line 11 of file BVTermPool.cpp.

◆ BVTermPool() [2/2]

carl::BVTermPool::BVTermPool ( const BVTermPool )
delete

Member Function Documentation

◆ add()

ConstElementPtr carl::Pool< BVTermContent >::add ( ElementPtr  _element)
inlineinherited

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.

◆ assignId()

void carl::BVTermPool::assignId ( TermPtr  ,
std::size_t   
)
overridevirtual

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 from carl::Pool< BVTermContent >.

Definition at line 176 of file BVTermPool.cpp.

◆ create() [1/6]

BVTermPool::ConstTermPtr carl::BVTermPool::create ( )

Definition at line 16 of file BVTermPool.cpp.

Here is the caller graph for this function:

◆ create() [2/6]

BVTermPool::ConstTermPtr carl::BVTermPool::create ( BVTermType  _type,
BVValue &&  _value 
)

Definition at line 21 of file BVTermPool.cpp.

Here is the call graph for this function:

◆ create() [3/6]

BVTermPool::ConstTermPtr carl::BVTermPool::create ( BVTermType  _type,
const BVTerm _first,
const BVTerm _second 
)

Definition at line 63 of file BVTermPool.cpp.

Here is the call graph for this function:

◆ create() [4/6]

BVTermPool::ConstTermPtr carl::BVTermPool::create ( BVTermType  _type,
const BVTerm _operand,
std::size_t  _first,
std::size_t  _last 
)

Definition at line 164 of file BVTermPool.cpp.

Here is the call graph for this function:

◆ create() [5/6]

BVTermPool::ConstTermPtr carl::BVTermPool::create ( BVTermType  _type,
const BVTerm _operand,
std::size_t  _index = 0 
)

Definition at line 31 of file BVTermPool.cpp.

Here is the call graph for this function:

◆ create() [6/6]

BVTermPool::ConstTermPtr carl::BVTermPool::create ( BVTermType  _type,
const BVVariable _variable 
)

Definition at line 26 of file BVTermPool.cpp.

Here is the call graph for this function:

◆ getInstance()

static BVTermPool & carl::Singleton< BVTermPool >::getInstance ( )
inlinestaticinherited

Returns the single instance of this class by reference.

If there is no instance yet, a new one is created.

Definition at line 45 of file Singleton.h.

◆ insert()

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

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.

◆ operator=()

BVTermPool& carl::BVTermPool::operator= ( const BVTermPool )
delete

◆ print()

void carl::Pool< BVTermContent >::print ( ) const
inlineinherited

Definition at line 72 of file Pool.h.

Field Documentation

◆ mIdAllocator

unsigned carl::Pool< BVTermContent >::mIdAllocator
privateinherited

id allocator

Definition at line 31 of file Pool.h.

◆ mMutexPool

std::mutex carl::Pool< BVTermContent >::mMutexPool
mutableprivateinherited

Mutex to avoid multiple access to the pool.

Definition at line 35 of file Pool.h.

◆ mpInvalid

ConstTermPtr carl::BVTermPool::mpInvalid
private

Definition at line 23 of file BVTermPool.h.

◆ mPool

FastPointerSet<BVTermContent > carl::Pool< BVTermContent >::mPool
privateinherited

The formula pool.

Definition at line 33 of file Pool.h.

◆ Singleton< BVTermPool >

Definition at line 15 of file BVTermPool.h.


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