MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
MayaFlux::Yantra::ExecutionContext Struct Reference

Context information controlling how a compute operation executes. More...

#include <ExecutionContext.hpp>

+ Collaboration diagram for MayaFlux::Yantra::ExecutionContext:

Public Member Functions

bool contains (const std::string &key) const
 Check whether a metadata key exists.
 
template<typename T >
ExecutionContextdepends_on ()
 Register dependency on a specific operation type.
 
template<typename T >
CastResult< T > get (const std::string &key) const
 Retrieve metadata value using safe casting.
 
template<typename T >
get_or (const std::string &key, const T &default_value) const
 Retrieve metadata value or return a default.
 
template<typename T >
get_or_throw (const std::string &key) const
 Retrieve metadata value or throw if unavailable.
 
ExecutionContexton_post (OperationHookCallback cb)
 Set post-execution hook.
 
ExecutionContexton_pre (OperationHookCallback cb)
 Set pre-execution hook.
 
ExecutionContexton_reconstruct (ReconstructionCallback cb)
 Set reconstruction callback.
 
template<typename T >
ExecutionContextset (std::string key, T &&value)
 Insert or update metadata value.
 
ExecutionContextset_mode (ExecutionMode m)
 Set execution mode.
 
ExecutionContextwith_timeout (std::chrono::milliseconds duration)
 Set execution timeout.
 

Public Attributes

std::vector< std::type_index > dependencies
 Operation dependencies required before execution.
 
std::unordered_map< std::string, std::any > execution_metadata
 Arbitrary metadata parameters used by operations.
 
ExecutionMode mode = ExecutionMode::SYNC
 Execution mode controlling scheduling behavior.
 
OperationHookCallback post_execution_hook = nullptr
 Optional callback invoked after operation execution.
 
OperationHookCallback pre_execution_hook = nullptr
 Optional callback invoked before operation execution.
 
ReconstructionCallback reconstruction_callback = nullptr
 Optional callback used for custom reconstruction of results.
 
std::shared_ptr< std::thread > thread_pool = nullptr
 Optional thread pool for asynchronous or parallel execution.
 
std::chrono::milliseconds timeout { 0 }
 Optional timeout for operation execution.
 

Detailed Description

Context information controlling how a compute operation executes.

ExecutionContext provides execution metadata, dependency hints, and hooks that influence how a Yantra operation is scheduled and run.

The execution_metadata map allows arbitrary user-defined parameters to be passed into operations. All reads should be performed using the provided accessors (get, get_or, get_or_throw) which internally use safe_any_cast to provide robust type conversion and diagnostics.

Typical usage:

ctx.set("grain_size", 1024)
.set("hop_size", 512)
.depends_on<MyAnalyzer>();
auto grain = ctx.get_or<uint32_t>("grain_size", 512);
T get_or(const std::string &key, const T &default_value) const
Retrieve metadata value or return a default.
ExecutionContext & depends_on()
Register dependency on a specific operation type.
ExecutionContext & set(std::string key, T &&value)
Insert or update metadata value.
Context information controlling how a compute operation executes.

Definition at line 65 of file ExecutionContext.hpp.


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