IArgument interface class used to set the arguments for components. More...
#include <hydrocouple.h>
Public Types | |
| enum class | ArgumentInputType { String , File , JSON , YAML , XML , URL , MEMORY_OBJECT } |
| Enumeration indicating the type of input for the argument. More... | |
| enum class | ArgumentRole : uint8_t { Configuration = 0 , Parameter , InitialCondition , Forcing , Geometry } |
| What kind of thing an argument is to the model that owns it. More... | |
Public Member Functions | |
| virtual | ~IArgument ()=default |
| IArgument::~IArgument is a virtual destructor. | |
| virtual ArgumentRole | role () const =0 |
| What this argument is to the model. | |
| virtual bool | isOptional () const =0 |
| Specifies whether the argument is optional or not. | |
| virtual bool | isReadOnly () const =0 |
| Whether the argument's values may be changed (through initialize() or setValuesFrom()). | |
| virtual std::string | toString () const =0 |
| A human-readable rendering of this argument's current value, for display and logs. | |
| virtual void | saveData ()=0 |
| Writes data to files associated with this argument if they exist. | |
| virtual std::vector< std::string > | fileFilters () const =0 |
| File type extensions that can be read by this IArgument. | |
| virtual std::vector< const std::type_info * > | validComponentDataItemTypes () const =0 |
| Gets the valid IComponentDataItem instance types that can be read by this argument. | |
| virtual bool | isValidArgType (ArgumentInputType argType) const =0 |
| Whether this argument can be initialized from, and serialized to, the given representation. | |
| virtual ArgumentInputType | currentArgumentInputType () const =0 |
| Gets the current input type used for this argument. | |
| virtual bool | initialize (const std::string &value, ArgumentInputType argType, std::string &message)=0 |
| Reads values from a string in the given representation (a JSON/YAML/XML document, a file path, a URL, ...). | |
| virtual bool | initialize (const IComponentDataItem &componentDataItem, std::string &message)=0 |
| Reads values from an equivalent IComponentDataItem. | |
| virtual bool | serialize (ArgumentInputType argType, std::string &value, std::string &message) const =0 |
| Serializes this argument's current value to the requested representation. | |
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. | |
IArgument interface class used to set the arguments for components.
They can be complex or simple multi-dimensional datasets
IArgument is primarily used to set arguments of IModelComponent and IAdaptedOutput
|
strong |
Enumeration indicating the type of input for the argument.
|
strong |
What kind of thing an argument is to the model that owns it.
A calibration driver perturbs Parameters and leaves Configuration alone; a data-assimilation driver perturbs InitialConditions; a scenario generator swaps Forcings. Without this distinction each of those tools invents its own tag.
| Enumerator | |
|---|---|
| Configuration | How the model runs: paths, options, solver settings, output selection. |
| Parameter | A coefficient of the process equations (roughness, conductivity, rate constants). |
| InitialCondition | The state at the start of the simulation. |
| Forcing | A prescribed time-varying input that is not supplied through an IInput (a boundary time series read from file). |
| Geometry | The spatial discretization itself (a mesh, a network, a raster grid). |
|
virtualdefault |
IArgument::~IArgument is a virtual destructor.
|
nodiscardpure virtual |
Gets the current input type used for this argument.
|
nodiscardpure virtual |
File type extensions that can be read by this IArgument.
File filters are specified as a description followed by glob patterns in parentheses, e.g. "Configuration Files (*.yaml *.yml *.json)".
|
nodiscardpure virtual |
Reads values from an equivalent IComponentDataItem.
IComponentDataItem has been used instead of IArgument so that outputs from one model can be used as initialization arguments for another.
| [in] | componentDataItem | is the IArgument from which to copy values from. |
| [out] | message | message returned from file read operation. |
|
nodiscardpure virtual |
Reads values from a string in the given representation (a JSON/YAML/XML document, a file path, a URL, ...).
| [in] | value | is the string to read; for File and URL it names the source. |
| [in] | argType | is the representation of value. |
| [out] | message | describes the failure when the return value is false. |
|
nodiscardpure virtual |
Specifies whether the argument is optional or not.
A non-optional argument must be given a value (through initialize() or setValuesFrom()) before the owning component's initialize() is called.
|
nodiscardpure virtual |
Whether the argument's values may be changed (through initialize() or setValuesFrom()).
This is used to let a IModelComponent or an IAdaptedOutput present the actual value of an argument that can not be changed by the user, but is needed to determine the values of other arguments or is informative in any other way.
|
nodiscardpure virtual |
Whether this argument can be initialized from, and serialized to, the given representation.
| argType | is the representation to query. |
|
nodiscardpure virtual |
What this argument is to the model.
|
pure virtual |
Writes data to files associated with this argument if they exist.
|
nodiscardpure virtual |
Serializes this argument's current value to the requested representation.
This is the write-side counterpart of initialize() and makes IArgument the normative serialization unit: a component's entire persistent configuration must be expressible through its arguments, so any driver can round-trip a component without knowing its internals. For large field payloads (meshes, time series, initial conditions) implementations must not inline bulk data into text formats; the serialized form should carry an external binary payload reference (URI, DataKind, and shape inline; bulk bytes in a sidecar produced through the BufferDescriptor path), with inline text arrays used only for small payloads.
| [in] | argType | is the requested representation (e.g., JSON or YAML). |
| [out] | value | receives the serialized representation. |
| [out] | message | describes the failure when the return value is false. |
|
nodiscardpure virtual |
A human-readable rendering of this argument's current value, for display and logs.
serialize() is the round-trippable form.
|
nodiscardpure virtual |
Gets the valid IComponentDataItem instance types that can be read by this argument.