HydroCouple  2.0.0-alpha.1
HydroCouple Interface Definitions
Loading...
Searching...
No Matches
HydroCouple::IWorkflowComponent Class Referenceabstract

IWorkflowComponent manages the execution workflow for a set of coupled IModelComponent instances. More...

#include <hydrocouple.h>

Inheritance diagram for HydroCouple::IWorkflowComponent:
Collaboration diagram for HydroCouple::IWorkflowComponent:

Public Types

enum class  WorkflowStatus {
  Created ,
  Initializing ,
  Initialized ,
  Validating ,
  Validated ,
  Preparing ,
  Prepared ,
  Updating ,
  Updated ,
  Paused ,
  Done ,
  Finishing ,
  Finished ,
  Failed
}
 The WorkflowStatus enum describes the status of a workflow component over the course of its lifetime. More...
 

Public Member Functions

virtual ~IWorkflowComponent ()=default
 ~IWorkflowComponent destructor for IWorkflowComponent class.
 
virtual IWorkflowComponentInfocomponentInfo () const =0
 Gets the metadata information about this workflow component.
 
virtual std::vector< IIdentity * > modelComponentLabels () const =0
 requiredModelComponentIdentifiers returns the vector of IModelComponent identifiers that are required by this component.
 
virtual bool isRequiredModelComponent (const IIdentity *modelComponentLabel) const =0
 isRequiredModelComponent checks if the model component is required by this component.
 
virtual void initialize ()=0
 Initializes the workflow component.
 
virtual std::vector< std::string > validate ()=0
 Validates the composition as a whole before computation begins.
 
virtual void prepare ()=0
 Prepares the composition for computation.
 
virtual void update ()=0
 Performs one orchestration step.
 
virtual void finish ()=0
 Finalizes the workflow component and releases resources.
 
virtual void requestStop ()=0
 Requests a cooperative stop of the workflow.
 
virtual void requestPause ()=0
 Requests a cooperative pause of the workflow.
 
virtual void resume ()=0
 Resumes a paused workflow.
 
virtual std::vector< ErrorEntryerrors (bool clearAfterRead=false)=0
 Drains this workflow's diagnostic queue.
 
virtual WorkflowStatus status () const =0
 Gets the current status of the workflow component.
 
virtual std::vector< IModelComponent * > modelComponents () const =0
 Gets the model components managed by this workflow.
 
virtual bool addModelComponent (IModelComponent *component, const IIdentity *modelRoleIdentifier=nullptr, std::string *message=nullptr)=0
 addModelComponent Adds model component instance to workflow
 
virtual bool removeModelComponent (IModelComponent *component)=0
 removeModelComponent Removes model component instance from workflow
 
- Public Member Functions inherited from HydroCouple::IIdentity
virtual ~IIdentity ()=default
 IIdentity::~IIdentity is a virtual destructor.
 
virtual const std::string & id () const =0
 Gets a unique identifier for the entity.
 
- Public Member Functions inherited from HydroCouple::IDescription
virtual ~IDescription ()=default
 IDescription::~IDescription is a virtual destructor.
 
virtual const std::string & caption () const =0
 Gets caption for the entity.
 
virtual void setCaption (const std::string &caption)=0
 Sets caption for the entity.
 
virtual const std::string & description () const =0
 Gets additional descriptive information for the entity.
 
virtual void setDescription (const std::string &description)=0
 Gets additional descriptive information for the entity.
 
- Public Member Functions inherited from HydroCouple::IPropertyChanged
virtual ~IPropertyChanged ()=default
 IPropertyChanged::~IPropertyChanged is a virtual destructor.
 
- Public Member Functions inherited from HydroCouple::ISignal< std::string >
virtual ~ISignal ()=default
 ISignal::~ISignal is a virtual destructor.
 
virtual void connect (const std::shared_ptr< ISlot< Args... > > &slot)=0
 connect is used to connect a slot to the signal.
 
virtual void disconnect (const std::shared_ptr< ISlot< Args... > > &slot)=0
 disconnect is used to disconnect a slot from the signal.
 
virtual void blockSignals (bool block)=0
 blockSignals is used to block signals from being emitted.
 
- Public Member Functions inherited from HydroCouple::ISignal< const std::shared_ptr< IWorkflowComponentStatusChangeEventArgs > & >
virtual ~ISignal ()=default
 ISignal::~ISignal is a virtual destructor.
 
virtual void connect (const std::shared_ptr< ISlot< Args... > > &slot)=0
 connect is used to connect a slot to the signal.
 
virtual void disconnect (const std::shared_ptr< ISlot< Args... > > &slot)=0
 disconnect is used to disconnect a slot from the signal.
 
virtual void blockSignals (bool block)=0
 blockSignals is used to block signals from being emitted.
 

Additional Inherited Members

- Protected Member Functions inherited from HydroCouple::ISignal< std::string >
virtual void emit (Args... args)=0
 emit is used to emit the signal.
 
- Protected Member Functions inherited from HydroCouple::ISignal< const std::shared_ptr< IWorkflowComponentStatusChangeEventArgs > & >
virtual void emit (Args... args)=0
 emit is used to emit the signal.
 

Detailed Description

IWorkflowComponent manages the execution workflow for a set of coupled IModelComponent instances.

A workflow component orchestrates the initialization, execution, and finalization of multiple model components that form a coupled simulation.

Member Enumeration Documentation

◆ WorkflowStatus

The WorkflowStatus enum describes the status of a workflow component over the course of its lifetime.

Enumerator
Created 

The workflow component has just been created.

Initializing 

The workflow component is initializing itself.

Initialized 

The workflow component has successfully initialized.

Validating 

The workflow component is validating the composition (cross-component links, required roles).

Validated 

The workflow component found the composition valid and ready to prepare.

Preparing 

The workflow component is preparing the composition for computation (e.g., driving IModelComponent::prepare(), building execution schedules, negotiating exchange patterns).

Prepared 

The workflow component has prepared the composition and can begin updating.

Updating 

The workflow component is performing an update step.

Updated 

The workflow component has successfully updated.

Paused 

The workflow component is paused at a synchronization point (see requestPause()) and can be resumed.

Done 

The workflow component has completed all update steps.

Finishing 

The workflow component is finalizing and releasing resources.

Finished 

The workflow component has finished and cannot be restarted.

Failed 

The workflow component encountered an error.

Constructor & Destructor Documentation

◆ ~IWorkflowComponent()

virtual HydroCouple::IWorkflowComponent::~IWorkflowComponent ( )
virtualdefault

~IWorkflowComponent destructor for IWorkflowComponent class.

Member Function Documentation

◆ addModelComponent()

virtual bool HydroCouple::IWorkflowComponent::addModelComponent ( IModelComponent * component,
const IIdentity * modelRoleIdentifier = nullptr,
std::string * message = nullptr )
nodiscardpure virtual

addModelComponent Adds model component instance to workflow

Parameters
componentis the IModelComponent to add to the workflow.
modelRoleIdentifieris the IIdentity of the role of the model component. If null, the component is added as a standalone component. in which case the workflow likely does not require ordered or specific components for its operation.
messageis an optional out parameter that receives a description of why the component could not be added (e.g., unknown role, duplicate component) when returning false.
Returns
True if the component was added successfully, otherwise false.

◆ componentInfo()

virtual IWorkflowComponentInfo * HydroCouple::IWorkflowComponent::componentInfo ( ) const
nodiscardpure virtual

Gets the metadata information about this workflow component.

Returns
A pointer to the IWorkflowComponentInfo for this component.

◆ errors()

virtual std::vector< ErrorEntry > HydroCouple::IWorkflowComponent::errors ( bool clearAfterRead = false)
nodiscardpure virtual

Drains this workflow's diagnostic queue.

Mirrors IModelComponent::errors(): the workflow must queue an ErrorEntry for every Warning-or-worse condition it detects — including failures surfaced by its managed components — and must queue a Severity::Fatal entry whenever it transitions to WorkflowStatus::Failed.

Parameters
clearAfterReadwhen true, the queue is emptied after being read.
Returns
The queued diagnostic records in the order they were recorded.

◆ finish()

virtual void HydroCouple::IWorkflowComponent::finish ( )
pure virtual

Finalizes the workflow component and releases resources.

◆ initialize()

virtual void HydroCouple::IWorkflowComponent::initialize ( )
pure virtual

Initializes the workflow component.

◆ isRequiredModelComponent()

virtual bool HydroCouple::IWorkflowComponent::isRequiredModelComponent ( const IIdentity * modelComponentLabel) const
nodiscardpure virtual

isRequiredModelComponent checks if the model component is required by this component.

Parameters
modelComponentLabelis the IIdentity label specifying the model component.
Returns
boolean indicating whether the model component is required by this component.

◆ modelComponentLabels()

virtual std::vector< IIdentity * > HydroCouple::IWorkflowComponent::modelComponentLabels ( ) const
nodiscardpure virtual

requiredModelComponentIdentifiers returns the vector of IModelComponent identifiers that are required by this component.

Returns
A vector of IModelComponent identifiers that are required by this component.

◆ modelComponents()

virtual std::vector< IModelComponent * > HydroCouple::IWorkflowComponent::modelComponents ( ) const
nodiscardpure virtual

Gets the model components managed by this workflow.

Returns
A vector of IModelComponent pointers managed by this workflow.

◆ prepare()

virtual void HydroCouple::IWorkflowComponent::prepare ( )
pure virtual

Prepares the composition for computation.

The workflow drives IModelComponent::prepare() on its managed components and performs its own pre-computation work, such as deriving an execution schedule from the connection graph or negotiating distributed exchange patterns. Must only be called after validate() has succeeded. Transitions status() through WorkflowStatus::Preparing to WorkflowStatus::Prepared on success or WorkflowStatus::Failed otherwise.

◆ removeModelComponent()

virtual bool HydroCouple::IWorkflowComponent::removeModelComponent ( IModelComponent * component)
nodiscardpure virtual

removeModelComponent Removes model component instance from workflow

Parameters
componentis the IModelComponent to remove from the workflow.
Returns
True if the component was removed successfully, otherwise false.

◆ requestPause()

virtual void HydroCouple::IWorkflowComponent::requestPause ( )
pure virtual

Requests a cooperative pause of the workflow.

The workflow completes the in-flight orchestration step, then transitions to WorkflowStatus::Paused instead of starting another step. A paused composition is at a consistent synchronization point — the natural moment to checkpoint components that implement ICheckpointableModelComponent. Resume with resume().

◆ requestStop()

virtual void HydroCouple::IWorkflowComponent::requestStop ( )
pure virtual

Requests a cooperative stop of the workflow.

The workflow completes the in-flight orchestration step, then transitions to WorkflowStatus::Done instead of starting another step, so that finish() can produce a consistent final state. Safe to call from a signal handler thread; takes effect at the next synchronization point.

◆ resume()

virtual void HydroCouple::IWorkflowComponent::resume ( )
pure virtual

Resumes a paused workflow.

Transitions status() from WorkflowStatus::Paused back to WorkflowStatus::Updated so that update() may be called again. Has no effect when the workflow is not paused.

◆ status()

virtual WorkflowStatus HydroCouple::IWorkflowComponent::status ( ) const
nodiscardpure virtual

Gets the current status of the workflow component.

Returns
The current WorkflowStatus of this component.

◆ update()

virtual void HydroCouple::IWorkflowComponent::update ( )
pure virtual

Performs one orchestration step.

One call advances the composition to the workflow's next synchronization point; what constitutes that point is defined by the concrete workflow's execution strategy (e.g., servicing one request-reply chain from a trigger input, or advancing every component to the next common synchronization interval). Callers repeat update() until status() becomes WorkflowStatus::Done, WorkflowStatus::Paused, or WorkflowStatus::Failed. Pause and stop requests are honored at synchronization points (see requestPause() and requestStop()).

◆ validate()

virtual std::vector< std::string > HydroCouple::IWorkflowComponent::validate ( )
nodiscardpure virtual

Validates the composition as a whole before computation begins.

Where IModelComponent::validate() checks one component in isolation, the workflow validates the coupled composition: that every required role is filled (see isRequiredModelComponent()), that connected exchange items are compatible, and that any feedback loops in the connection graph are ones the workflow's execution strategy can resolve. Must only be called after initialize() and after the exchange connections have been established. Transitions status() through WorkflowStatus::Validating to WorkflowStatus::Validated on success or WorkflowStatus::Failed otherwise.

Returns
An empty vector when the composition is valid; otherwise one human-readable description per problem found.

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