MayaFlux 0.1.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ as()

template<typename T >
T * MayaFlux::Nodes::NodeContext::as ( )
inline

Safely cast to a derived context type.

Template Parameters
TThe derived context type to cast to
Returns
Pointer to the derived context or nullptr if types don't match

Provides type-safe access to derived context classes. If the requested type matches the actual type of this context, returns a properly cast pointer. Otherwise, returns nullptr to prevent unsafe access.

Example:

if (auto filter_ctx = ctx.as<FilterContext>()) {
// Access filter-specific context members
double gain = filter_ctx->gain;
}

Definition at line 68 of file Node.hpp.

69 {
70 if (typeid(T).name() == type_id) {
71 return static_cast<T*>(this);
72 }
73 return nullptr;
74 }
std::string type_id
Type identifier for runtime type checking.
Definition Node.hpp:48