An output exchange item that can deliver values from an IModelComponent. More...
#include <hydrocouple.h>
Public Member Functions | |
| virtual | ~IOutput ()=default |
| IOutput::~IOutput is a virtual destructor. | |
| virtual std::vector< IInput * > | consumers () const =0 |
| Input items that will consume the values by calling the IOutput::updateValues() method. | |
| virtual void | addConsumer (IInput *consumer, const IIdentity *providerRole=nullptr)=0 |
| Connects a consumer to this output item. | |
| virtual bool | removeConsumer (IInput *consumer)=0 |
| Disconnects a consumer. | |
| virtual std::vector< IAdaptedOutput * > | adaptedOutputs () const =0 |
| The adaptedOutputs that have this current output item as adaptee. | |
| virtual void | addAdaptedOutput (IAdaptedOutput *adaptedOutput)=0 |
| Add a IAdaptedOutput to this output item. | |
| virtual bool | removeAdaptedOutput (IAdaptedOutput *adaptedOutput)=0 |
| Removes an IAdaptedOutput. | |
| virtual void | updateValues (const IInput *querySpecifier)=0 |
| Brings this output's values up to what the querySpecifier requires. | |
Public Member Functions inherited from HydroCouple::IExchangeItem | |
| virtual | ~IExchangeItem ()=default |
| IExchangeItem::~IExchangeItem is a virtual destructor. | |
Public Member Functions inherited from HydroCouple::IComponentDataItem | |
| virtual | ~IComponentDataItem ()=default |
| IComponentDataItem::~IComponentDataItem is a virtual destructor. | |
| virtual IModelComponent * | modelComponent () const =0 |
| Gets the owner IModelComponent of this IComponentItem. | |
| virtual std::vector< IDimension * > | dimensions () const =0 |
| The axes of this item's index space, in storage order. | |
| virtual std::vector< int64_t > | shape () const =0 |
| The extent of each dimension of this data item's index space. | |
| virtual DataKind | dataKind () const =0 |
| The element type of this data item's values. | |
| virtual IValueDefinition * | valueDefinition () const =0 |
| IValueDefinition for this IComponentDataItem defines the variable type associated with this object. | |
| virtual bool | getValuesInto (const BufferDescriptor &destination, std::span< const int64_t > start, std::span< const int64_t > count, std::string *message=nullptr) const =0 |
| Copies a hyperslab of this item's values into a caller-described buffer. | |
| virtual bool | setValuesFrom (const BufferDescriptor &source, std::span< const int64_t > start, std::span< const int64_t > count, std::string *message=nullptr)=0 |
| Copies values from a caller-described buffer into a hyperslab of this item. | |
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< IComponentDataItemValueChanged > & > | |
| 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< IComponentDataItemValueChanged > & > | |
| virtual void | emit (Args... args)=0 |
| emit is used to emit the signal. | |
An output exchange item that can deliver values from an IModelComponent.
If an output does not provide the data in the way a consumer would like to have it the output can be adapted by an IAdaptedOutput, which can transform the data according to the consumer's wishes. E.g. by performing interpolation in time, spatial aggregation, etc.).
|
virtualdefault |
IOutput::~IOutput is a virtual destructor.
|
nodiscardpure virtual |
The adaptedOutputs that have this current output item as adaptee.
As soon as the output item's values have been updated, for each adaptedOutput its IAdaptedOutput.refresh() method must be called.
The list is readonly. Add and remove from the list by using addAdaptedOutput() and removeAdaptedOutput().
|
pure virtual |
Add a IAdaptedOutput to this output item.
Every adaptedOutput that uses data from this output item, needs to add itself as a consumer first.
Registration is non-owning: whoever holds the std::unique_ptr returned by IAdaptedOutputFactory::createAdaptedOutput() owns the adapter, and an adapter's destructor must call adaptee()->removeAdaptedOutput(this) so that this list never dangles.
If a adaptedOutput is added that can not be handled, or that is incompatible with the already added adaptedOutputs, a Severity::Error entry is queued and an exception may be thrown.
| [in] | adaptedOutput | is consumer that has to be added |
|
pure virtual |
Connects a consumer to this output item.
Every input item that wants to call the IOutput::updateValues() method must be connected first.
This is the single entry point for wiring a connection, for every kind of input. Orchestrators call addConsumer()/removeConsumer() only, never IInput::setProvider() or IMultiInput::addProvider()/removeProvider() directly; those are the callbacks through which the output makes both ends agree:
consumer is an IMultiInput, the output checks canConsume(this, message, providerRole) and then calls addProvider(this, providerRole);providerRole must be nullptr, and the output checks canConsume(this, message) and then calls setProvider(this). Only when the check and the callback both succeed does the output record the consumer. On failure it records nothing, queues a Severity::Error entry on its owning component and may throw.| [in] | consumer | that has to be added (non-owning; the consumer's component owns it) |
| [in] | providerRole | the role this output fills for a multi-input consumer (one of its providerLabels()), or nullptr for none. |
|
nodiscardpure virtual |
Input items that will consume the values by calling the IOutput::updateValues() method.
Every connected input appears here, multi-inputs included. The list is read-only; it changes only through addConsumer() and removeConsumer(). This output's own values (getValuesInto()) may be read whether or not it has consumers.
|
nodiscardpure virtual |
Removes an IAdaptedOutput.
Called by an adapted output's destructor (see addAdaptedOutput()), and by an adapter that no longer wants this output's data.
| [in] | adaptedOutput | is the adapter to deregister. |
|
nodiscardpure virtual |
Disconnects a consumer.
The counterpart of addConsumer(): on success the output calls removeProvider(this) on a multi-input consumer and setProvider(nullptr) on any other.
| [in] | consumer | that has to be removed |
|
pure virtual |
Brings this output's values up to what the querySpecifier requires.
The query is the input itself. What it asks for is read from the input's own metadata, by the specialization the two sides share:
Synchronous: on return the values the consumer asked for are readable through this output's getValuesInto(). Asynchronous exchange exists only at the distributed layer (hydrocoupledistributed.h).
| [in] | querySpecifier | The IInput specifying the required values. Must be a registered consumer of this output. |