LibraryLink Utilities  3.0.1
Modern C++ wrapper over LibraryLink and WSTP
LLU::MArgumentManager Class Reference

Description

Manages arguments exchanged between the paclet C++ code and LibraryLink interface.

MArgumentManager provides a safe way to access MArguments received from LibraryLink and takes care of memory management both for in- and out- arguments. Using MArgumentManager one can perform generic operations on NumericArrays, Tensors and Images independent of their data type.

#include <MArgumentManager.h>

Classes

struct  CustomType
 Helper structure that can be used to register user-defined argument types in LLU. More...
 
struct  Getter
 Helper structure to fully customize the way MArgumentManager reads T as argument type. More...
 
struct  Managed
 Helper struct to "attach" a passing mode to container type when passing it as template argument to MArgumentManager::getTuple. More...
 
struct  Setter
 Helper structure to fully customize the way MArgumentManager sets an object of type T as result of a library function. More...
 

Public Types

using size_type = std::size_t
 Size type for indexing the list of arguments that MArgumentManager manages. More...
 
template<typename T >
using RequestedType = typename RequestedTypeImpl< T >::type
 RequestedType<T> is usually just T and is used as return type of MArgumentManager::get(size_type) More...
 

Public Member Functions

 MArgumentManager (mint Argc, MArgument *Args, MArgument &Res)
 Constructor. More...
 
 MArgumentManager (WolframLibraryData ld, mint Argc, MArgument *Args, MArgument &Res)
 Constructor. More...
 
bool getBoolean (size_type index) const
 Get MArgument of type mbool at position index. More...
 
double getReal (size_type index) const
 Get MArgument of type mreal at position index. More...
 
template<typename T >
getInteger (size_type index) const
 Get MArgument of type mint at position index with extra static_cast if needed. More...
 
std::complex< double > getComplex (size_type index) const
 Get MArgument of type mcomplex at position index. More...
 
char * getCString (size_type index) const
 Get value of MArgument of type "UTF8String" at position index. More...
 
std::string getString (size_type index) const
 Get value of MArgument of type "UTF8String" at position index. More...
 
template<typename T , Passing Mode = Passing::Automatic>
NumericArray< T > getNumericArray (size_type index) const
 Get MArgument of type MNumericArray at position index and wrap it into NumericArray. More...
 
template<Passing Mode = Passing::Automatic>
GenericNumericArray getGenericNumericArray (size_type index) const
 Get MArgument of type MNumericArray at position index and wrap it into generic MContainer wrapper. More...
 
MNumericArray getMNumericArray (size_type index) const
 Get MArgument of type MNumericArray at position index. More...
 
template<typename T , Passing Mode = Passing::Automatic>
Tensor< T > getTensor (size_type index) const
 Get MArgument of type MTensor at position index and wrap it into Tensor object. More...
 
template<Passing Mode = Passing::Automatic>
GenericTensor getGenericTensor (size_type index) const
 Get MArgument of type MTensor at position index and wrap it into generic MContainer wrapper. More...
 
MTensor getMTensor (size_type index) const
 Get MArgument of type MTensor at position index. More...
 
template<typename T , Passing Mode = Passing::Automatic>
SparseArray< T > getSparseArray (size_type index) const
 Get MArgument of type MSparseArray at position index and wrap it into SparseArray. More...
 
template<Passing Mode = Passing::Automatic>
GenericSparseArray getGenericSparseArray (size_type index) const
 Get MArgument of type MSparseArray at position index and wrap it into generic MContainer wrapper. More...
 
MSparseArray getMSparseArray (size_type index) const
 Get MArgument of type MSparseArray at position index. More...
 
template<typename T , Passing Mode = Passing::Automatic>
Image< T > getImage (size_type index) const
 Get MArgument of type MImage at position index and wrap it into Image object. More...
 
template<Passing Mode = Passing::Automatic>
GenericImage getGenericImage (size_type index) const
 Get MArgument of type MImage at position index and wrap it into generic MContainer wrapper. More...
 
MImage getMImage (size_type index) const
 Get MArgument of type MImage at position index. More...
 
template<typename T , Passing Mode = Passing::Automatic>
DataList< T > getDataList (size_type index) const
 Get DataStore with all nodes of the same type from MArgument at position index. More...
 
template<Passing Mode = Passing::Automatic>
GenericDataList getGenericDataList (size_type index) const
 Get MArgument of type DataStore at position index and wrap it into generic MContainer wrapper. More...
 
DataStore getDataStore (size_type index) const
 Get MArgument of type DataStore at position index. More...
 
template<class ManagedExpr , class DynamicType = ManagedExpr>
DynamicType & getManagedExpression (size_type index, ManagedExpressionStore< ManagedExpr > &store) const
 Get a reference to an instance of Managed Expression that was sent from Wolfram Language as argument to a library function. More...
 
template<class ManagedExpr , class DynamicType = ManagedExpr>
std::shared_ptr< DynamicType > getManagedExpressionPtr (size_type index, ManagedExpressionStore< ManagedExpr > &store) const
 Get a shared pointer to an instance of Managed Expression that was sent from Wolfram Language as argument to a library function. More...
 
template<typename T >
RequestedType< T > get (size_type index) const
 Extract library function argument at given index and convert it from MArgument to a desired type. More...
 
template<typename... ArgTypes>
std::tuple< RequestedType< ArgTypes >... > getTuple (size_type index=0) const
 Extract arguments from the Manager and return them as values of given types. More...
 
template<typename... ArgTypes>
std::tuple< RequestedType< ArgTypes >... > getTuple (std::array< size_type, sizeof...(ArgTypes)> indices) const
 Extract arguments from the Manager at given positions and return them as values of given types. More...
 
void setBoolean (bool result) noexcept
 Set result as output MArgument. More...
 
void setReal (double result) noexcept
 Set result as output MArgument. More...
 
void setInteger (mint result) noexcept
 Set result as output MArgument. More...
 
template<typename T >
bool setMintAndCheck (T result) noexcept
 Set result as output MArgument and check for overflow. More...
 
void setComplex (std::complex< double > c) noexcept
 Set c as output MArgument. More...
 
void setString (const std::string &str)
 Set str as output MArgument. More...
 
void setString (const char *str)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
void setString (std::string &&str)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
template<typename T >
void setNumericArray (const NumericArray< T > &na)
 Set MNumericArray wrapped by na as output MArgument. More...
 
void setMNumericArray (MNumericArray na)
 Set MNumericArray as output MArgument. More...
 
template<typename T >
void setTensor (const Tensor< T > &ten)
 Set MTensor wrapped by ten as output MArgument. More...
 
void setMTensor (MTensor t)
 Set MTensor as output MArgument. More...
 
template<typename T >
void setImage (const Image< T > &im)
 Set MImage wrapped by im as output MArgument. More...
 
void setMImage (MImage im)
 Set MImage as output MArgument. More...
 
template<typename T >
void setDataList (const DataList< T > &ds)
 Set DataStore wrapped in DataList ds as output MArgument. More...
 
void setDataStore (DataStore ds)
 Set DataStore as output MArgument. More...
 
template<typename T >
void setSparseArray (const SparseArray< T > &sa)
 Set MSparseArray wrapped by sa as output MArgument. More...
 
void setMSparseArray (MSparseArray sa)
 Set MSparseArray as output MArgument. More...
 
void set (bool result) noexcept
 Set result as output MArgument. More...
 
void set (double result) noexcept
 Set result as output MArgument. More...
 
void set (mint result) noexcept
 Set result as output MArgument. More...
 
void set (std::complex< double > c) noexcept
 Set c as output MArgument. More...
 
void set (const std::string &str)
 Set str as output MArgument. More...
 
void set (const char *str)
 Set str as output MArgument. More...
 
void set (std::string &&str)
 Set str as output MArgument. More...
 
template<typename T >
void set (const NumericArray< T > &na)
 Set MNumericArray wrapped by na as output MArgument. More...
 
void set (const GenericNumericArray &na)
 Set MNumericArray wrapped by na as output MArgument. More...
 
template<typename T >
void set (const SparseArray< T > &ten)
 Set MSparseArray wrapped by sa as output MArgument. More...
 
void set (const GenericSparseArray &t)
 Set MSparseArray wrapped by t as output MArgument. More...
 
template<typename T >
void set (const Tensor< T > &ten)
 Set MTensor wrapped by ten as output MArgument. More...
 
void set (const GenericTensor &t)
 Set MTensor wrapped by t as output MArgument. More...
 
template<typename T >
void set (const Image< T > &im)
 Set MImage wrapped by im as output MArgument. More...
 
void set (const GenericImage &im)
 Set MImage wrapped by im as output MArgument. More...
 
template<typename T >
void set (const DataList< T > &ds)
 Set DataStore wrapped in DataList ds as output MArgument. More...
 
void set (const GenericDataList &ds)
 Set DataStore wrapped by ds as output MArgument. More...
 
template<typename T >
void set (const T &arg)
 Set given value as a result of the library function. More...
 
ProgressMonitor getProgressMonitor (double step=ProgressMonitor::getDefaultStep()) const
 Get ProgressMonitor shared with WL Kernel. More...
 
numericarray_data_t getNumericArrayType (size_type index) const
 Get type of MNumericArray at position index in Args. More...
 
template<Passing Mode, class Operator , class... OpArgs>
void operateOnNumericArray (size_type index, OpArgs &&... opArgs)
 Perform operation on NumericArray created from MNumericArray argument at position index in Args. More...
 
template<Passing Mode = Passing::Automatic, class Operator >
void operateOnNumericArray (size_type index, Operator &&op)
 Perform operation on NumericArray created from MNumericArray argument at position index in Args. More...
 
unsigned char getTensorType (size_type index) const
 Get type of MTensor at position index in Args. More...
 
template<Passing Mode, class Operator , class... Args>
void operateOnTensor (size_type index, Args &&... opArgs)
 Perform operation on Tensor created from MTensor argument at position index in Args. More...
 
template<Passing Mode = Passing::Automatic, class Operator >
void operateOnTensor (size_type index, Operator &&op)
 Perform operation on Tensor created from MTensor argument at position index in Args. More...
 
imagedata_t getImageType (size_type index) const
 Get type of MImage at position index in Args. More...
 
template<Passing Mode, class Operator , class... Args>
void operateOnImage (size_type index, Args &&... opArgs)
 Perform operation on Image created from MImage argument at position index in Args. More...
 
template<Passing Mode = Passing::Automatic, class Operator >
void operateOnImage (size_type index, Operator &&op)
 Perform operation on Image created from MImage argument at position index in Args. More...
 

Type aliases documentation

◆ RequestedType

template<typename T >
using LLU::MArgumentManager::RequestedType = typename RequestedTypeImpl<T>::type

RequestedType<T> is usually just T and is used as return type of MArgumentManager::get(size_type)

◆ size_type

using LLU::MArgumentManager::size_type = std::size_t

Size type for indexing the list of arguments that MArgumentManager manages.

Constructor & Destructor Documentation

◆ MArgumentManager() [1/2]

LLU::MArgumentManager::MArgumentManager ( mint  Argc,
MArgument *  Args,
MArgument &  Res 
)

Constructor.

Parameters
[in]Argc- number of MArguments provided
[in]Args- MArguments provided
[in]Res- reference to output MArgument

◆ MArgumentManager() [2/2]

LLU::MArgumentManager::MArgumentManager ( WolframLibraryData  ld,
mint  Argc,
MArgument *  Args,
MArgument &  Res 
)

Constructor.

Parameters
[in]ld- library data
[in]Argc- number of MArguments provided
[in]Args- MArguments provided
[in]Res- reference to output MArgument

Member Function Documentation

◆ get()

template<typename T >
RequestedType<T> LLU::MArgumentManager::get ( size_type  index) const
inline

Extract library function argument at given index and convert it from MArgument to a desired type.

Template Parameters
T- any type, for types not supported by default developers may specialize this function template
Parameters
index- position of desired argument in Args
Returns
a value of type T created from the specified input argument

◆ getBoolean()

bool LLU::MArgumentManager::getBoolean ( size_type  index) const

Get MArgument of type mbool at position index.

Parameters
[in]index- position of desired MArgument in Args
Returns
MArgument of type bool at position index
Exceptions
ErrorName::MArgumentIndexError- if index is out-of-bounds

◆ getComplex()

std::complex< double > LLU::MArgumentManager::getComplex ( size_type  index) const

Get MArgument of type mcomplex at position index.

Parameters
[in]index- position of desired MArgument in Args
Returns
MArgument value at position index converted to std::complex<double>
Exceptions
ErrorName::MArgumentIndexError- if index is out-of-bounds

◆ getCString()

char * LLU::MArgumentManager::getCString ( size_type  index) const

Get value of MArgument of type "UTF8String" at position index.

Parameters
[in]index- position of desired MArgument in Args
Returns
C-string which was received from LibraryLink
Exceptions
LLErrorCode::MArgumentIndexError- if index is out-of-bounds
Note
MArgumentManager is responsible for disowning string arguments. Do not call free() or delete() on resulting pointer.

◆ getDataList()

template<typename T , Passing Mode = Passing::Automatic>
DataList<T> LLU::MArgumentManager::getDataList ( size_type  index) const

Get DataStore with all nodes of the same type from MArgument at position index.

Template Parameters
T- type of data stored in each node of DataStore, it T is MArgumentType::MArgument it will accept any node
Parameters
[in]index- position of desired MArgument in Args
Returns
DataList wrapper of MArgument at position index
Exceptions
ErrorName::MArgumentIndexError- if index is out-of-bounds
See also
DataList<T>::DataList(DataStore ds);

◆ getDataStore()

DataStore LLU::MArgumentManager::getDataStore ( size_type  index) const

Get MArgument of type DataStore at position index.

Warning
Use of this function is discouraged. Use getDataList instead.
Parameters
[in]index- position of desired MArgument in Args
Returns
DataStore of MArgument at position index
Exceptions
ErrorName::MArgumentIndexError- if index is out-of-bounds

◆ getGenericDataList()

template<Passing Mode = Passing::Automatic>
GenericDataList LLU::MArgumentManager::getGenericDataList ( size_type  index) const

Get MArgument of type DataStore at position index and wrap it into generic MContainer wrapper.

Template Parameters
Mode- passing mode to be used
Parameters
index- position of desired MArgument in Args
Returns
MContainer wrapper of DataStore with given passing mode

◆ getGenericImage()

template<Passing Mode = Passing::Automatic>
GenericImage LLU::MArgumentManager::getGenericImage ( size_type  index) const

Get MArgument of type MImage at position index and wrap it into generic MContainer wrapper.

Template Parameters
Mode- passing mode to be used
Parameters
index- position of desired MArgument in Args
Returns
MContainer wrapper of MImage with given passing mode

◆ getGenericNumericArray()

template<Passing Mode = Passing::Automatic>
GenericNumericArray LLU::MArgumentManager::getGenericNumericArray ( size_type  index) const

Get MArgument of type MNumericArray at position index and wrap it into generic MContainer wrapper.

Template Parameters
Mode- passing mode to be used
Parameters
index- position of desired MArgument in Args
Returns
MContainer wrapper of MNumericArray with given passing mode

◆ getGenericSparseArray()

template<Passing Mode = Passing::Automatic>
GenericSparseArray LLU::MArgumentManager::getGenericSparseArray ( size_type  index) const

Get MArgument of type MSparseArray at position index and wrap it into generic MContainer wrapper.

Template Parameters
Mode- passing mode to be used
Parameters
index- position of desired MArgument in Args
Returns
MContainer wrapper of MSparseArray with given passing mode

◆ getGenericTensor()

template<Passing Mode = Passing::Automatic>
GenericTensor LLU::MArgumentManager::getGenericTensor ( size_type  index) const

Get MArgument of type MTensor at position index and wrap it into generic MContainer wrapper.

Template Parameters
Mode- passing mode to be used
Parameters
index- position of desired MArgument in Args
Returns
MContainer wrapper of MTensor with given passing mode

◆ getImage()

template<typename T , Passing Mode = Passing::Automatic>
Image<T> LLU::MArgumentManager::getImage ( size_type  index) const

Get MArgument of type MImage at position index and wrap it into Image object.

Template Parameters
T- type of data stored in Image
Parameters
[in]index- position of desired MArgument in Args
Returns
Image wrapper of MArgument at position index
Exceptions
ErrorName::MArgumentIndexError- if index is out-of-bounds
See also
Image<T>::Image(const MImage ra);

◆ getImageType()

imagedata_t LLU::MArgumentManager::getImageType ( size_type  index) const

Get type of MImage at position index in Args.

Parameters
[in]index- position of desired MArgument in Args
Returns
MImage type
Exceptions
ErrorName::MArgumentIndexError- if index is out-of-bounds

◆ getInteger()

template<typename T >
T LLU::MArgumentManager::getInteger ( size_type  index) const

Get MArgument of type mint at position index with extra static_cast if needed.

Template Parameters
T- integral type to convert mint to
Parameters
[in]index- position of desired MArgument in Args
Returns
MArgument value at position index converted to T
Exceptions
ErrorName::MArgumentIndexError- if index is out-of-bounds

◆ getManagedExpression()

template<class ManagedExpr , class DynamicType = ManagedExpr>
DynamicType& LLU::MArgumentManager::getManagedExpression ( size_type  index,
ManagedExpressionStore< ManagedExpr > &  store 
) const

Get a reference to an instance of Managed Expression that was sent from Wolfram Language as argument to a library function.

Template Parameters
ManagedExpr- registered Managed Expression class
DynamicType- actual type of Managed Expression, this must be ManagedExpr or its subclass
Parameters
index- position of desired argument in Args
store- Managed Expression store that manages expressions of type ManagedExpr
Returns
a reference to the Managed Expression

◆ getManagedExpressionPtr()

template<class ManagedExpr , class DynamicType = ManagedExpr>
std::shared_ptr<DynamicType> LLU::MArgumentManager::getManagedExpressionPtr ( size_type  index,
ManagedExpressionStore< ManagedExpr > &  store 
) const

Get a shared pointer to an instance of Managed Expression that was sent from Wolfram Language as argument to a library function.

Template Parameters
ManagedExpr- registered Managed Expression class
DynamicType- actual type of Managed Expression, this must be ManagedExpr or its subclass
Parameters
index- position of desired argument in Args
store- Managed Expression store that manages expressions of type ManagedExpr
Returns
a shared pointer to the Managed Expression

◆ getMImage()

MImage LLU::MArgumentManager::getMImage ( size_type  index) const

Get MArgument of type MImage at position index.

Warning
Use of this function is discouraged. Use getImage instead, if possible.
Parameters
[in]index- position of desired MArgument in Args
Returns
MImage of MArgument at position index
Exceptions
ErrorName::MArgumentIndexError- if index is out-of-bounds

◆ getMNumericArray()

MNumericArray LLU::MArgumentManager::getMNumericArray ( size_type  index) const

Get MArgument of type MNumericArray at position index.

Warning
Use of this function is discouraged. Use getNumericArray instead, if possible.
Parameters
[in]index- position of desired MArgument in Args
Returns
MArgument at position index interpreted as MNumericArray
Exceptions
ErrorName::MArgumentIndexError- if index is out-of-bounds

◆ getMSparseArray()

MSparseArray LLU::MArgumentManager::getMSparseArray ( size_type  index) const

Get MArgument of type MSparseArray at position index.

Warning
Use of this function is discouraged. Use getSparseArray instead, if possible.
Parameters
[in]index- position of desired MArgument in Args
Returns
MArgument at position index interpreted as MSparseArray
Exceptions
ErrorName::MArgumentIndexError- if index is out-of-bounds

◆ getMTensor()

MTensor LLU::MArgumentManager::getMTensor ( size_type  index) const

Get MArgument of type MTensor at position index.

Warning
Use of this function is discouraged. Use getTensor instead, if possible.
Parameters
[in]index- position of desired MArgument in Args
Returns
MTensor of MArgument at position index
Exceptions
ErrorName::MArgumentIndexError- if index is out-of-bounds

◆ getNumericArray()

template<typename T , Passing Mode = Passing::Automatic>
NumericArray<T> LLU::MArgumentManager::getNumericArray ( size_type  index) const

Get MArgument of type MNumericArray at position index and wrap it into NumericArray.

Template Parameters
T- type of data stored in NumericArray
Parameters
[in]index- position of desired MArgument in Args
Returns
NumericArray wrapper of MArgument at position index
Exceptions
ErrorName::MArgumentIndexError- if index is out-of-bounds
See also
NumericArray<T>::NumericArray(const MNumericArray);

◆ getNumericArrayType()

numericarray_data_t LLU::MArgumentManager::getNumericArrayType ( size_type  index) const

Get type of MNumericArray at position index in Args.

Parameters
[in]index- position of desired MArgument in Args
Returns
MNumericArray type
Exceptions
ErrorName::MArgumentIndexError- if index is out-of-bounds

◆ getProgressMonitor()

ProgressMonitor LLU::MArgumentManager::getProgressMonitor ( double  step = ProgressMonitor::getDefaultStep()) const

Get ProgressMonitor shared with WL Kernel.

Parameters
step- step value for progress monitor
Returns
A new instance of ProgressMonitor class.
Warning
If you haven't specified "ProgressMonitor" option when loading the library function with PacletFunctionSet, then the behavior of getProgressMonitor is undefined.

◆ getReal()

double LLU::MArgumentManager::getReal ( size_type  index) const

Get MArgument of type mreal at position index.

Parameters
[in]index- position of desired MArgument in Args
Returns
MArgument of type double at position index
Exceptions
ErrorName::MArgumentIndexError- if index is out-of-bounds

◆ getSparseArray()

template<typename T , Passing Mode = Passing::Automatic>
SparseArray<T> LLU::MArgumentManager::getSparseArray ( size_type  index) const

Get MArgument of type MSparseArray at position index and wrap it into SparseArray.

Template Parameters
T- type of data stored in SparseArray
Parameters
[in]index- position of desired MArgument in Args
Returns
SparseArray wrapper of MArgument at position index
Exceptions
ErrorName::MArgumentIndexError- if index is out-of-bounds

◆ getString()

std::string LLU::MArgumentManager::getString ( size_type  index) const

Get value of MArgument of type "UTF8String" at position index.

Parameters
[in]index- position of desired MArgument in Args
Returns
std::string which is created from MArgument at position index
Exceptions
LLErrorCode::MArgumentIndexError- if index is out-of-bounds

◆ getTensor()

template<typename T , Passing Mode = Passing::Automatic>
Tensor<T> LLU::MArgumentManager::getTensor ( size_type  index) const

Get MArgument of type MTensor at position index and wrap it into Tensor object.

Template Parameters
T- type of data stored in Tensor
Parameters
[in]index- position of desired MArgument in Args
Returns
Tensor wrapper of MArgument at position index
Exceptions
ErrorName::MArgumentIndexError- if index is out-of-bounds
See also
Tensor<T>::Tensor(const MTensor);

◆ getTensorType()

unsigned char LLU::MArgumentManager::getTensorType ( size_type  index) const

Get type of MTensor at position index in Args.

Parameters
[in]index- position of desired MArgument in Args
Returns
MTensor type
Exceptions
ErrorName::MArgumentIndexError- if index is out-of-bounds

◆ getTuple() [1/2]

template<typename... ArgTypes>
std::tuple<RequestedType<ArgTypes>...> LLU::MArgumentManager::getTuple ( size_type  index = 0) const
inline

Extract arguments from the Manager and return them as values of given types.

Template Parameters
ArgTypes- types that determine how each extracted argument will be returned
Returns
a tuple of function arguments

◆ getTuple() [2/2]

template<typename... ArgTypes>
std::tuple<RequestedType<ArgTypes>...> LLU::MArgumentManager::getTuple ( std::array< size_type, sizeof...(ArgTypes)>  indices) const
inline

Extract arguments from the Manager at given positions and return them as values of given types.

Template Parameters
ArgTypes- types that determine how each extracted argument will be returned
Parameters
indices- position of desired arguments, need not be sorted, may contain repeated values
Returns
a tuple of function arguments

◆ operateOnImage() [1/2]

template<Passing Mode, class Operator , class... Args>
void LLU::MArgumentManager::operateOnImage ( size_type  index,
Args &&...  opArgs 
)

Perform operation on Image created from MImage argument at position index in Args.

Template Parameters
Mode- passing mode of the Image that will be processed
Operator- any callable class
OpArgs...- types of arguments of operator() in class Operator
Parameters
[in]index- position of MImage in Args
[in]opArgs- arguments of Operator::operator()
Exceptions
ErrorName::MArgumentIndexError- if index is out-of-bounds
ErrorName::MArgumentImageError- if MImage argument has incorrect type
Warning
Operator::operator() has to be a template that takes a const Image<T>& as first argument

◆ operateOnImage() [2/2]

template<Passing Mode = Passing::Automatic, class Operator >
void LLU::MArgumentManager::operateOnImage ( size_type  index,
Operator &&  op 
)

Perform operation on Image created from MImage argument at position index in Args.

Template Parameters
Mode- passing mode of the Image that will be processed
Operator- any callable class
Parameters
[in]index- position of MImage in Args
[in]op- callable object (possibly lambda) that takes only one argument - an Image
Exceptions
ErrorName::MArgumentIndexError- if index is out-of-bounds
ErrorName::MArgumentImageError- if MImage argument has incorrect type

◆ operateOnNumericArray() [1/2]

template<Passing Mode, class Operator , class... OpArgs>
void LLU::MArgumentManager::operateOnNumericArray ( size_type  index,
OpArgs &&...  opArgs 
)

Perform operation on NumericArray created from MNumericArray argument at position index in Args.

Template Parameters
Mode- passing mode of the NumericArray that will be processed
Operator- any callable class
OpArgs...- types of arguments of operator() in class Operator
Parameters
[in]index- position of MNumericArray in Args
[in]opArgs- arguments of Operator::operator()
Exceptions
ErrorName::MArgumentIndexError- if index is out-of-bounds
Warning
Operator::operator() has to be a template that takes a const NumericArray<T>& as first argument

◆ operateOnNumericArray() [2/2]

template<Passing Mode = Passing::Automatic, class Operator >
void LLU::MArgumentManager::operateOnNumericArray ( size_type  index,
Operator &&  op 
)

Perform operation on NumericArray created from MNumericArray argument at position index in Args.

Template Parameters
Mode- passing mode of the NumericArray that will be processed
Operator- any callable class
Parameters
[in]index- position of MNumericArray in Args
[in]op- callable object (possibly lambda) that takes only one argument - a NumericArray
Exceptions
ErrorName::MArgumentIndexError- if index is out-of-bounds

◆ operateOnTensor() [1/2]

template<Passing Mode, class Operator , class... Args>
void LLU::MArgumentManager::operateOnTensor ( size_type  index,
Args &&...  opArgs 
)

Perform operation on Tensor created from MTensor argument at position index in Args.

Template Parameters
Mode- passing mode of the Tensor that will be processed
Operator- any callable class
OpArgs...- types of arguments of operator() in class Operator
Parameters
[in]index- position of MTensor in Args
[in]opArgs- arguments of Operator::operator()
Exceptions
ErrorName::MArgumentIndexError- if index is out-of-bounds
ErrorName::MArgumentTensorError- if MTensor argument has incorrect type
Warning
Operator::operator() has to be a template that takes a const Tensor<T>& as first argument

◆ operateOnTensor() [2/2]

template<Passing Mode = Passing::Automatic, class Operator >
void LLU::MArgumentManager::operateOnTensor ( size_type  index,
Operator &&  op 
)

Perform operation on Tensor created from MTensor argument at position index in Args.

Template Parameters
Mode- passing mode of the Tensor that will be processed
Operator- any callable class
Parameters
[in]index- position of MTensor in Args
[in]op- callable object (possibly lambda) that takes only one argument - a Tensor
Exceptions
ErrorName::MArgumentIndexError- if index is out-of-bounds
ErrorName::MArgumentTensorError- if MTensor argument has incorrect type

◆ set() [1/18]

void LLU::MArgumentManager::set ( bool  result)
inlinenoexcept

Set result as output MArgument.

Parameters
[in]result- boolean value to be returned to LibraryLink

◆ set() [2/18]

void LLU::MArgumentManager::set ( const char *  str)
inline

Set str as output MArgument.

Parameters
[in]str- reference to std::string to be returned to LibraryLink

◆ set() [3/18]

template<typename T >
void LLU::MArgumentManager::set ( const DataList< T > &  ds)
inline

Set DataStore wrapped in DataList ds as output MArgument.

Template Parameters
T- type of data stored in each node of DataStore
Parameters
[in]ds- const reference to DataList which should pass its internal DataStore to LibraryLink

◆ set() [4/18]

void LLU::MArgumentManager::set ( const GenericDataList ds)
inline

Set DataStore wrapped by ds as output MArgument.

Parameters
[in]ds- reference to generic DataStore which should pass its internal DataStore to LibraryLink

◆ set() [5/18]

void LLU::MArgumentManager::set ( const GenericImage im)
inline

Set MImage wrapped by im as output MArgument.

Parameters
[in]im- reference to generic Image which should pass its internal MImage to LibraryLink

◆ set() [6/18]

void LLU::MArgumentManager::set ( const GenericNumericArray na)
inline

Set MNumericArray wrapped by na as output MArgument.

Parameters
[in]na- reference to generic NumericArray which should pass its internal MNumericArray to LibraryLink

◆ set() [7/18]

void LLU::MArgumentManager::set ( const GenericSparseArray t)
inline

Set MSparseArray wrapped by t as output MArgument.

Parameters
[in]t- reference to generic SparseArray which should pass its internal MSparseArray to LibraryLink

◆ set() [8/18]

void LLU::MArgumentManager::set ( const GenericTensor t)
inline

Set MTensor wrapped by t as output MArgument.

Parameters
[in]t- reference to generic Tensor which should pass its internal MTensor to LibraryLink

◆ set() [9/18]

template<typename T >
void LLU::MArgumentManager::set ( const Image< T > &  im)
inline

Set MImage wrapped by im as output MArgument.

Template Parameters
T- Image data type
Parameters
[in]im- reference to Image which should pass its internal MImage to LibraryLink

◆ set() [10/18]

template<typename T >
void LLU::MArgumentManager::set ( const NumericArray< T > &  na)
inline

Set MNumericArray wrapped by na as output MArgument.

Template Parameters
T- NumericArray data type
Parameters
[in]na- reference to NumericArray which should pass its internal MNumericArray to LibraryLink

◆ set() [11/18]

template<typename T >
void LLU::MArgumentManager::set ( const SparseArray< T > &  ten)
inline

Set MSparseArray wrapped by sa as output MArgument.

Template Parameters
T- SparseArray data type
Parameters
[in]sa- reference to SparseArray which should pass its internal MSparseArray to LibraryLink

◆ set() [12/18]

void LLU::MArgumentManager::set ( const std::string &  str)
inline

Set str as output MArgument.

Parameters
[in]str- reference to std::string to be returned to LibraryLink

◆ set() [13/18]

template<typename T >
void LLU::MArgumentManager::set ( const T &  arg)
inline

Set given value as a result of the library function.

Template Parameters
T- any type, for types not supported by default developers are encouraged to specialize this function template

◆ set() [14/18]

template<typename T >
void LLU::MArgumentManager::set ( const Tensor< T > &  ten)
inline

Set MTensor wrapped by ten as output MArgument.

Template Parameters
T- Tensor data type
Parameters
[in]ten- reference to Tensor which should pass its internal MTensor to LibraryLink

◆ set() [15/18]

void LLU::MArgumentManager::set ( double  result)
inlinenoexcept

Set result as output MArgument.

Parameters
[in]result- value of type double to be returned to LibraryLink

◆ set() [16/18]

void LLU::MArgumentManager::set ( mint  result)
inlinenoexcept

Set result as output MArgument.

Parameters
[in]result- value of type mint to be returned to LibraryLink
Warning
result will be implicitly casted to mint with no overflow check

◆ set() [17/18]

void LLU::MArgumentManager::set ( std::complex< double >  c)
inlinenoexcept

Set c as output MArgument.

Parameters
[in]c- value of type std::complex<double> to be returned to LibraryLink

◆ set() [18/18]

void LLU::MArgumentManager::set ( std::string &&  str)
inline

Set str as output MArgument.

Parameters
[in]str- reference to std::string to be returned to LibraryLink

◆ setBoolean()

void LLU::MArgumentManager::setBoolean ( bool  result)
noexcept

Set result as output MArgument.

Parameters
[in]result- boolean value to be returned to LibraryLink

◆ setComplex()

void LLU::MArgumentManager::setComplex ( std::complex< double >  c)
noexcept

Set c as output MArgument.

Parameters
[in]c- value of type std::complex<double> to be returned to LibraryLink

◆ setDataList()

template<typename T >
void LLU::MArgumentManager::setDataList ( const DataList< T > &  ds)

Set DataStore wrapped in DataList ds as output MArgument.

Template Parameters
T- type of data stored in each node of DataStore
Parameters
[in]ds- const reference to DataList which should pass its internal DataStore to LibraryLink

◆ setDataStore()

void LLU::MArgumentManager::setDataStore ( DataStore  ds)

Set DataStore as output MArgument.

Parameters
[in]ds- DataStore to be passed to LibraryLink

◆ setImage()

template<typename T >
void LLU::MArgumentManager::setImage ( const Image< T > &  im)

Set MImage wrapped by im as output MArgument.

Template Parameters
T- Image data type
Parameters
[in]im- reference to Image which should pass its internal MImage to LibraryLink

◆ setInteger()

void LLU::MArgumentManager::setInteger ( mint  result)
noexcept

Set result as output MArgument.

Parameters
[in]result- value of type mint to be returned to LibraryLink
Warning
result will be implicitly casted to mint with no overflow check

◆ setMImage()

void LLU::MArgumentManager::setMImage ( MImage  im)

Set MImage as output MArgument.

Parameters
[in]im- MImage to be passed to LibraryLink

◆ setMintAndCheck()

template<typename T >
bool LLU::MArgumentManager::setMintAndCheck ( result)
noexcept

Set result as output MArgument and check for overflow.

Template Parameters
T- integral type to be casted to mint
Parameters
[in]result- value to be returned to LibraryLink
Returns
true iff overflow occurred and the value had to be clipped

◆ setMNumericArray()

void LLU::MArgumentManager::setMNumericArray ( MNumericArray  na)

Set MNumericArray as output MArgument.

Parameters
[in]na- MNumericArray to be passed to LibraryLink

◆ setMSparseArray()

void LLU::MArgumentManager::setMSparseArray ( MSparseArray  sa)

Set MSparseArray as output MArgument.

Parameters
[in]sa- MSparseArray to be passed to LibraryLink

◆ setMTensor()

void LLU::MArgumentManager::setMTensor ( MTensor  t)

Set MTensor as output MArgument.

Parameters
[in]t- MTensor to be passed to LibraryLink

◆ setNumericArray()

template<typename T >
void LLU::MArgumentManager::setNumericArray ( const NumericArray< T > &  na)

Set MNumericArray wrapped by na as output MArgument.

Template Parameters
T- NumericArray data type
Parameters
[in]na- reference to NumericArray which should pass its internal MNumericArray to LibraryLink

◆ setReal()

void LLU::MArgumentManager::setReal ( double  result)
noexcept

Set result as output MArgument.

Parameters
[in]result- value of type double to be returned to LibraryLink

◆ setSparseArray()

template<typename T >
void LLU::MArgumentManager::setSparseArray ( const SparseArray< T > &  sa)

Set MSparseArray wrapped by sa as output MArgument.

Template Parameters
T- SparseArray data type
Parameters
[in]sa- reference to SparseArray which should pass its internal MSparseArray to LibraryLink

◆ setString() [1/3]

void LLU::MArgumentManager::setString ( const char *  str)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ setString() [2/3]

void LLU::MArgumentManager::setString ( const std::string &  str)

Set str as output MArgument.

Parameters
[in]str- reference to std::string to be returned to LibraryLink

◆ setString() [3/3]

void LLU::MArgumentManager::setString ( std::string &&  str)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ setTensor()

template<typename T >
void LLU::MArgumentManager::setTensor ( const Tensor< T > &  ten)

Set MTensor wrapped by ten as output MArgument.

Template Parameters
T- Tensor data type
Parameters
[in]ten- reference to Tensor which should pass its internal MTensor to LibraryLink