LibraryLink Utilities  3.0.1
Modern C++ wrapper over LibraryLink and WSTP
MArgument.h File Reference

Template class and utilities to work with MArgument in type-safe manner. More...

Detailed Description

Template class and utilities to work with MArgument in type-safe manner.

Author
Rafal Chojna rafal.nosp@m.c@wo.nosp@m.lfram.nosp@m..com
Date
September 01, 2018
#include <string>
#include <variant>
#include "LLU/LibraryData.h"
#include "LLU/Utilities.hpp"
+ Include dependency graph for MArgument.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  LLU::PrimitiveWrapper< T >
 Small class that wraps a reference to MArgument and provides proper API to work with this MArgument. More...
 

Namespaces

 LLU
 Main namespace of LibraryLink Utilities.
 
 LLU::Argument
 Namespace for functionality related to arguments passed from LibraryLink to library functions and their types.
 

Type aliases

using LLU::Argument::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 LLU::Argument::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...
 

Enumerations

enum  LLU::MArgumentType {
  MArgument = MType_Undef,
  Boolean = MType_Boolean,
  Integer = MType_Integer,
  Real = MType_Real,
  Complex = MType_Complex,
  Tensor = MType_Tensor,
  SparseArray = MType_SparseArray,
  NumericArray = MType_NumericArray,
  Image = MType_Image,
  UTF8String = MType_UTF8String,
  DataStore = MType_DataStore
}
 Strongly type enum with possible types of data stored in MArgument. More...
 

Variables

template<typename T >
constexpr MArgumentType LLU::Argument::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 LLU::Argument::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 LLU::Argument::ContainerTypeQ
 Helper template variable that says if an MArgumentType is a LibraryLink container type. More...
 
template<MArgumentType T>
constexpr bool LLU::alwaysFalse = false
 Helper template variable that is always false. More...