Painless
A framework to ease parallelization of sequential CDCL SAT solvers
Loading...
Searching...
No Matches
ClauseDatabaseSingleBuffer Class Reference

This is just a ClauseDatabase wrapper around a ClauseBuufer. More...

#include <ClauseDatabaseSingleBuffer.hpp>

Inheritance diagram for ClauseDatabaseSingleBuffer:
Collaboration diagram for ClauseDatabaseSingleBuffer:

Public Member Functions

 ClauseDatabaseSingleBuffer ()=delete
 Default Constructor deleted to enforce parameterized constructor.
 
 ClauseDatabaseSingleBuffer (size_t bufferSize)
 
 ~ClauseDatabaseSingleBuffer () override=default
 Virtual destructor.
 
bool addClause (ClauseExchangePtr clause) override
 Adds a clause to the database.
 
size_t giveSelection (std::vector< ClauseExchangePtr > &selectedCls, unsigned int literalCountLimit) override
 Selects clauses up to the specified total size.
 
void getClauses (std::vector< ClauseExchangePtr > &v_cls) override
 Retrieves all clauses from the database.
 
bool getOneClause (ClauseExchangePtr &cls) override
 Retrieves a single clause from the database.
 
size_t getSize () const override
 Returns the current number of clauses in the database.
 
size_t shrinkDatabase () override
 Shrinks the database by clearing all clauses.
 
void clearDatabase () override
 Clears all clauses from the database.
 
- Public Member Functions inherited from ClauseDatabase
 ClauseDatabase ()
 Default Constructor.
 
virtual ~ClauseDatabase ()
 Virtual destructor to ensure proper cleanup of derived classes.
 

Detailed Description

This is just a ClauseDatabase wrapper around a ClauseBuufer.

This class provides a simple implementation of the ClauseDatabase interface using a single ClauseBuffer for clause storage and management.

I wanted ClauseBuffer to not implement ClauseDatabase to make it easier to change(independent).

Member Function Documentation

◆ addClause()

bool ClauseDatabaseSingleBuffer::addClause ( ClauseExchangePtr clause)
inlineoverridevirtual

Adds a clause to the database.

Parameters
clauseThe clause to be added.
Returns
True if the clause was successfully added, false otherwise.

Implements ClauseDatabase.

◆ clearDatabase()

void ClauseDatabaseSingleBuffer::clearDatabase ( )
inlineoverridevirtual

Clears all clauses from the database.

Implements ClauseDatabase.

◆ getClauses()

void ClauseDatabaseSingleBuffer::getClauses ( std::vector< ClauseExchangePtr > & v_cls)
inlineoverridevirtual

Retrieves all clauses from the database.

Parameters
v_clsVector to store the retrieved clauses.

Implements ClauseDatabase.

◆ getOneClause()

bool ClauseDatabaseSingleBuffer::getOneClause ( ClauseExchangePtr & cls)
inlineoverridevirtual

Retrieves a single clause from the database.

Parameters
clsShared pointer to store the retrieved clause.
Returns
True if a clause was retrieved, false if the database is empty.

Implements ClauseDatabase.

◆ getSize()

size_t ClauseDatabaseSingleBuffer::getSize ( ) const
inlineoverridevirtual

Returns the current number of clauses in the database.

Returns
The number of clauses in the database.

Implements ClauseDatabase.

◆ giveSelection()

size_t ClauseDatabaseSingleBuffer::giveSelection ( std::vector< ClauseExchangePtr > & selectedCls,
unsigned int literalCountLimit )
inlineoverridevirtual

Selects clauses up to the specified total size.

Parameters
selectedClsVector to store the selected clauses.
literalCountLimitThe maximum number of literals to select.
Returns
The number of literals in the selected clauses.
Note
This method fills the buffer without exceeding by getting one clause at a time.
Warning
This method may not select exactly literals if the last clause added exceeds the limit.

Implements ClauseDatabase.

◆ shrinkDatabase()

size_t ClauseDatabaseSingleBuffer::shrinkDatabase ( )
inlineoverridevirtual

Shrinks the database by clearing all clauses.

Returns
The number max size_t number
Warning
This method clears the entire database. All clauses will be removed. Does nothing
Returns
maximum size_t number

Implements ClauseDatabase.


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