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::Event Class Referenceabstract
Inheritance diagram for duckdb::Event:
Collaboration diagram for duckdb::Event:

Public Member Functions

 Event (Executor &executor)
virtual void Schedule ()=0
virtual void FinishEvent ()
 Called right after the event is finished.
virtual void FinalizeFinish ()
 Called after the event is entirely finished.
void FinishTask ()
void Finish ()
void AddDependency (Event &event)
bool HasDependencies () const
const vector< reference< Event > > & GetParentsVerification () const
void CompleteDependency ()
void SetTasks (vector< shared_ptr< Task > > tasks)
void InsertEvent (shared_ptr< Event > replacement_event)
bool IsFinished () const
virtual void PrintPipeline ()
ClientContext & GetClientContext ()
template<class TARGET>
TARGET & Cast ()
template<class TARGET>
const TARGET & Cast () const
Public Member Functions inherited from duckdb::enable_shared_from_this< Event >
shared_ptr< Event > shared_from_this ()

Protected Attributes

Executor & executor
atomic< idx_t > finished_tasks
 The current threads working on the event.
atomic< idx_t > total_tasks
 The maximum amount of threads that can work on the event.
atomic< idx_t > finished_dependencies
idx_t total_dependencies
 The total amount of dependencies.
vector< weak_ptr< Event > > parents
 The events that depend on this event to run.
vector< reference< Event > > parents_raw
 Raw pointers to the parents (used for verification only).
atomic< bool > finished
 Whether or not the event is finished executing.

Additional Inherited Members

Protected Member Functions inherited from duckdb::enable_shared_from_this< Event >
enable_shared_from_this & operator= (enable_shared_from_this const &) noexcept

Constructor & Destructor Documentation

◆ Event()

duckdb::Event::Event ( Executor & executor)
explicit
328010 : executor(executor_p), finished_tasks(0), total_tasks(0), finished_dependencies(0), total_dependencies(0),
328011 finished(false) {
328012}
idx_t total_dependencies
The total amount of dependencies.
Definition duckdb.cpp:35109
atomic< bool > finished
Whether or not the event is finished executing.
Definition duckdb.cpp:35117
atomic< idx_t > finished_dependencies
Definition duckdb.cpp:35107
atomic< idx_t > total_tasks
The maximum amount of threads that can work on the event.
Definition duckdb.cpp:35103
atomic< idx_t > finished_tasks
The current threads working on the event.
Definition duckdb.cpp:35101

Member Function Documentation

◆ FinishEvent()

◆ FinalizeFinish()

virtual void duckdb::Event::FinalizeFinish ( )
inlinevirtual

Called after the event is entirely finished.

Reimplemented in duckdb::PipelineCompleteEvent.

35060 {
35061 }

◆ FinishTask()

void duckdb::Event::FinishTask ( )
328056 {
328057 D_ASSERT(finished_tasks.load() < total_tasks.load());
328058 idx_t current_tasks = total_tasks;
328059 idx_t current_finished = ++finished_tasks;
328060 D_ASSERT(current_finished <= current_tasks);
328061 if (current_finished == current_tasks) {
328062 Finish();
328063 }
328064}
uint64_t idx_t
a saner size_t for loop indices etc
Definition duckdb.hpp:237

◆ Finish()

void duckdb::Event::Finish ( )
328027 {
328028 D_ASSERT(!finished);
328029 FinishEvent();
328030 finished = true;
328031 // finished processing the pipeline, now we can schedule pipelines that depend on this pipeline
328032 for (auto &parent_entry : parents) {
328033 auto parent = parent_entry.lock();
328034 if (!parent) { // LCOV_EXCL_START
328035 continue;
328036 } // LCOV_EXCL_STOP
328037 // mark a dependency as completed for each of the parents
328038 parent->CompleteDependency();
328039 }
328040 FinalizeFinish();
328041}
virtual void FinishEvent()
Called right after the event is finished.
Definition duckdb.cpp:35057
virtual void FinalizeFinish()
Called after the event is entirely finished.
Definition duckdb.cpp:35060
vector< weak_ptr< Event > > parents
The events that depend on this event to run.
Definition duckdb.cpp:35112

◆ AddDependency()

void duckdb::Event::AddDependency ( Event & event)
328043 {
328045 event.parents.push_back(weak_ptr<Event>(shared_from_this()));
328046#ifdef DEBUG
328047 event.parents_raw.push_back(*this);
328048#endif
328049}

◆ HasDependencies()

bool duckdb::Event::HasDependencies ( ) const
inline
35067 {
35068 return total_dependencies != 0;
35069 }

◆ GetParentsVerification()

const vector< reference< Event > > & duckdb::Event::GetParentsVerification ( ) const
328051 {
328052 D_ASSERT(parents.size() == parents_raw.size());
328053 return parents_raw;
328054}
vector< reference< Event > > parents_raw
Raw pointers to the parents (used for verification only).
Definition duckdb.cpp:35114

◆ CompleteDependency()

void duckdb::Event::CompleteDependency ( )
328014 {
328015 idx_t current_finished = ++finished_dependencies;
328016 D_ASSERT(current_finished <= total_dependencies);
328017 if (current_finished == total_dependencies) {
328018 // all dependencies have been completed: schedule the event
328019 D_ASSERT(total_tasks == 0);
328020 Schedule();
328021 if (total_tasks == 0) {
328022 Finish();
328023 }
328024 }
328025}

◆ SetTasks()

void duckdb::Event::SetTasks ( vector< shared_ptr< Task > > tasks)
328079 {
328080 auto &ts = TaskScheduler::GetScheduler(executor.context);
328081 D_ASSERT(total_tasks == 0);
328082 D_ASSERT(!tasks.empty());
328083 this->total_tasks = tasks.size();
328084 ts.ScheduleTasks(executor.GetToken(), tasks);
328085}

◆ InsertEvent()

void duckdb::Event::InsertEvent ( shared_ptr< Event > replacement_event)
328070 {
328071 replacement_event->parents = std::move(parents);
328072#ifdef DEBUG
328073 replacement_event->parents_raw = std::move(parents_raw);
328074#endif
328075 replacement_event->AddDependency(*this);
328076 executor.AddEvent(std::move(replacement_event));
328077}

◆ IsFinished()

bool duckdb::Event::IsFinished ( ) const
inline
35078 {
35079 return finished;
35080 }

◆ PrintPipeline()

virtual void duckdb::Event::PrintPipeline ( )
inlinevirtual
35082 {
35083 }

◆ GetClientContext()

ClientContext & duckdb::Event::GetClientContext ( )
328066 {
328067 return executor.context;
328068}

◆ Cast() [1/2]

template<class TARGET>
TARGET & duckdb::Event::Cast ( )
inline
35088 {
35089 DynamicCastCheck<TARGET>(this);
35090 return reinterpret_cast<TARGET &>(*this);
35091 }

◆ Cast() [2/2]

template<class TARGET>
const TARGET & duckdb::Event::Cast ( ) const
inline
35093 {
35094 DynamicCastCheck<TARGET>(this);
35095 return reinterpret_cast<const TARGET &>(*this);
35096 }

Member Data Documentation

◆ finished_dependencies

atomic<idx_t> duckdb::Event::finished_dependencies
protected

The amount of completed dependencies The event can only be started after the dependencies have finished executing


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