 |
LibraryLink Utilities
3.0.1
Modern C++ wrapper over LibraryLink and WSTP
|
Go to the documentation of this file.
9 #ifndef LLU_CONTAINERS_NUMERICARRAY_H_
10 #define LLU_CONTAINERS_NUMERICARRAY_H_
12 #include <initializer_list>
13 #include <type_traits>
37 T* getData()
const noexcept
override {
41 virtual MNumericArray getInternal()
const = 0;
70 template<
class Container,
typename = std::enable_if_t<is_iterable_container_with_matching_type_v<Container, T> && has_size_v<Container>>>
79 template<
class Container,
typename = std::enable_if_t<is_iterable_container_with_matching_type_v<Container, T>>>
92 template<
class InputIt,
typename = enable_if_input_iterator<InputIt>>
111 template<
class InputIt,
typename = enable_if_input_iterator<InputIt>>
155 MNumericArray getInternal() const noexcept
override {
164 template<
class InputIt,
typename>
170 std::fill(this->
begin(), this->
end(), init);
174 template<
class InputIt,
typename>
180 std::copy(first, last, this->
begin());
185 if (NumericArrayType<T> != GenericBase::type()) {
This is a class template, where template parameter T is the type of data elements....
Definition: NumericArray.h:54
MContainer specialization for MNumericArray.
Definition: Generic/NumericArray.hpp:23
MContainer< MArgumentType::NumericArray > GenericNumericArray
MContainer specialization for MNumericArray is called GenericNumericArray.
Definition: Generic/NumericArray.hpp:17
Main namespace of LibraryLink Utilities.
Definition: Queue.h:13
mint getRank() const override
Get rank.
Definition: Generic/NumericArray.hpp:62
ConversionMethod
Possible methods of handling out-of-range data when converting a NumericArray to different type.
Definition: Utilities.hpp:207
Helper class that carries meta-information about container's size and dimensions.
Definition: MArrayDimensions.h:23
NumericArray clone() const
Clone this NumericArray, performing a deep copy of the underlying MNumericArray.
Definition: NumericArray.h:148
Argument::CType< Type > Container
The type of underlying LibraryLink structure (e.g. MTensor, MImage, etc.) will be called "Container".
Definition: Base.hpp:38
const std::string NumericArrayNewError
creating new NumericArray failed
NumericArray(const Container &c, MArrayDimensions dims)
Constructs a NumericArray with contents copied from a given collection of data and dimensions passed ...
Definition: NumericArray.h:80
This is a class template, where template parameter T is the type of data elements....
Definition: MArray.hpp:36
NumericArray()=default
Default constructor, creates a "hollow" NumericArray that does not have underlying MNumericArray.
const std::string NumericArrayTypeError
NumericArray type mismatch.
@ Library
The library (LLU) is responsible for managing the container's memory. Used for Manual passing and con...
Template base class for C++ wrappers of LibraryLink containers.
Typed interface for NumericArray.
Definition: NumericArray.h:29
Container getContainer() const noexcept
Get internal container.
Definition: Base.hpp:97
Container cloneContainer() const
Clone the raw container, if it's present.
Definition: Base.hpp:150
static void throwException(const std::string &errorName, T &&... args)
Throw exception with given name.
Definition: ErrorManager.h:199
mint getFlattenedLength() const override
Get length.
Definition: Generic/NumericArray.hpp:72
mint const * getDimensions() const override
Get dimensions.
Definition: Generic/NumericArray.hpp:67
static const st_WolframNumericArrayLibrary_Functions * NumericArrayAPI()
Get a pointer to structure with function pointers to MNumericArray API.
Definition: LibraryData.cpp:33
NumericArray(const Container &c)
Constructs flat NumericArray with contents copied from a given collection of data.
Definition: NumericArray.h:71
iterator begin() noexcept
Get iterator at the beginning of underlying data.
Definition: IterableContainer.hpp:71
constexpr numericarray_data_t NumericArrayType
Utility structure that matches a C++ type with a corresponding MNumericArray data type.
Definition: Utilities.hpp:265
Ownership
An enum listing possible owners of a LibraryLink container.
Definition: Base.hpp:22
Short but generally useful functions.
GenericNumericArray definition and implementation.
iterator end() noexcept
Get iterator after the end of underlying data.
Definition: IterableContainer.hpp:92