souffle
2.0.2-371-g6315b36
|
Go to the documentation of this file.
17 unsigned long __inline __builtin_clzll(
unsigned long long value) {
18 unsigned long msb = 0;
20 if (_BitScanReverse64(&msb, value))
59 blockSize *
sizeof(T));
75 inline size_t size()
const {
83 inline T&
get(
size_t index)
const {
85 size_t blockNum = (63 - __builtin_clzll(nindex));
86 size_t blockInd = (nindex) & ((1 << blockNum) - 1);
104 this->
get(index) = value;
190 size_t new_index =
m_size.fetch_add(1, std::memory_order_acquire);
206 this->
get(new_index) = element;
211 size_t new_index =
m_size.fetch_add(1, std::memory_order_acquire);
235 inline T&
get(
size_t index)
const {
238 size_t blockNum = (63 - __builtin_clzll(nindex));
239 size_t blockInd = (nindex) & ((1 << blockNum) - 1);
255 class iterator : std::iterator<std::forward_iterator_tag, T> {
287 return x.
cIndex == this->cIndex && x.
bl == this->
bl;
291 return !(x == *
this);
296 return iterator(
this);
299 return iterator(
this,
size());
T & get(size_t index) const
Retrieve a reference to the stored value at index.
size_t size() const
Well, returns the number of nodes exist within the list + number of nodes queued to be inserted The r...
const T operator*() const
PiggyList(size_t initialbitsize)
void insertAt(size_t index, T value)
T * getBlock(size_t blocknum) const
T & get(size_t index) const
bool operator==(const iterator &x) const
const size_t INITIALBLOCKSIZE
RandomInsertPiggyList(size_t initialbitsize)
std::array< std::atomic< T * >, maxContainers > blockLookupTable
std::atomic< size_t > num_containers
std::atomic< size_t > numElements
iterator(PiggyList *bl, size_t beginInd)
std::array< T *, max_conts > blockLookupTable
void clear()
Clear all elements from the PiggyList.
A 'sequential' non-locking implementation for a spin lock.
RandomInsertPiggyList & operator=(RandomInsertPiggyList &other)=delete
PiggyList(const PiggyList &other)
copy constructor
PiggyList & operator=(const PiggyList &other)=delete
copy assign ctor
bool operator!=(const iterator &x) const
T * getBlock(size_t blockNum) const
void freeList()
Free the arrays allocated within the linked list nodes.
std::atomic< size_t > m_size
RandomInsertPiggyList(const RandomInsertPiggyList &other)
copy constructor
std::atomic< size_t > container_size
RandomInsertPiggyList()=default
void freeList()
Free the arrays allocated within the linked list nodes.
A PiggyList that allows insertAt functionality.
static constexpr size_t maxContainers
static constexpr size_t max_conts
iterator & operator++(int)