NGen
|
Variable Key. More...
#include <variable.hpp>
Classes | |
struct | hash |
Public Types | |
using | size_type = std::size_t |
using | types = traits::type_list<SupportedTypes...> |
The variable value types this frame can support. | |
using | mdarray_variant = typename types::template variant_container<ngen::mdarray> |
A boost::variant type consisting of mdarrays of the support types, i.e. | |
using | element_type = typename types::variant_scalar |
Public Member Functions | |
variable () noexcept | |
Constructs an empty variable. | |
template<typename T , typename types::template enable_if_supports< T, bool > = true> | |
variable & | set_data (const mdarray< T > &data) |
Assign an mdarray to this variable. | |
template<typename T , typename types::template enable_if_supports< T, bool > = true> | |
variable & | set_data (mdarray< T > &&data) |
Assign an mdarray to this variable. | |
const mdarray_variant & | values () const noexcept |
Get the values of this variable. | |
template<typename T , typename types::template enable_if_supports< T, bool > = true> | |
const mdarray< T > & | values () const noexcept |
bool | operator== (const variable &rhs) const |
Equality operator to check equality between two variables. | |
const std::string & | name () const noexcept |
Get the name of this variable. | |
std::vector< std::string > | dimensions () const noexcept |
Get the names of all dimensions associated with this variable. | |
size_type | size () const noexcept |
Get the size of this variable. | |
size_type | rank () const noexcept |
Get the rank of this variable. | |
template<typename T , typename types::template enable_if_supports< T, bool > = true> | |
void | insert (boost::span< const size_type > index, T value) |
Construct and insert a mdvalue into the backing mdarray. | |
element_type | at (const boost::span< const size_type > index) |
Access value at a given index. | |
template<typename T , typename types::template enable_if_supports< T, bool > = true> | |
T | at (boost::span< const size_type > index) |
boost::span< const size_type > | shape () const noexcept |
Static Public Member Functions | |
template<typename T , typename types::template enable_if_supports< T, bool > = true> | |
static variable | make (const std::string &name, const std::vector< dimension > &dimensions) |
Constructs a named variable spanned over the given dimensions. | |
Private Attributes | |
std::string | m_name |
mdarray_variant | m_data |
std::vector< dimension > | m_dimensions |
Variable Key.
Provides a tagged variable structure.
SupportedTypes | types that this variable is able to hold. |
using ngen::detail::variable< SupportedTypes >::element_type = typename types::variant_scalar |
using ngen::detail::variable< SupportedTypes >::mdarray_variant = typename types::template variant_container<ngen::mdarray> |
A boost::variant type consisting of mdarrays of the support types, i.e.
for types int and double, this is equivalent to: boost::variant<io::mdarray<int>, io::mdarray<double>>
using ngen::detail::variable< SupportedTypes >::size_type = std::size_t |
using ngen::detail::variable< SupportedTypes >::types = traits::type_list<SupportedTypes...> |
The variable value types this frame can support.
These are stored as a compile-time type list to derive further type aliases.
|
inlinenoexcept |
Constructs an empty variable.
|
inline |
References ngen::detail::variable< SupportedTypes >::m_data.
|
inline |
Access value at a given index.
index | Multi-dimensional index. Size of this index list must match the dimensions of this variable. |
References ngen::detail::variable< SupportedTypes >::m_data.
|
inlinenoexcept |
Get the names of all dimensions associated with this variable.
References ngen::detail::variable< SupportedTypes >::m_dimensions.
Referenced by ngen::detail::variable< SupportedTypes >::make().
|
inline |
Construct and insert a mdvalue into the backing mdarray.
T | Must be the type stored within the mdarray |
index | Multi-dimensional index to insert to |
value | Value to insert into mdarray |
References ngen::detail::variable< SupportedTypes >::m_data.
|
inlinestatic |
Constructs a named variable spanned over the given dimensions.
name | Name of the dimension |
dimensions | List of dimensions |
References ngen::detail::variable< SupportedTypes >::dimensions(), ngen::detail::variable< SupportedTypes >::m_data, ngen::detail::variable< SupportedTypes >::m_dimensions, ngen::detail::variable< SupportedTypes >::m_name, and ngen::detail::variable< SupportedTypes >::name().
Referenced by ngen::mdframe::add_variable().
|
inlinenoexcept |
Get the name of this variable.
References ngen::detail::variable< SupportedTypes >::m_name.
Referenced by ngen::detail::variable< SupportedTypes >::make().
|
inline |
Equality operator to check equality between two variables.
rhs |
References ngen::detail::variable< SupportedTypes >::m_name.
|
inlinenoexcept |
Get the rank of this variable.
References ngen::detail::variable< SupportedTypes >::m_data.
|
inline |
Assign an mdarray to this variable.
T | Supported mdframe types. |
data | The mdarray to assign. |
References ngen::detail::variable< SupportedTypes >::m_data.
|
inline |
Assign an mdarray to this variable.
T | Supported mdframe types. |
data | The mdarray to assign. |
References ngen::detail::variable< SupportedTypes >::m_data.
|
inlinenoexcept |
References ngen::detail::variable< SupportedTypes >::m_data.
|
inlinenoexcept |
Get the size of this variable.
References ngen::detail::variable< SupportedTypes >::m_data.
|
inlinenoexcept |
Get the values of this variable.
References ngen::detail::variable< SupportedTypes >::m_data.
|
inlinenoexcept |
References ngen::detail::variable< SupportedTypes >::m_data.
|
private |
Referenced by ngen::detail::variable< SupportedTypes >::at(), ngen::detail::variable< SupportedTypes >::at(), ngen::detail::variable< SupportedTypes >::insert(), ngen::detail::variable< SupportedTypes >::make(), ngen::detail::variable< SupportedTypes >::rank(), ngen::detail::variable< SupportedTypes >::set_data(), ngen::detail::variable< SupportedTypes >::set_data(), ngen::detail::variable< SupportedTypes >::shape(), ngen::detail::variable< SupportedTypes >::size(), and ngen::detail::variable< SupportedTypes >::values().
|
private |
|
mutableprivate |