Wrapper for boost::lockfree::queue to manage ClauseExchange objects.
More...
#include <ClauseBuffer.hpp>
|
| ClauseBuffer ()=delete |
| Default Constructor deleted to enforce parameterized constructor.
|
|
| ClauseBuffer (size_t size) |
| Constructs a ClauseBuffer with the specified size.
|
|
| ClauseBuffer (const ClauseBuffer &)=delete |
| Copy constructor (deleted).
|
|
| ClauseBuffer (const ClauseBuffer &&)=delete |
| Move constructor (deleted).
|
|
ClauseBuffer & | operator= (const ClauseBuffer &)=delete |
| Assignment operator (deleted).
|
|
| ClauseBuffer (ClauseBuffer &&)=default |
| Move constructor.
|
|
ClauseBuffer & | operator= (ClauseBuffer &&)=default |
| Move assignment operator.
|
|
| ~ClauseBuffer () |
| Destructor.
|
|
bool | addClause (ClauseExchangePtr clause) |
| Adds a single clause to the buffer.
|
|
size_t | addClauses (const std::vector< ClauseExchangePtr > &clauses) |
| Adds multiple clauses to the buffer.
|
|
bool | tryAddClauseBounded (ClauseExchangePtr clause) |
| Attempts to add a single clause to the buffer using bounded push.
|
|
size_t | tryAddClausesBounded (const std::vector< ClauseExchangePtr > &clauses) |
| Attempts to add multiple clauses to the buffer using bounded push.
|
|
bool | getClause (ClauseExchangePtr &clause) |
| Retrieves a single clause from the buffer.
|
|
void | getClauses (std::vector< ClauseExchangePtr > &clauses) |
| Retrieves all available clauses from the buffer.
|
|
size_t | size () const |
| Returns the current number of clauses in the buffer.
|
|
void | clear () |
| Clears all clauses from the buffer.
|
|
bool | empty () const |
| Checks if the buffer is empty.
|
|
Wrapper for boost::lockfree::queue to manage ClauseExchange objects.
This class utilizes a non-fixed size boost::lockfree::queue for efficient, lock-free operations between multiple producers and consumers. It uses raw pointers internally and provides a thread-safe interface for ClauseExchangePtr.
- Warning
- This class is currently non-copyable.
- Todo
- An optimal and safe move/copy mechanism
◆ ClauseBuffer()
ClauseBuffer::ClauseBuffer |
( |
size_t | size | ) |
|
|
inlineexplicit |
Constructs a ClauseBuffer with the specified size.
- Parameters
-
size | The initial capacity of the queue. |
◆ addClause()
bool ClauseBuffer::addClause |
( |
ClauseExchangePtr | clause | ) |
|
|
inline |
Adds a single clause to the buffer.
- Parameters
-
- Returns
- true if the clause was successfully added, false otherwise.
◆ addClauses()
size_t ClauseBuffer::addClauses |
( |
const std::vector< ClauseExchangePtr > & | clauses | ) |
|
|
inline |
Adds multiple clauses to the buffer.
- Parameters
-
clauses | A vector of clauses to add. |
- Returns
- The number of clauses successfully added.
◆ empty()
bool ClauseBuffer::empty |
( |
| ) |
const |
|
inline |
Checks if the buffer is empty.
- Returns
- true if the buffer is empty, false otherwise.
◆ getClause()
bool ClauseBuffer::getClause |
( |
ClauseExchangePtr & | clause | ) |
|
|
inline |
Retrieves a single clause from the buffer.
- Parameters
-
[out] | clause | The retrieved clause. |
- Returns
- true if a clause was retrieved, false if the buffer was empty.
◆ getClauses()
void ClauseBuffer::getClauses |
( |
std::vector< ClauseExchangePtr > & | clauses | ) |
|
|
inline |
Retrieves all available clauses from the buffer.
- Parameters
-
[out] | clauses | A vector to store the retrieved clauses. |
◆ size()
size_t ClauseBuffer::size |
( |
| ) |
const |
|
inline |
Returns the current number of clauses in the buffer.
- Returns
- The number of clauses in the buffer.
◆ tryAddClauseBounded()
bool ClauseBuffer::tryAddClauseBounded |
( |
ClauseExchangePtr | clause | ) |
|
|
inline |
Attempts to add a single clause to the buffer using bounded push.
This method tries to add a clause to the buffer using Boost's bounded_push operation. If the internal memory pool of the queue is exhausted, the operation will fail.
- Parameters
-
clause | The clause to add to the buffer. |
- Returns
- true if the clause was successfully added, false if the buffer is full or push failed.
◆ tryAddClausesBounded()
size_t ClauseBuffer::tryAddClausesBounded |
( |
const std::vector< ClauseExchangePtr > & | clauses | ) |
|
|
inline |
Attempts to add multiple clauses to the buffer using bounded push.
This method tries to add clauses to the buffer until either all clauses are added or a push operation fails (indicating the buffer is full).
- Parameters
-
clauses | A vector of clauses to add to the buffer. |
- Returns
- The number of clauses successfully added to the buffer.
The documentation for this class was generated from the following file: