![]() |
LibraryLink Utilities
3.0.1
Modern C++ wrapper over LibraryLink and WSTP
|
Namespace for functionality related to arguments passed from LibraryLink to library functions and their types. More...
Namespace for functionality related to arguments passed from LibraryLink to library functions and their types.
Namespaces | |
| Typed | |
| Namespace defining C++ types corresponding to primitive LibraryLink argument types. | |
Type aliases | |
| using | PrimitiveAny = std::variant< std::monostate, mbool, mint, mreal, mcomplex, MTensor, MSparseArray, MNumericArray, MImage, char *, DataStore > |
| A variant holding all possible MArgument types. More... | |
| template<MArgumentType T> | |
| using | CType = std::conditional_t< T==MArgumentType::MArgument, MArgument, std::variant_alternative_t< static_cast< size_t >(T), PrimitiveAny > > |
| Type alias that binds given MArgumentType (enumerated value) to the corresponding type of MArgument. More... | |
| using | TypedArgument = std::variant< std::monostate, Typed::Boolean, Typed::Integer, Typed::Real, Typed::Complex, Typed::Tensor, Typed::SparseArray, Typed::NumericArray, Typed::Image, Typed::UTF8String, Typed::DataStore > |
| C++ wrapper over LibraryLink's MArgument, which is a plain union. More... | |
| template<MArgumentType T> | |
| using | WrapperType = std::conditional_t< T==MArgumentType::MArgument, TypedArgument, std::variant_alternative_t< static_cast< size_t >(T), TypedArgument > > |
| Get wrapper type corresponding to primitive LibraryLink argument type T. More... | |
Functions | |
| TypedArgument | fromMArgument (MArgument m, MArgumentType t) |
| Get a TypeArgument from plain MArgument and an enum describing the active union member. More... | |
| void | toMArgument (const TypedArgument &tma, MArgument &res) |
| Assign current value of given TypedArgument to given MArgument. More... | |
| template<MArgumentType T> | |
| WrapperType< T > | toWrapperType (const CType< T > &value) |
| Convert a value of one of the LibraryLink argument type to its wrapper. More... | |
| template<MArgumentType T> | |
| CType< T > | toPrimitiveType (const WrapperType< T > &value) |
| Convert value of one of the wrapper types (see LLU::Argument::Typed namespace) to the corresponding LibraryLink type. More... | |
Variables | |
| template<typename T > | |
| constexpr MArgumentType | PrimitiveIndex = static_cast<MArgumentType>(variant_index<PrimitiveAny, T>()) |
| PrimitiveIndex<T> is the index of type T in the PrimitiveAny variant converted to MArgumentType enum. More... | |
| template<typename T > | |
| constexpr bool | PrimitiveQ = (variant_index<PrimitiveAny, T>() < std::variant_size_v<PrimitiveAny>) |
Type trait for checking if T is a primitive LibraryLink type (belongs to the MArgument union) More... | |
| template<MArgumentType T> | |
| constexpr bool | ContainerTypeQ |
| Helper template variable that says if an MArgumentType is a LibraryLink container type. More... | |
| template<typename T > | |
| constexpr MArgumentType | WrapperIndex = static_cast<MArgumentType>(variant_index<TypedArgument, T>()) |
| Index of a wrapper type in the TypedArgument variant or std::variant_size_v<TypedArgument> otherwise. More... | |
| template<typename T > | |
| constexpr bool | WrapperQ = std::is_same_v<T, TypedArgument> || (variant_index<TypedArgument, T>() < std::variant_size_v<TypedArgument>) |
| Type trait to determine if given type is a "wrapper type" (i.e. More... | |
| using LLU::Argument::CType = typedef std::conditional_t<T == MArgumentType::MArgument, MArgument, std::variant_alternative_t<static_cast<size_t>(T), PrimitiveAny> > |
Type alias that binds given MArgumentType (enumerated value) to the corresponding type of MArgument.
| T | - any value of type MArgumentType |
| using LLU::Argument::PrimitiveAny = typedef std::variant<std::monostate, mbool, mint, mreal, mcomplex, MTensor, MSparseArray, MNumericArray, MImage, char*, DataStore> |
A variant holding all possible MArgument types.
| using LLU::Argument::TypedArgument = typedef std::variant<std::monostate, Typed::Boolean, Typed::Integer, Typed::Real, Typed::Complex, Typed::Tensor, Typed::SparseArray, Typed::NumericArray, Typed::Image, Typed::UTF8String, Typed::DataStore> |
C++ wrapper over LibraryLink's MArgument, which is a plain union.
| using LLU::Argument::WrapperType = typedef std::conditional_t<T == MArgumentType::MArgument, TypedArgument, std::variant_alternative_t<static_cast<size_t>(T), TypedArgument> > |
Get wrapper type corresponding to primitive LibraryLink argument type T.
| T | - an enumerated value of type MArgumentType |
| TypedArgument LLU::Argument::fromMArgument | ( | MArgument | m, |
| MArgumentType | t | ||
| ) |
Get a TypeArgument from plain MArgument and an enum describing the active union member.
| m | - MArgument |
| t | - index of the active member of the MArgument m |
| void LLU::Argument::toMArgument | ( | const TypedArgument & | tma, |
| MArgument & | res | ||
| ) |
Assign current value of given TypedArgument to given MArgument.
| [in] | tma | - a TypedArgument |
| [out] | res | - raw MArgument to be assigned to |
| CType<T> LLU::Argument::toPrimitiveType | ( | const WrapperType< T > & | value | ) |
Convert value of one of the wrapper types (see LLU::Argument::Typed namespace) to the corresponding LibraryLink type.
| T | - MArgument type index |
| value | - a value of the wrapper type corresponding to T |
| WrapperType<T> LLU::Argument::toWrapperType | ( | const CType< T > & | value | ) |
Convert a value of one of the LibraryLink argument type to its wrapper.
| T | - MArgument type index |
| value | - a value of the LibraryLink argument type corresponding to T (e.g. MArgumentType::Complex corresponds to mcomplex type) |
|
inlineconstexpr |
Helper template variable that says if an MArgumentType is a LibraryLink container type.
|
inlineconstexpr |
PrimitiveIndex<T> is the index of type T in the PrimitiveAny variant converted to MArgumentType enum.
|
inlineconstexpr |
Type trait for checking if T is a primitive LibraryLink type (belongs to the MArgument union)
|
inlineconstexpr |
Index of a wrapper type in the TypedArgument variant or std::variant_size_v<TypedArgument> otherwise.
| T | - any type |
|
inlineconstexpr |
Type trait to determine if given type is a "wrapper type" (i.e.
if it is a member of TypedArgument variant)
| T | - any type |