Grok 20.3.2
FlowComponent Class Reference

A collection of tasks which can be scheduled as a single task. More...

#include <FlowComponent.h>

Inheritance diagram for FlowComponent:
grk::CodecScheduler grk::SchedulerExcalibur grk::SchedulerStandard grk::CompressSchedulerExcalibur grk::DecompressSchedulerExcalibur grk::CompressScheduler grk::DecompressScheduler

Public Member Functions

void addTo (tf::Taskflow &composition)
 Composes this FlowComponent's tf::Taskflow with another tf::Taskflow.
void precede (FlowComponent &successor)
 Schedule this FlowComponent before another FlowComponent.
void precede (tf::Task &successor)
 Schedule this Taskflow before another FlowComponent.
tf::Task & getCompositionTask (void)
void conditional_precede (FlowComponent *root, FlowComponent *successor, std::function< int()> condition_lambda)
 Conditionally schedule successor based on condition_lambda.
FlowComponentname (const std::string &name)
 Gets name of composition task.
tf::Task & nextTask ()
 Gets next task placeholder for componentFlow_.

Private Attributes

std::vector< tf::Task > componentTasks_
 A std::vector of tf::Task belonging to this FlowComponent.
tf::Task compositionTask_
 tf::Task for the composition of this tf::Taskflow with another tf::Taskflow

Detailed Description

A collection of tasks which can be scheduled as a single task.

Member Function Documentation

◆ addTo()

void FlowComponent::addTo ( tf::Taskflow & composition)
inline

Composes this FlowComponent's tf::Taskflow with another tf::Taskflow.

Parameters
compositiontf::Taskflow that is composed of itself and this tf::Taskflow

References compositionTask_.

Referenced by grk::TileProcessorCompress::buildCompressDAG().

◆ conditional_precede()

void FlowComponent::conditional_precede ( FlowComponent * root,
FlowComponent * successor,
std::function< int()> condition_lambda )
inline

Conditionally schedule successor based on condition_lambda.

When condition returns 0, successor runs. When 1, a noop dead-end runs instead, effectively skipping the rest of the chain. This is required (not just an optimization) because module tasks like CodecScheduler cannot safely execute when prior stages have errored — their internal taskflow may contain stale tasks referencing freed state. Replacing this with a simple linear chain + early-return guards in lambdas was tried and caused segfaults.

References getCompositionTask(), name(), and precede().

◆ getCompositionTask()

tf::Task & FlowComponent::getCompositionTask ( void )
inline

References compositionTask_.

Referenced by conditional_precede().

◆ name()

FlowComponent * FlowComponent::name ( const std::string & name)
inline

Gets name of composition task.

Parameters
namename of composition task
Returns
FlowComponent* pointing to this

References compositionTask_, and name().

Referenced by conditional_precede(), and name().

◆ nextTask()

tf::Task & FlowComponent::nextTask ( )
inline

Gets next task placeholder for componentFlow_.

Returns
tf::Task&

References componentTasks_.

Referenced by grk::CompressScheduler::populateT1Flow(), and grk::DecompressScheduler::scheduleT1().

◆ precede() [1/2]

void FlowComponent::precede ( FlowComponent & successor)
inline

Schedule this FlowComponent before another FlowComponent.

Parameters
successorreference to FlowComponent that will succeed this FlowComponent

References compositionTask_.

Referenced by grk::TileProcessorCompress::buildCompressDAG(), and conditional_precede().

◆ precede() [2/2]

void FlowComponent::precede ( tf::Task & successor)
inline

Schedule this Taskflow before another FlowComponent.

Parameters
successorpointer to Taskflow that will succeed this FlowComponent

References compositionTask_.

Member Data Documentation

◆ componentTasks_

std::vector<tf::Task> FlowComponent::componentTasks_
private

A std::vector of tf::Task belonging to this FlowComponent.

Referenced by nextTask().

◆ compositionTask_

tf::Task FlowComponent::compositionTask_
private

tf::Task for the composition of this tf::Taskflow with another tf::Taskflow

Referenced by addTo(), getCompositionTask(), name(), precede(), and precede().


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