Loading...
Searching...
No Matches
HydroCouple::IAdaptedOutput Class Referenceabstract

An IAdaptedOutput adds one or more data operations on top of an IOutput. More...

#include <hydrocouple.h>

Inheritance diagram for HydroCouple::IAdaptedOutput:
Collaboration diagram for HydroCouple::IAdaptedOutput:

Public Member Functions

virtual ~IAdaptedOutput ()=default
 IAdaptedOutput::~IAdaptedOutput is a virtual destructor.
 
virtual IAdaptedOutputFactory * adaptedOutputFactory () const =0
 IAdaptedOutputFactory that generated this IAdaptedOutput.
 
virtual std::vector< IArgument * > arguments () const =0
 IArgument represents input parameters needed for this IAdaptedOutput.
 
virtual void initialize ()=0
 Lets this IAdaptedOutput initialize() itself, based on the current values specified by the arguments.
 
virtual IOutput * adaptee () const =0
 IOutput that this IAdaptedOutput extracts content from.
 
virtual void refresh ()=0
 Requests the IAdaptedOutput to refresh itself and perform any necessary calculations.
 
virtual std::vector< IComponentDataItem * > states () const =0
 The data items that make up the state carried from one refresh() to the next.
 
- Public Member Functions inherited from HydroCouple::IOutput
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.
 

Detailed Description

An IAdaptedOutput adds one or more data operations on top of an IOutput.

It is in itself an IOutput. The IAdaptedOutput extends an output with operations including spatial interpolation, temporal interpolation, unit conversion etc.

IAdaptedOutput instances are created by means of an IAdaptedOutputFactory.

The IAdaptedOutput is based on the adaptor design pattern. It adapts an IOutput or another IAdaptedOutput to make it suitable for new use or purpose. The object being adapted is typically called the adaptee.

Constructor & Destructor Documentation

◆ ~IAdaptedOutput()

virtual HydroCouple::IAdaptedOutput::~IAdaptedOutput ( )
virtualdefault

IAdaptedOutput::~IAdaptedOutput is a virtual destructor.

Member Function Documentation

◆ adaptedOutputFactory()

virtual IAdaptedOutputFactory * HydroCouple::IAdaptedOutput::adaptedOutputFactory ( ) const
nodiscardpure virtual

IAdaptedOutputFactory that generated this IAdaptedOutput.

Returns
IAdaptedOutputFactory parent.

◆ adaptee()

virtual IOutput * HydroCouple::IAdaptedOutput::adaptee ( ) const
nodiscardpure virtual

IOutput that this IAdaptedOutput extracts content from.

In the adapter design pattern, it is the item being adapted.

Returns
an IOutput that is being modified by this IAdaptedOutput.

◆ arguments()

virtual std::vector< IArgument * > HydroCouple::IAdaptedOutput::arguments ( ) const
nodiscardpure virtual

IArgument represents input parameters needed for this IAdaptedOutput.

An unmodifiable vector of the (modifiable) IArguments should be returned that can be used to get information on an IArgument and to modify its values. Validation of changes is done when they occur (e.g. using notifications).

Returns
Unmodifiable list of IArgument for the adapted output.

◆ initialize()

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

Lets this IAdaptedOutput initialize() itself, based on the current values specified by the arguments.

Only after initialize() is called the refresh() method might be called.

A component must invoke the initialize() method of all its adapted outputs at the end of the component's Prepare phase. In case of stacked adapted outputs, the adaptee must be initialized first.

◆ refresh()

virtual void HydroCouple::IAdaptedOutput::refresh ( )
pure virtual

Requests the IAdaptedOutput to refresh itself and perform any necessary calculations.

This method will be called by the adaptee() when it has been refreshed/updated. In the implementation of the refresh method, the adapted output should update its contents according to the changes in the adaptee.

After updating itself, the IAdaptedOutput must call refresh() on all its IAdaptedOutput children, so the chain of IOutput items refreshes themselves.

◆ states()

virtual std::vector< IComponentDataItem * > HydroCouple::IAdaptedOutput::states ( ) const
nodiscardpure virtual

The data items that make up the state carried from one refresh() to the next.

The adapter's counterpart of IModelComponent::states(). Most adapters (a unit conversion, a regridding) compute their values from the adaptee's current values and their arguments alone, and return an empty vector. An adapter whose values also depend on its previous refreshes – under-relaxation, interpolation over a recorded history – lists the items holding that past, so an orchestrator can tell it apart: a composition containing it can be returned to an earlier step only if the adapter can be returned too (see ICheckpointableAdaptedOutput), and IDifferentiableAdaptedOutput::differentiableStates() is a subset of it. An item may be the adapter itself, when its own previous values are the state.

Available from initialize(); non-owning observers.

Returns
The state items, in a stable order.

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