5#include <boost/intrusive_ptr.hpp>
13using simpleClause = std::vector<int>;
25using ClauseExchangePtr = boost::intrusive_ptr<ClauseExchange>;
57 static ClauseExchangePtr
create(
const unsigned int size,
const unsigned int lbd = 0,
const int from = -1);
68 static ClauseExchangePtr
create(
const int*
begin,
const int*
end,
const unsigned int lbd = 0,
const int from = -1);
78 static ClauseExchangePtr
create(
const std::vector<int>& v_cls,
const unsigned int lbd = 0,
const int from = -1);
92 assert(index <
size &&
"Index out of bounds");
103 assert(index <
size &&
"Index out of bounds");
153 refCounter.fetch_add(1, std::memory_order_relaxed);
181 ce->
refCounter.fetch_add(1, std::memory_order_relaxed);
191 if (ce->
refCounter.fetch_sub(1, std::memory_order_acq_rel) == 1) {
Represents an exchangeable clause with flexible array member.
Definition ClauseExchange.hpp:42
int lits[0]
Flexible array member for storing clause literals (must be last)
Definition ClauseExchange.hpp:48
static ClauseExchangePtr create(const int *begin, const int *end, const unsigned int lbd=0, const int from=-1)
Create a new ClauseExchange object using pointers.
ClauseExchange * toRawPtr()
Convert to a raw pointer and increment the reference count.
Definition ClauseExchange.hpp:151
const int * end() const
Get const iterator to the end of the clause.
Definition ClauseExchange.hpp:129
int & operator[](unsigned int index)
Access clause literal by index.
Definition ClauseExchange.hpp:90
int * begin()
Get iterator to the beginning of the clause.
Definition ClauseExchange.hpp:111
void sortLiteralsDescending()
Sort the literals in descending order.
Definition ClauseExchange.hpp:139
static ClauseExchangePtr fromRawPtr(ClauseExchange *ptr)
Create an intrusive_ptr from a raw pointer.
Definition ClauseExchange.hpp:162
int from
Source identifier of the clause.
Definition ClauseExchange.hpp:45
std::atomic< unsigned int > refCounter
Counter for intrusive_ptr copies and raw pointer conversions.
Definition ClauseExchange.hpp:47
int * end()
Get iterator to the end of the clause.
Definition ClauseExchange.hpp:117
std::string toString() const
Convert the clause to a string representation.
static ClauseExchangePtr create(const std::vector< int > &v_cls, const unsigned int lbd=0, const int from=-1)
Create a new ClauseExchange object from a vector of literals.
~ClauseExchange()=default
Destructor.
void sortLiterals()
Sort the literals in ascending order.
Definition ClauseExchange.hpp:134
static ClauseExchangePtr create(const unsigned int size, const unsigned int lbd=0, const int from=-1)
Create a new ClauseExchange object.
const int * begin() const
Get const iterator to the beginning of the clause.
Definition ClauseExchange.hpp:123
unsigned int lbd
Literal Block Distance (LBD) of the clause.
Definition ClauseExchange.hpp:44
const int & operator[](unsigned int index) const
Access clause literal by index (const version).
Definition ClauseExchange.hpp:101
unsigned int size
Size of the clause.
Definition ClauseExchange.hpp:46