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::SegmentHandle Class Reference
Collaboration diagram for duckdb::SegmentHandle:

Public Member Functions

 SegmentHandle (FixedSizeBuffer &buffer_p, const idx_t offset)
 
 SegmentHandle (const SegmentHandle &)=delete
 
SegmentHandleoperator= (const SegmentHandle &)=delete
 
 SegmentHandle (SegmentHandle &&other) noexcept
 
SegmentHandleoperator= (SegmentHandle &&other) noexcept
 
template<class T >
const T & GetRef () const
 
template<class T >
T & GetRef ()
 
template<class T = data_t>
T * GetPtr ()
 
template<class T = data_t>
const T * GetPtr () const
 
void MarkModified ()
 

Private Attributes

optional_ptr< FixedSizeBufferbuffer_ptr
 
data_ptr_t ptr
 

Constructor & Destructor Documentation

◆ SegmentHandle() [1/2]

duckdb::SegmentHandle::SegmentHandle ( FixedSizeBuffer buffer_p,
const idx_t  offset 
)
inline
11585 : buffer_ptr(buffer_p) {
11586 lock_guard<mutex> l(buffer_ptr->lock);
11587
11588 if (!buffer_ptr->InMemory() && !buffer_ptr->loaded) {
11589 buffer_ptr->LoadFromDisk();
11590 }
11591 if (!buffer_ptr->InMemory() && buffer_ptr->loaded) {
11592 buffer_ptr->block_manager.buffer_manager.Pin(buffer_ptr->block_handle);
11593 }
11594
11595 ptr = buffer_ptr->buffer_handle.Ptr() + offset;
11596 buffer_ptr->readers++;
11597 }

◆ ~SegmentHandle()

duckdb::SegmentHandle::~SegmentHandle ( )
inline
11599 {
11600 if (!buffer_ptr) {
11601 return;
11602 }
11603 buffer_ptr->readers--;
11604 buffer_ptr = nullptr;
11605 ptr = nullptr;
11606
11607 // FIXME: Enable unpinning buffers with zero readers while preventing oscillation.
11608 // FIXME: loaded must be set to true.
11609 }

◆ SegmentHandle() [2/2]

duckdb::SegmentHandle::SegmentHandle ( SegmentHandle &&  other)
inlinenoexcept
11614 : buffer_ptr(other.buffer_ptr), ptr(other.ptr) {
11615 other.buffer_ptr = nullptr;
11616 other.ptr = nullptr;
11617 }

Member Function Documentation

◆ operator=()

SegmentHandle & duckdb::SegmentHandle::operator= ( SegmentHandle &&  other)
inlinenoexcept
11618 {
11619 if (this != &other) {
11620 // Decrement reader count for existing handle if it exists
11621 if (buffer_ptr) {
11622 buffer_ptr->readers--;
11623 }
11624 buffer_ptr = other.buffer_ptr;
11625 ptr = other.ptr;
11626 other.buffer_ptr = nullptr;
11627 other.ptr = nullptr;
11628 }
11629 return *this;
11630 }

◆ GetRef() [1/2]

template<class T >
const T & duckdb::SegmentHandle::GetRef ( ) const
inline
11634 {
11635 return *reinterpret_cast<const T *>(ptr);
11636 }

◆ GetRef() [2/2]

template<class T >
T & duckdb::SegmentHandle::GetRef ( )
inline
11639 {
11640 return *reinterpret_cast<T *>(ptr);
11641 }

◆ GetPtr() [1/2]

template<class T = data_t>
T * duckdb::SegmentHandle::GetPtr ( )
inline
11644 {
11645 return reinterpret_cast<T *>(ptr);
11646 }

◆ GetPtr() [2/2]

template<class T = data_t>
const T * duckdb::SegmentHandle::GetPtr ( ) const
inline
11649 {
11650 return reinterpret_cast<T *>(ptr);
11651 }

◆ MarkModified()

void duckdb::SegmentHandle::MarkModified ( )
inline
11653 {
11654 lock_guard<mutex> l(buffer_ptr->lock);
11655 buffer_ptr->dirty = true;
11656 }

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