HydroCouple  2.0.0-alpha.1
HydroCouple Interface Definitions
Loading...
Searching...
No Matches
HydroCouple::IComponentDataItem Class Referenceabstract

IComponentDataItem is a fundamental unit of data for a component. More...

#include <hydrocouple.h>

Inheritance diagram for HydroCouple::IComponentDataItem:
Collaboration diagram for HydroCouple::IComponentDataItem:

Public Member Functions

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 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 IValueDefinitionvalueDefinition () 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

IComponentDataItem is a fundamental unit of data for a component.

This interface is not to be implemented directly; implement one of its specializations (IExchangeItem, IArgument, or a domain data item).

Data access is typed and bulk-oriented: all field data moves through getValuesInto()/setValuesFrom() as BufferDescriptor hyperslabs. The item's full index space is given by shape(); dimension semantics (which axis is time, entity, layer, ...) are described by dimensions() and by the canonical orderings defined in each specialization's documentation. A hyperslab is selected by a start index and a count per dimension, exactly as in HDF5 hyperslab selections. Scalar and span-based convenience helpers are provided as non-virtual templates over the same bulk path.

Threading contract: after the owning component reaches HydroCouple::ComponentStatus::Initialized, metadata getters are safe for concurrent reads; getValuesInto() calls are safe concurrently with each other but not with setValuesFrom() or with the owning component's update(); lifecycle methods require external synchronization.

See also
IExchangeItem, IArgument, IIdBasedComponentDataItem

Constructor & Destructor Documentation

◆ ~IComponentDataItem()

virtual HydroCouple::IComponentDataItem::~IComponentDataItem ( )
virtualdefault

IComponentDataItem::~IComponentDataItem is a virtual destructor.

Member Function Documentation

◆ dataKind()

virtual DataKind HydroCouple::IComponentDataItem::dataKind ( ) const
nodiscardpure virtual

The element type of this data item's values.

Returns
The DataKind of the stored values.

◆ dimensions()

virtual std::vector< IDimension * > HydroCouple::IComponentDataItem::dimensions ( ) const
nodiscardpure virtual

provides purely descriptive information of the dimensions associated with this IComponentItem

Returns
A list of IDimension objects.

◆ getValuesInto()

virtual bool HydroCouple::IComponentDataItem::getValuesInto ( const BufferDescriptor & destination,
std::span< const int64_t > start,
std::span< const int64_t > count,
std::string * message = nullptr ) const
nodiscardpure virtual

Copies a hyperslab of this item's values into a caller-described buffer.

The selection is the box [start[k], start[k] + count[k]) in each dimension k of shape(). destination.kind must equal dataKind() (no implicit conversion) and destination's element count must equal the product of count. Items that cannot service the destination's memory space return false with a message (host-only items accept MemorySpace::Host; device support is advertised component-wide via Capability::DeviceBuffers). When destination is C-contiguous and the selection is contiguous in this item's storage, implementations should degenerate to memcpy.

Parameters
[in]destinationdescribes the buffer receiving the values.
[in]startis the first index of the selection in each dimension; its length must equal the rank of shape().
[in]countis the selection extent in each dimension; its length must equal the rank of shape().
[out]messageoptionally receives a failure description.
Returns
True on success.
Here is the caller graph for this function:

◆ modelComponent()

virtual IModelComponent * HydroCouple::IComponentDataItem::modelComponent ( ) const
nodiscardpure virtual

Gets the owner IModelComponent of this IComponentItem. For an IOutput component item this is the component responsible for providing the content of the IOutput.

It is possible for an IComponentItem to have no owner, in this case the method will return nullptr.

Returns
an IModelComponent object that is the parent of this IComponentItem

◆ setValuesFrom()

virtual bool HydroCouple::IComponentDataItem::setValuesFrom ( const BufferDescriptor & source,
std::span< const int64_t > start,
std::span< const int64_t > count,
std::string * message = nullptr )
nodiscardpure virtual

Copies values from a caller-described buffer into a hyperslab of this item.

Selection and compatibility rules are identical to getValuesInto().

Parameters
[in]sourcedescribes the buffer providing the values.
[in]startis the first index of the selection in each dimension; its length must equal the rank of shape().
[in]countis the selection extent in each dimension; its length must equal the rank of shape().
[out]messageoptionally receives a failure description.
Returns
True on success.
Here is the caller graph for this function:

◆ shape()

virtual std::vector< int64_t > HydroCouple::IComponentDataItem::shape ( ) const
nodiscardpure virtual

The extent of each dimension of this data item's index space.

The returned vector is parallel to dimensions(). Dynamic dimensions report their current extent.

Returns
The extent per dimension.

◆ valueDefinition()

virtual IValueDefinition * HydroCouple::IComponentDataItem::valueDefinition ( ) const
nodiscardpure virtual

IValueDefinition for this IComponentDataItem defines the variable type associated with this object.

Returns
The IValueDefinition for this data item (either an IQuality or IQuantity).

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