Autonomy Software C++ 24.5.1
Welcome to the Autonomy Software repository of the Mars Rover Design Team (MRDT) at Missouri University of Science and Technology (Missouri S&T)! API reference contains the source code and other resources for the development of the autonomy software for our Mars rover. The Autonomy Software project aims to compete in the University Rover Challenge (URC) by demonstrating advanced autonomous capabilities and robust navigation algorithms.
Loading...
Searching...
No Matches
duckdb_moodycamel::ConcurrentQueue< T, Traits >::Block Struct Reference
Collaboration diagram for duckdb_moodycamel::ConcurrentQueue< T, Traits >::Block:

Public Member Functions

template<InnerQueueContext context>
bool is_empty () const
template<InnerQueueContext context>
bool set_empty (MOODYCAMEL_MAYBE_UNUSED index_t i)
template<InnerQueueContext context>
bool set_many_empty (MOODYCAMEL_MAYBE_UNUSED index_t i, size_t count)
template<InnerQueueContext context>
void set_all_empty ()
template<InnerQueueContext context>
void reset_empty ()
T * operator[] (index_t idx) MOODYCAMEL_NOEXCEPT
T const * operator[] (index_t idx) const MOODYCAMEL_NOEXCEPT

Public Attributes

Block * next
std::atomic< size_t > elementsCompletelyDequeued
std::atomic< bool > emptyFlags [BLOCK_SIZE<=EXPLICIT_BLOCK_EMPTY_COUNTER_THRESHOLD ? BLOCK_SIZE :1]
std::atomic< std::uint32_t > freeListRefs
std::atomic< Block * > freeListNext
std::atomic< bool > shouldBeOnFreeList
bool dynamicallyAllocated

Private Member Functions

 MOODYCAMEL_ALIGNAS (MOODYCAMEL_ALIGNOF(T)) char elements[sizeof(T) *BLOCK_SIZE]

Constructor & Destructor Documentation

◆ Block()

template<typename T, typename Traits = ConcurrentQueueDefaultTraits>
duckdb_moodycamel::ConcurrentQueue< T, Traits >::Block::Block ( )
inline
332308 : next(nullptr), elementsCompletelyDequeued(0), freeListRefs(0), freeListNext(nullptr), shouldBeOnFreeList(false), dynamicallyAllocated(true)
332309 {
332310#ifdef MCDBGQ_TRACKMEM
332311 owner = nullptr;
332312#endif
332313 }
Definition duckdb.cpp:331497

Member Function Documentation

◆ is_empty()

template<typename T, typename Traits = ConcurrentQueueDefaultTraits>
template<InnerQueueContext context>
bool duckdb_moodycamel::ConcurrentQueue< T, Traits >::Block::is_empty ( ) const
inline
332317 {
332319 // Check flags
332320 for (size_t i = 0; i < BLOCK_SIZE; ++i) {
332321 if (!emptyFlags[i].load(std::memory_order_relaxed)) {
332322 return false;
332323 }
332324 }
332325
332326 // Aha, empty; make sure we have all other memory effects that happened before the empty flags were set
332328 return true;
332329 }
332330 else {
332331 // Check counter
332332 if (elementsCompletelyDequeued.load(std::memory_order_relaxed) == BLOCK_SIZE) {
332334 return true;
332335 }
332336 assert(elementsCompletelyDequeued.load(std::memory_order_relaxed) <= BLOCK_SIZE);
332337 return false;
332338 }
332339 }
#define assert(x)
Definition duckdb.cpp:486071

◆ set_empty()

template<typename T, typename Traits = ConcurrentQueueDefaultTraits>
template<InnerQueueContext context>
bool duckdb_moodycamel::ConcurrentQueue< T, Traits >::Block::set_empty ( MOODYCAMEL_MAYBE_UNUSED index_t i)
inline
332344 {
332346 // Set flag
332347 assert(!emptyFlags[BLOCK_SIZE - 1 - static_cast<size_t>(i & static_cast<index_t>(BLOCK_SIZE - 1))].load(std::memory_order_relaxed));
332348 emptyFlags[BLOCK_SIZE - 1 - static_cast<size_t>(i & static_cast<index_t>(BLOCK_SIZE - 1))].store(true, std::memory_order_release);
332349 return false;
332350 }
332351 else {
332352 // Increment counter
332353 auto prevVal = elementsCompletelyDequeued.fetch_add(1, std::memory_order_release);
332355 return prevVal == BLOCK_SIZE - 1;
332356 }
332357 }

◆ set_many_empty()

template<typename T, typename Traits = ConcurrentQueueDefaultTraits>
template<InnerQueueContext context>
bool duckdb_moodycamel::ConcurrentQueue< T, Traits >::Block::set_many_empty ( MOODYCAMEL_MAYBE_UNUSED index_t i,
size_t count )
inline
332363 {
332365 // Set flags
332367 i = BLOCK_SIZE - 1 - static_cast<size_t>(i & static_cast<index_t>(BLOCK_SIZE - 1)) - count + 1;
332368 for (size_t j = 0; j != count; ++j) {
332369 assert(!emptyFlags[i + j].load(std::memory_order_relaxed));
332370 emptyFlags[i + j].store(true, std::memory_order_relaxed);
332371 }
332372 return false;
332373 }
332374 else {
332375 // Increment counter
332376 auto prevVal = elementsCompletelyDequeued.fetch_add(count, std::memory_order_release);
332378 return prevVal + count == BLOCK_SIZE;
332379 }
332380 }

◆ set_all_empty()

template<typename T, typename Traits = ConcurrentQueueDefaultTraits>
template<InnerQueueContext context>
void duckdb_moodycamel::ConcurrentQueue< T, Traits >::Block::set_all_empty ( )
inline
332384 {
332386 // Set all flags
332387 for (size_t i = 0; i != BLOCK_SIZE; ++i) {
332388 emptyFlags[i].store(true, std::memory_order_relaxed);
332389 }
332390 }
332391 else {
332392 // Reset counter
332393 elementsCompletelyDequeued.store(BLOCK_SIZE, std::memory_order_relaxed);
332394 }
332395 }

◆ reset_empty()

template<typename T, typename Traits = ConcurrentQueueDefaultTraits>
template<InnerQueueContext context>
void duckdb_moodycamel::ConcurrentQueue< T, Traits >::Block::reset_empty ( )
inline
332399 {
332401 // Reset flags
332402 for (size_t i = 0; i != BLOCK_SIZE; ++i) {
332403 emptyFlags[i].store(false, std::memory_order_relaxed);
332404 }
332405 }
332406 else {
332407 // Reset counter
332408 elementsCompletelyDequeued.store(0, std::memory_order_relaxed);
332409 }
332410 }

◆ operator[]() [1/2]

template<typename T, typename Traits = ConcurrentQueueDefaultTraits>
T * duckdb_moodycamel::ConcurrentQueue< T, Traits >::Block::operator[] ( index_t idx)
inline
332412{ return static_cast<T*>(static_cast<void*>(elements)) + static_cast<size_t>(idx & static_cast<index_t>(BLOCK_SIZE - 1)); }

◆ operator[]() [2/2]

template<typename T, typename Traits = ConcurrentQueueDefaultTraits>
T const * duckdb_moodycamel::ConcurrentQueue< T, Traits >::Block::operator[] ( index_t idx) const
inline
332413{ return static_cast<T const*>(static_cast<void const*>(elements)) + static_cast<size_t>(idx & static_cast<index_t>(BLOCK_SIZE - 1)); }

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