HydroCouple  2.0.0
HydroCouple Interface Definitions
Loading...
Searching...
No Matches
HydroCouple::IArgument Class Referenceabstract

IArgument interface class used to set the arguments for components. They can be complex or simple multi-dimensional datasets. More...

#include <hydrocouple.h>

Inheritance diagram for HydroCouple::IArgument:
Collaboration diagram for HydroCouple::IArgument:

Public Types

enum class  ArgumentInputType {
  String ,
  File ,
  JSON ,
  XML ,
  URL ,
  MEMORY_OBJECT
}
 Enumeration indicating the type of input for the argument. More...
 

Public Member Functions

virtual ~IArgument ()=default
 IArgument::~IArgument is a virtual destructor.
 
virtual bool isOptional () const =0
 Specifies whether the argument is optional or not.
 
virtual bool isReadOnly () const =0
 Defines whether the Values property may be edited.
 
virtual std::string toString () const =0
 String/XML representation for this IArgument.
 
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
 Boolean indicating whether this IArgument copy its values from a string.
 
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 JSON string.
 
virtual bool initialize (const IComponentDataItem &componentDataItem, std::string &message)=0
 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.
 
- Public Member Functions inherited from HydroCouple::IComponentDataItem
virtual ~IComponentDataItem ()=default
 IComponentDataItem::~IComponentDataItem is a virtual destructor.
 
virtual IModelComponentmodelComponent () const =0
 Gets the owner IModelComponent of this IComponentItem. For an IOutput component item this is the component responsible for providing the content of the IOutput.
 
virtual std::vector< IDimension * > dimensions () const =0
 provides purely descriptive information of the dimensions associated with this IComponentItem
 
virtual int dimensionLength (std::span< const int >dimensionIndexes={}) const =0
 dimensionLength returns the length of the dimension specified by the given dimension indexes. To get the size of the first dimension, use a null integer array as input argument. Length of indices must be a least one smaller than the numDimensions()
 
virtual IValueDefinitionvalueDefinition () const =0
 IValueDefinition for this IComponentDataItem defines the variable type associated with this object.
 
virtual void getValue (hydrocouple_variant &data, std::span< const int >dimensionIndexes) const =0
 Gets a multi-dimensional array of values for given dimension indexes and strides along each dimension. IndexArray = x + y * InSizeX + z * InSizeX * InSizeY etc;.
 
virtual void getValues (hydrocouple_variant *data, std::span< const int >dimensionIndexes, std::span< const int >dimensionLengths={}) const =0
 Gets a multi-dimensional array of values for given dimension indexes and strides along each dimension.
 
virtual void setValue (const hydrocouple_variant &data, std::span< const int >dimensionIndexes)=0
 Sets a multi-dimensional array of values for given dimension indexes.
 
virtual void setValues (const hydrocouple_variant *data, std::span< const int >dimensionIndexes, std::span< const int >dimensionLengths={})=0
 Sets a multi-dimensional array of values for given dimension indexes and strides along each dimension.
 
virtual bool hasEditor () const =0
 hasEditor indicates whether this IComponentItem has a UI editor.
 
virtual void showEditor (void *opaqueUIPointer=nullptr)=0
 showEditor shows the editor for this IComponentItem.
 
virtual bool hasViewer () const =0
 hasViewer indicates whether this IComponentItem has a UI viewer.
 
virtual void showViewer (void *opaqueUIPointer=nullptr)=0
 showViewer shows the viewer for this IComponentItem.
 
- 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

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

Member Enumeration Documentation

◆ ArgumentInputType

Enumeration indicating the type of input for the argument.

Enumerator
String 

Enumeration indicating that the argument was read from string.

File 

Enumeration indicating that the argument was read from a file.

JSON 

Enumeration indicating that the argument input is in JSON format.

XML 

Enumeration indicating that the argument was read from a file.

URL 

Enumeration indicating that the argument was read from a URL.

MEMORY_OBJECT 

Enumeration indicating that the argument was read from a memory object.

Constructor & Destructor Documentation

◆ ~IArgument()

virtual HydroCouple::IArgument::~IArgument ( )
virtualdefault

IArgument::~IArgument is a virtual destructor.

Member Function Documentation

◆ currentArgumentInputType()

virtual ArgumentInputType HydroCouple::IArgument::currentArgumentInputType ( ) const
pure virtual

Gets the current input type used for this argument.

Returns
The ArgumentInputType indicating how this argument was initialized.

◆ fileFilters()

virtual std::vector< std::string > HydroCouple::IArgument::fileFilters ( ) const
pure virtual

File type extensions that can be read by this IArgument.

File extensions must be specified using the Qt format e.g. "Images (*.png *.xpm *.jpg) "

Returns
a list of strings for compatible file extensions.

◆ initialize() [1/2]

virtual bool HydroCouple::IArgument::initialize ( const IComponentDataItem componentDataItem,
std::string &  message 
)
pure 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.

Parameters
[in]componentDataItemis the IArgument from which to copy values from.
[out]messagemessage returned from file read operation.
Returns
boolean indicating whether file reading was successful.

◆ initialize() [2/2]

virtual bool HydroCouple::IArgument::initialize ( const std::string &  value,
ArgumentInputType  argType,
std::string &  message 
)
pure virtual

Reads values from a JSON string.

Parameters
[in]valueis a string representing values in JSON format.
[in]argTypeis the type of input to be read.
[out]messagemessage returned from file read operation.
Returns
boolean indicating whether file/string reading was successful

◆ isOptional()

virtual bool HydroCouple::IArgument::isOptional ( ) const
pure virtual

Specifies whether the argument is optional or not.

If the getValue property returns null and isOptional == false, a value has to be set before the argument can be used

◆ isReadOnly()

virtual bool HydroCouple::IArgument::isReadOnly ( ) const
pure virtual

Defines whether the Values property may be edited.

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.

◆ isValidArgType()

virtual bool HydroCouple::IArgument::isValidArgType ( ArgumentInputType  argType) const
pure virtual

Boolean indicating whether this IArgument copy its values from a string.

Parameters
argTypeis the type of input to be read.
Returns
True if the argument is read from a string otherwise false.

◆ saveData()

virtual void HydroCouple::IArgument::saveData ( )
pure virtual

Writes data to files associated with this argument if they exist.

◆ toString()

virtual std::string HydroCouple::IArgument::toString ( ) const
pure virtual

String/XML representation for this IArgument.

◆ validComponentDataItemTypes()

virtual std::vector< const std::type_info * > HydroCouple::IArgument::validComponentDataItemTypes ( ) const
pure virtual

Gets the valid IComponentDataItem instance types that can be read by this argument.

Returns
A list of pointers to type_info objects representing the valid component data item types.

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