MayaFlux 0.1.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
MayaFlux::Kriya::NodeTimeSpec Class Reference

Represents a timed activation operation for processing nodes. More...

#include <Operators.hpp>

+ Collaboration diagram for MayaFlux::Kriya::NodeTimeSpec:

Public Member Functions

 NodeTimeSpec (double seconds, std::optional< std::vector< uint32_t > > channels=std::nullopt)
 Constructs a NodeTimeSpec with the specified duration.
 
 NodeTimeSpec (double seconds, Vruta::TaskScheduler &scheduler, Nodes::NodeGraphManager &graph_manager)
 Constructs a NodeTimeSpec with explicit scheduler and graph manager.
 
double get_seconds () const
 Gets the duration of this operation.
 
bool has_explicit_channels () const
 Checks if explicit channels were specified.
 
const std::vector< uint32_t > & get_channels () const
 Gets the list of channels to activate.
 

Private Attributes

double m_seconds
 Duration of the operation in seconds.
 
Vruta::TaskSchedulerm_scheduler
 Reference to the scheduler that will manage timing.
 
Nodes::NodeGraphManagerm_graph_manager
 Reference to the graph manager that will manage node connections.
 
std::optional< std::vector< uint32_t > > m_channels
 

Friends

void operator>> (std::shared_ptr< Nodes::Node >, const NodeTimeSpec &)
 Grants the stream operator access to private members.
 

Detailed Description

Represents a timed activation operation for processing nodes.

The NodeTimeSpec class encapsulates the concept of activating a processing node for a specific duration. It's designed to be used with the stream operator (>>) to create a fluent, expressive syntax for computational flow programming.

This approach is inspired by flow-based programming paradigms, which use operators to express data flow and timing relationships. It allows for a more intuitive, declarative way of expressing temporal operations compared to traditional function calls.

Example usage:

// Activate a processing node for 2 seconds
process_node >> Time(2.0);
// Equivalent to:
// NodeTimer timer(*scheduler, *graph_manager);
// timer.play_for(process_node, 2.0);
NodeTimeSpec Time(double seconds)
Definition Operators.cpp:52

The NodeTimeSpec is part of a broader pattern of using operator overloading to create a domain-specific language for computational flow programming within C++.

Definition at line 33 of file Operators.hpp.


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