Data types and type management¶
pni::core::type_id_t¶
-
enum
pni::core::type_id_t¶ type codes for PNI data types
Typed enumeration with type IDs.
Values:
-
NONE¶ no data type
-
INT8¶ signed 8Bit integer
-
UINT8¶ unsigned 8Bit integer
-
INT16¶ signed 16Bit integer
-
UINT16¶ unsigned 16Bit integer
-
INT32¶ signed 32Bit integer
-
UINT32¶ unsigned 32Bit integer
-
INT64¶ signed 64Bit integer
-
UINT64¶ unsigned 64Bit integer
-
FLOAT32¶ 32Bit IEEE floating point
-
FLOAT64¶ 64Bit IEEE floating point
-
FLOAT128¶ 128Bit IEEE floating point
-
COMPLEX32¶ 32Bit IEEE floating point complex
-
COMPLEX64¶ 64Bit IEEE floating point complex
-
COMPLEX128¶ 128Bit IEEE floating point complex
-
STRING¶ String type.
-
BINARY¶ binary data
-
BOOL¶ boolean data
-
Operators¶
Warning
doxygenfunction: Unable to resolve multiple matches for function “operator<<” with arguments (std::ostream &, const type_id_t &) in doxygen xml output for project “pnicore” from directory: /home/jkotan/sources/libpnicore-build/doc/api_doc/xml. Potential matches:
- PNICORE_EXPORT std::ostream &pni::core::operator<<(std::ostream&, const bool_t&)
- PNICORE_EXPORT std::ostream &pni::core::operator<<(std::ostream&, const exception_record&)
- PNICORE_EXPORT std::ostream &pni::core::operator<<(std::ostream&, const none&)
- PNICORE_EXPORT std::ostream &pni::core::operator<<(std::ostream&, const slice&)
- PNICORE_EXPORT std::ostream &pni::core::operator<<(std::ostream&, const type_id_t&)
- std::ostream &pni::core::operator<<(std::ostream&, const array_selection&)
- std::ostream &pni::core::operator<<(std::ostream&, const benchmark_result&)
- std::ostream &pni::core::operator<<(std::ostream&, const cli_args&)
- std::ostream &pni::core::operator<<(std::ostream&, const cli_argument_error&)
- std::ostream &pni::core::operator<<(std::ostream&, const cli_error&)
- std::ostream &pni::core::operator<<(std::ostream&, const cli_help_request&)
- std::ostream &pni::core::operator<<(std::ostream&, const cli_option_error&)
- std::ostream &pni::core::operator<<(std::ostream&, const configuration&)
- std::ostream &pni::core::operator<<(std::ostream&, const exception&)
- std::ostream &pni::core::operator<<(std::ostream&, const file_error&)
- std::ostream &pni::core::operator<<(std::ostream&, const index_error&)
- std::ostream &pni::core::operator<<(std::ostream&, const iterator_error&)
- std::ostream &pni::core::operator<<(std::ostream&, const key_error&)
- std::ostream &pni::core::operator<<(std::ostream&, const memory_allocation_error&)
- std::ostream &pni::core::operator<<(std::ostream&, const memory_not_allocated_error&)
- std::ostream &pni::core::operator<<(std::ostream&, const not_implemented_error&)
- std::ostream &pni::core::operator<<(std::ostream&, const range_error&)
- std::ostream &pni::core::operator<<(std::ostream&, const shape_mismatch_error&)
- std::ostream &pni::core::operator<<(std::ostream&, const size_mismatch_error&)
- std::ostream &pni::core::operator<<(std::ostream&, const type_error&)
- std::ostream &pni::core::operator<<(std::ostream&, const value_error&)
- template <typename ATYPE>
std::ostream &pni::core::operator<<(std::ostream&, const array_view<ATYPE>&)
- template <typename NTYPE>
std::ostream &pni::core::operator<<(std::ostream&, const binary_t<NTYPE>&)
- template <typename STORAGE, typename IMAP, typename IPA>
std::ostream &pni::core::operator<<(std::ostream&, const mdarray<STORAGE, IMAP, IPA>&)
- template <typename T>
std::ostream &pni::core::operator<<(std::ostream&, const scalar<T>&)
Predicates¶
-
PNICORE_EXPORT bool
pni::core::is_numeric(type_id_t tid)¶ check numeric type
Returns true if the type associated with tid belongs to the numeric types.
- Return
- true if tid refers to a numeric type, false otherwise
- Parameters
tid: type ID of the type to check
-
PNICORE_EXPORT bool
pni::core::is_integer(type_id_t tid)¶ check integer type
Returns true if the type associated with tid belongs to the integer types.
- Return
- true if tid refers to an integer type, false otherwise
- Parameters
tid: type ID of the type to check
-
PNICORE_EXPORT bool
pni::core::is_complex(type_id_t tid)¶ check complex type
Returns true if the type associated with tid belongs to the complex types.
- Return
- true if tid refers to a complex type, false otherwise
- Parameters
tid: type ID of the type to check
-
PNICORE_EXPORT bool
pni::core::is_float(type_id_t tid)¶ check float type
Returns true if the type associated with the tid belongs to the float types.
- Return
- true if tid refers to a float type, false otherwise
- Parameters
tid: id of the type to check
-
PNICORE_EXPORT bool
pni::core::is_checked_convertible(type_id_t source_tid, type_id_t target_tid)¶ check if two types are checked convertible
Returns true if two types, determined by their type ID, are checked convertible.
- Return
- true if types are checked convertible, false otherwise
- Parameters
source_tid: ID of the source typetarget_tid: ID of the target type
-
PNICORE_EXPORT bool
pni::core::is_unchecked_convertible(type_id_t source_tid, type_id_t target_tid)¶ check if two types are unchecked convertible
Returns true if two types, determined by their type ID, are unchecked convertible.
- Return
- true if types are unchecked convertible, false otherwise
- Parameters
source_tid: ID of the source typetarget_tid: ID of the target type
-
PNICORE_EXPORT bool
pni::core::is_convertible(type_id_t source_tid, type_id_t target_tid)¶ check if two types are unchecked convertible
Returns true if two types, determined by their type ID, are convertible.
- Return
- true if types are , false otherwise
- Parameters
source_tid: ID of the source typetarget_tid: ID of the target type
Utility functions¶
-
PNICORE_EXPORT type_id_t
pni::core::type_id_from_str(const string &s)¶ get a type ID from a string
Returns the type ID for a particular string representation of a type. If the string passed is not a valid type representation an exception will be thrown.
- Return
- corresponding type ID
- Exceptions
key_error: if the string does not describe a type
- Parameters
s: string representation of the type
-
PNICORE_EXPORT string
pni::core::str_from_type_id(type_id_t id)¶ get the string rep. for a type
Returns the string representation for a type determined by its type id. If the type determined by the ID does not have a string representation an exception will be thrown.
- Return
- string representation of the type
- Exceptions
key_error: if the type has no string representation
- Parameters
id: type ID of the type
Warning
doxygenfunction: Unable to resolve multiple matches for function “type_id” with arguments (const T &) in doxygen xml output for project “pnicore” from directory: /home/jkotan/sources/libpnicore-build/doc/api_doc/xml. Potential matches:
- PNICORE_EXPORT type_id_t pni::core::type_id(const array&)
- PNICORE_EXPORT type_id_t pni::core::type_id(const value&)
- template <typename ATYPE>
type_id_t pni::core::type_id(const array_view<ATYPE>&)
- template <typename T>
type_id_t pni::core::type_id(const T&)
- type_id_t pni::core::array::type_id() const
- type_id_t pni::core::value::type_id() const
- type_id_t pni::core::value_ref::type_id() const
- virtual type_id_t pni::core::array_holder::type_id() const
- virtual type_id_t pni::core::array_holder_interface::type_id() const = 0
- virtual type_id_t pni::core::value_holder::type_id() const
- virtual type_id_t pni::core::value_holder_interface::type_id() const = 0
pni::core::bool_t¶
-
class
bool_t¶ boolean type
There is a particular problem when using the standard bool type in connection with std::vector. The std::vector template is overloaded for bool in a sense that each boolean value is stored in an individual bit. Thus elements cannot be addressed. Thus std::vector<bool> cannot be used in connection with libpniio. This type prevents the C++ compiler to overload std:vector<bool_t> making boolean values available for libpniio.
pni::core::none¶
-
struct
none¶ none type
This type is used in situations where a type for initialization is required but not provided (or at the moment not available). It thus denotes the absence of type information.
Operators¶
Warning
doxygenfunction: Unable to resolve multiple matches for function “operator<<” with arguments (std::ostream &, const none &) in doxygen xml output for project “pnicore” from directory: /home/jkotan/sources/libpnicore-build/doc/api_doc/xml. Potential matches:
- PNICORE_EXPORT std::ostream &pni::core::operator<<(std::ostream&, const bool_t&)
- PNICORE_EXPORT std::ostream &pni::core::operator<<(std::ostream&, const exception_record&)
- PNICORE_EXPORT std::ostream &pni::core::operator<<(std::ostream&, const none&)
- PNICORE_EXPORT std::ostream &pni::core::operator<<(std::ostream&, const slice&)
- PNICORE_EXPORT std::ostream &pni::core::operator<<(std::ostream&, const type_id_t&)
- std::ostream &pni::core::operator<<(std::ostream&, const array_selection&)
- std::ostream &pni::core::operator<<(std::ostream&, const benchmark_result&)
- std::ostream &pni::core::operator<<(std::ostream&, const cli_args&)
- std::ostream &pni::core::operator<<(std::ostream&, const cli_argument_error&)
- std::ostream &pni::core::operator<<(std::ostream&, const cli_error&)
- std::ostream &pni::core::operator<<(std::ostream&, const cli_help_request&)
- std::ostream &pni::core::operator<<(std::ostream&, const cli_option_error&)
- std::ostream &pni::core::operator<<(std::ostream&, const configuration&)
- std::ostream &pni::core::operator<<(std::ostream&, const exception&)
- std::ostream &pni::core::operator<<(std::ostream&, const file_error&)
- std::ostream &pni::core::operator<<(std::ostream&, const index_error&)
- std::ostream &pni::core::operator<<(std::ostream&, const iterator_error&)
- std::ostream &pni::core::operator<<(std::ostream&, const key_error&)
- std::ostream &pni::core::operator<<(std::ostream&, const memory_allocation_error&)
- std::ostream &pni::core::operator<<(std::ostream&, const memory_not_allocated_error&)
- std::ostream &pni::core::operator<<(std::ostream&, const not_implemented_error&)
- std::ostream &pni::core::operator<<(std::ostream&, const range_error&)
- std::ostream &pni::core::operator<<(std::ostream&, const shape_mismatch_error&)
- std::ostream &pni::core::operator<<(std::ostream&, const size_mismatch_error&)
- std::ostream &pni::core::operator<<(std::ostream&, const type_error&)
- std::ostream &pni::core::operator<<(std::ostream&, const value_error&)
- template <typename ATYPE>
std::ostream &pni::core::operator<<(std::ostream&, const array_view<ATYPE>&)
- template <typename NTYPE>
std::ostream &pni::core::operator<<(std::ostream&, const binary_t<NTYPE>&)
- template <typename STORAGE, typename IMAP, typename IPA>
std::ostream &pni::core::operator<<(std::ostream&, const mdarray<STORAGE, IMAP, IPA>&)
- template <typename T>
std::ostream &pni::core::operator<<(std::ostream&, const scalar<T>&)
Warning
doxygenfunction: Unable to resolve multiple matches for function “operator>>” with arguments (std::istream &, none &) in doxygen xml output for project “pnicore” from directory: /home/jkotan/sources/libpnicore-build/doc/api_doc/xml. Potential matches:
- PNICORE_EXPORT std::istream &pni::core::operator>>(std::istream&, bool_t&)
- PNICORE_EXPORT std::istream &pni::core::operator>>(std::istream&, none&)
- template <typename ATYPE>
std::istream &pni::core::operator>>(std::istream&, array_view<ATYPE>&)
- template <typename NTYPE>
std::istream &pni::core::operator>>(std::istream&, binary_t<NTYPE>&)
- template <typename STORAGE, typename IMAP, typename IPA>
std::istream &pni::core::operator>>(std::istream&, mdarray<STORAGE, IMAP, IPA>&)
- template <typename T>
std::istream &pni::core::operator>>(std::istream&, scalar<T>&)
Warning
doxygenfunction: Unable to resolve multiple matches for function “operator==” with arguments (const none &, const none &) in doxygen xml output for project “pnicore” from directory: /home/jkotan/sources/libpnicore-build/doc/api_doc/xml. Potential matches:
- PNICORE_EXPORT bool pni::core::operator==(const complex128&, const complex32&)
- PNICORE_EXPORT bool pni::core::operator==(const complex128&, const complex64&)
- PNICORE_EXPORT bool pni::core::operator==(const complex32&, const complex128&)
- PNICORE_EXPORT bool pni::core::operator==(const complex32&, const complex64&)
- PNICORE_EXPORT bool pni::core::operator==(const complex64&, const complex128&)
- PNICORE_EXPORT bool pni::core::operator==(const complex64&, const complex32&)
- PNICORE_EXPORT bool pni::core::operator==(const none&, const none&)
- PNICORE_EXPORT bool pni::core::operator==(const slice&, const slice&)
- bool pni::core::array_iterator::operator==(const iterator_type&)
- bool pni::core::container_iterator::operator==(const iterator_type&) const
- bool pni::core::index_iterator::operator==(const iterator_type&)
- bool pni::core::scalar_iterator::operator==(const iterator_type&)
- template <typename ATYPE>
bool pni::core::operator==(const array_view<ATYPE>&, const array_view<ATYPE>&)
- template <typename STORAGE, typename IMAP, typename IPA>
bool pni::core::operator==(const mdarray<STORAGE, IMAP, IPA>&, const mdarray<STORAGE, IMAP, IPA>&)
- template <typename T>
bool pni::core::operator==(const scalar<T>&, const scalar<T>&)
Warning
doxygenfunction: Unable to resolve multiple matches for function “operator!=” with arguments (const none &, const none &) in doxygen xml output for project “pnicore” from directory: /home/jkotan/sources/libpnicore-build/doc/api_doc/xml. Potential matches:
- PNICORE_EXPORT bool pni::core::operator!=(const complex128&, const complex32&)
- PNICORE_EXPORT bool pni::core::operator!=(const complex128&, const complex64&)
- PNICORE_EXPORT bool pni::core::operator!=(const complex32&, const complex128&)
- PNICORE_EXPORT bool pni::core::operator!=(const complex32&, const complex64&)
- PNICORE_EXPORT bool pni::core::operator!=(const complex64&, const complex128&)
- PNICORE_EXPORT bool pni::core::operator!=(const complex64&, const complex32&)
- PNICORE_EXPORT bool pni::core::operator!=(const none&, const none&)
- PNICORE_EXPORT bool pni::core::operator!=(const slice&, const slice&)
- bool pni::core::array_iterator::operator!=(const iterator_type&)
- bool pni::core::container_iterator::operator!=(const iterator_type&) const
- bool pni::core::index_iterator::operator!=(const iterator_type&)
- bool pni::core::scalar_iterator::operator!=(const iterator_type&)
- template <typename ATYPE>
bool pni::core::operator!=(const array_view<ATYPE>&, const array_view<ATYPE>&)
- template <typename STORAGE, typename IMAP, typename IPA>
bool pni::core::operator!=(const mdarray<STORAGE, IMAP, IPA>&, const mdarray<STORAGE, IMAP, IPA>&)
- template <typename T>
bool pni::core::operator!=(const scalar<T>&, const scalar<T>&)
pni::core::binary_t¶
-
template <typename NTYPE>
classbinary_t¶ Binary data type.
This class represents a binary data type. Typically binary data is represented by a typedef to an unsigned char type. However, this has an inconvenience: the unsigned char and the typedef for binary are indistinguishable by the compiler. Thus, such a binary type cannot be used for function overloading or for template specialization - it would always be treated by the compiler as the underlying unsigned char type.
To circumvent this problem
libpnicoredefines this binary type which can be used instead of a simple typedef to unsigned char. The BinaryType template has several advantages:- it can be distinguished from the type used to store binary data
- all arithmetic operators are stripped from the type.
Thus this type cannot be used for arithmetic operations directly. Its primary purpose is to hold uninterpreted binary data for transfer. However it can be converted to the native type used to hold the data. Stream operators are provided for IO operations using binary data.
- Template Parameters
NTYPE: native type used to store binary data
Public Types
-
typedef NTYPE
storage_type¶ native type that is used for binary data
Public Functions
-
binary_t()¶ default constructor
-
binary_t(const storage_type &value)¶ constructor
-
binary_t(const binary_t<storage_type> &o)¶ copy constructor
-
operator NTYPE() const¶ conversion operator
Allows a conversion from BinaryType<NTYPE> to the underlying NTYPE.
Warning
doxygenfunction: Unable to resolve multiple matches for function “pni::core::operator<<” with arguments (std::ostream &, const binary_t< NTYPE > &) in doxygen xml output for project “pnicore” from directory: /home/jkotan/sources/libpnicore-build/doc/api_doc/xml. Potential matches:
- PNICORE_EXPORT std::ostream &pni::core::operator<<(std::ostream&, const bool_t&)
- PNICORE_EXPORT std::ostream &pni::core::operator<<(std::ostream&, const exception_record&)
- PNICORE_EXPORT std::ostream &pni::core::operator<<(std::ostream&, const none&)
- PNICORE_EXPORT std::ostream &pni::core::operator<<(std::ostream&, const slice&)
- PNICORE_EXPORT std::ostream &pni::core::operator<<(std::ostream&, const type_id_t&)
- std::ostream &pni::core::operator<<(std::ostream&, const array_selection&)
- std::ostream &pni::core::operator<<(std::ostream&, const benchmark_result&)
- std::ostream &pni::core::operator<<(std::ostream&, const cli_args&)
- std::ostream &pni::core::operator<<(std::ostream&, const cli_argument_error&)
- std::ostream &pni::core::operator<<(std::ostream&, const cli_error&)
- std::ostream &pni::core::operator<<(std::ostream&, const cli_help_request&)
- std::ostream &pni::core::operator<<(std::ostream&, const cli_option_error&)
- std::ostream &pni::core::operator<<(std::ostream&, const configuration&)
- std::ostream &pni::core::operator<<(std::ostream&, const exception&)
- std::ostream &pni::core::operator<<(std::ostream&, const file_error&)
- std::ostream &pni::core::operator<<(std::ostream&, const index_error&)
- std::ostream &pni::core::operator<<(std::ostream&, const iterator_error&)
- std::ostream &pni::core::operator<<(std::ostream&, const key_error&)
- std::ostream &pni::core::operator<<(std::ostream&, const memory_allocation_error&)
- std::ostream &pni::core::operator<<(std::ostream&, const memory_not_allocated_error&)
- std::ostream &pni::core::operator<<(std::ostream&, const not_implemented_error&)
- std::ostream &pni::core::operator<<(std::ostream&, const range_error&)
- std::ostream &pni::core::operator<<(std::ostream&, const shape_mismatch_error&)
- std::ostream &pni::core::operator<<(std::ostream&, const size_mismatch_error&)
- std::ostream &pni::core::operator<<(std::ostream&, const type_error&)
- std::ostream &pni::core::operator<<(std::ostream&, const value_error&)
- template <typename ATYPE>
std::ostream &pni::core::operator<<(std::ostream&, const array_view<ATYPE>&)
- template <typename NTYPE>
std::ostream &pni::core::operator<<(std::ostream&, const binary_t<NTYPE>&)
- template <typename STORAGE, typename IMAP, typename IPA>
std::ostream &pni::core::operator<<(std::ostream&, const mdarray<STORAGE, IMAP, IPA>&)
- template <typename T>
std::ostream &pni::core::operator<<(std::ostream&, const scalar<T>&)