![]() |
HydroCouple
2.0.0-alpha.1
HydroCouple Interface Definitions
|
IWorkflowComponent manages the execution workflow for a set of coupled IModelComponent instances. More...
#include <hydrocouple.h>
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 IWorkflowComponentInfo * | componentInfo () 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< ErrorEntry > | errors (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. | |
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.
|
strong |
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. |
|
virtualdefault |
~IWorkflowComponent destructor for IWorkflowComponent class.
|
nodiscardpure virtual |
addModelComponent Adds model component instance to workflow
| component | is the IModelComponent to add to the workflow. |
| modelRoleIdentifier | is 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. |
| message | is 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. |
|
nodiscardpure virtual |
Gets the metadata information about this workflow component.
|
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.
| clearAfterRead | when true, the queue is emptied after being read. |
|
pure virtual |
Finalizes the workflow component and releases resources.
|
pure virtual |
Initializes the workflow component.
|
nodiscardpure virtual |
isRequiredModelComponent checks if the model component is required by this component.
| modelComponentLabel | is the IIdentity label specifying the model component. |
|
nodiscardpure virtual |
requiredModelComponentIdentifiers returns the vector of IModelComponent identifiers that are required by this component.
|
nodiscardpure virtual |
Gets the model components managed by this workflow.
|
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.
|
nodiscardpure virtual |
removeModelComponent Removes model component instance from workflow
| component | is the IModelComponent to remove from the workflow. |
|
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().
|
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.
|
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.
|
nodiscardpure virtual |
Gets the current status of the workflow component.
|
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()).
|
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.