Convenience helpers for the HydroCouple interface standard; non-normative except for the two lifecycle transition tables. More...
Namespaces | |
| namespace | Detail |
Classes | |
| struct | DataKindOf |
| DataKindOf maps a C++ type to its DataKind at compile time. More... | |
Functions | |
| constexpr int64_t | dataKindSize (DataKind kind) |
| Size in bytes of one element of the given DataKind. | |
| constexpr int64_t | itemSize (const BufferDescriptor &d) |
| Size in bytes of one element of a descriptor: its itemSizeBytes when set, otherwise the kind's natural size (0 for an Opaque descriptor that failed to set it, which every consumer must treat as an error). | |
| constexpr bool | hasValidItemSize (const BufferDescriptor &d) |
| Checks that a descriptor's element size is consistent with its kind. | |
| constexpr int64_t | elementCount (const BufferDescriptor &d) |
| Number of elements a BufferDescriptor describes (product of shape; 1 for rank 0). | |
| constexpr bool | isContiguous (const BufferDescriptor &d) |
| Checks whether a BufferDescriptor's layout is C-contiguous (row-major, packed). | |
| constexpr int64_t | byteOffset (const BufferDescriptor &d, std::span< const int64_t > index) |
| Byte offset from a descriptor's base address of the element at the given index. | |
| constexpr int64_t | contiguousByteSize (const BufferDescriptor &d) |
| Total byte extent of a C-contiguous buffer of the descriptor's shape and kind. | |
| constexpr BufferDescriptor | makeContiguous (void *data, DataKind kind, std::span< const int64_t > shape) |
| Builds a C-contiguous host BufferDescriptor. | |
| constexpr BufferDescriptor | makeOpaqueContiguous (void *data, int64_t itemSizeBytes, std::span< const int64_t > shape) |
| Builds a C-contiguous host BufferDescriptor over opaque elements. | |
| constexpr bool | isValidComponentStatusTransition (IModelComponent::ComponentStatus from, IModelComponent::ComponentStatus to) |
| Encodes the normative component lifecycle state machine. | |
| constexpr bool | isValidWorkflowStatusTransition (IWorkflowComponent::WorkflowStatus from, IWorkflowComponent::WorkflowStatus to) |
| Encodes the normative workflow lifecycle state machine. | |
| template<typename T> | |
| bool | getValue (const IComponentDataItem &item, T &value, std::span< const int64_t > index) |
| Typed convenience: reads the single element at the given index of a data item. | |
| template<typename T> | |
| bool | setValue (IComponentDataItem &item, const T &value, std::span< const int64_t > index) |
| Typed convenience: writes the single element at the given index of a data item. | |
| template<typename T> | |
| bool | getValues (const IComponentDataItem &item, std::span< T > destination, std::span< const int64_t > start, std::span< const int64_t > count) |
| Typed convenience: reads a hyperslab into a flat contiguous span in C order. | |
| template<typename T> | |
| bool | setValues (IComponentDataItem &item, std::span< const T > source, std::span< const int64_t > start, std::span< const int64_t > count) |
| Typed convenience: writes a hyperslab from a flat contiguous span in C order. | |
Convenience helpers for the HydroCouple interface standard; non-normative except for the two lifecycle transition tables.
|
nodiscardconstexpr |
Byte offset from a descriptor's base address of the element at the given index.
| [in] | d | is the descriptor to query. |
| [in] | index | is the multi-dimensional element index; its length must equal d.rank. |
|
nodiscardconstexpr |
Total byte extent of a C-contiguous buffer of the descriptor's shape and kind.
| [in] | d | is the descriptor to query. |
|
constexpr |
Size in bytes of one element of the given DataKind.
| [in] | kind | is the element kind to query. |
|
nodiscardconstexpr |
Number of elements a BufferDescriptor describes (product of shape; 1 for rank 0).
| [in] | d | is the descriptor to query. |
|
nodiscard |
Typed convenience: reads the single element at the given index of a data item.
| T | is the C++ element type; DataKindOf<T>::kind must equal item.dataKind(). |
| [in] | item | is the data item to read from. |
| [out] | value | receives the element. |
| [in] | index | is the full multi-dimensional element index. |
|
nodiscard |
Typed convenience: reads a hyperslab into a flat contiguous span in C order.
| T | is the C++ element type; DataKindOf<T>::kind must equal item.dataKind(). |
| [in] | item | is the data item to read from. |
| [out] | destination | receives the selection; its size must equal the product of count. |
| [in] | start | is the first index of the selection in each dimension. |
| [in] | count | is the selection extent in each dimension. |
|
nodiscardconstexpr |
Checks that a descriptor's element size is consistent with its kind.
True when itemSizeBytes is 0 or equals the kind's natural size for fixed-size kinds; when itemSizeBytes > 0 for Opaque; when itemSizeBytes is sizeof(std::string) or 0 for String.
|
nodiscardconstexpr |
Checks whether a BufferDescriptor's layout is C-contiguous (row-major, packed).
| [in] | d | is the descriptor to query. |
|
nodiscardconstexpr |
Encodes the normative component lifecycle state machine.
Normative (the exception in this header): implementations must not perform status transitions for which this function returns false.
| [in] | from | is the current status. |
| [in] | to | is the proposed next status. |
|
nodiscardconstexpr |
Encodes the normative workflow lifecycle state machine.
Normative (the exception in this header): implementations must not perform status transitions for which this function returns false.
| [in] | from | is the current status. |
| [in] | to | is the proposed next status. |
|
nodiscardconstexpr |
Size in bytes of one element of a descriptor: its itemSizeBytes when set, otherwise the kind's natural size (0 for an Opaque descriptor that failed to set it, which every consumer must treat as an error).
| [in] | d | is the descriptor to query. |
|
nodiscardconstexpr |
Builds a C-contiguous host BufferDescriptor.
| [in] | data | is the base address of the buffer. |
| [in] | kind | is the element type. |
| [in] | shape | is the extent per dimension; the pointed-to array must outlive the descriptor. |
|
nodiscardconstexpr |
Builds a C-contiguous host BufferDescriptor over opaque elements.
| [in] | data | is the base address of the buffer. |
| [in] | itemSizeBytes | is the size of one element; must be positive. |
| [in] | shape | is the extent per dimension; the pointed-to array must outlive the descriptor. |
|
nodiscard |
Typed convenience: writes the single element at the given index of a data item.
| T | is the C++ element type; DataKindOf<T>::kind must equal item.dataKind(). |
| [in] | item | is the data item to write to. |
| [in] | value | is the element to write. |
| [in] | index | is the full multi-dimensional element index. |
|
nodiscard |
Typed convenience: writes a hyperslab from a flat contiguous span in C order.
| T | is the C++ element type; DataKindOf<T>::kind must equal item.dataKind(). |
| [in] | item | is the data item to write to. |
| [in] | source | provides the selection; its size must equal the product of count. |
| [in] | start | is the first index of the selection in each dimension. |
| [in] | count | is the selection extent in each dimension. |