LibraryLink Utilities  3.0.1
Modern C++ wrapper over LibraryLink and WSTP
LLU Namespace Reference

Main namespace of LibraryLink Utilities. More...

Detailed Description

Main namespace of LibraryLink Utilities.

Every symbol defined in LLU will be in this namespace, but one needs to remember that LLU internally includes WolframLibrary and WSTP headers which define C APIs and therefore do not use namespaces and in consequence will inject names in the global namespace.

Namespaces

 Argument
 Namespace for functionality related to arguments passed from LibraryLink to library functions and their types.
 
 ErrorCode
 Error codes predefined in Library Link.
 
 ErrorName
 Names of all errors used across LLU.
 
 NA
 Small namespace for NumericArray related utilities.
 
 WS
 Contains definitions related to WSTP functionality in LLU.
 

Classes

struct  AlwaysReadExclusiveWrite
 Default policy for Import/Export paclets - always allow reading, deny writing when we write. More...
 
class  DataList
 Top-level wrapper over LibraryLink's DataStore. More...
 
class  DataNode
 Wrapper over DataStoreNode structure from LibraryLink. More...
 
class  DataStoreIterator
 Proxy input iterator over DataStoreNodes, when dereferenced yields GenericDataNode proxy objects. More...
 
struct  dependent_false
 Get a type that inherits from false_type and ignores the template parameter completely. More...
 
class  ErrorManager
 "Static" class responsible for error registration and throwing More...
 
struct  GenericDataNode
 Basic wrapper over DataStoreNode, provides class-like interface and conversion of the underlying value from MArgument to TypedArgument. More...
 
class  Image
 This is a class template, where template parameter T is the type of data elements. Image is derived from MArray. More...
 
struct  ImageInterface
 Abstract class that defines a basic set of operations on an image. More...
 
class  ImageView
 Simple, light-weight, non-owning wrappper over MImage. More...
 
class  IterableContainer
 Abstract class that provides iterators (c/r/begin and c/r/end methods) and subscript operator for any contiguous container. More...
 
struct  LibraryData
 This structure offers a static copy of WolframLibData accessible throughout the whole life of the DLL. More...
 
class  LibraryLinkError
 Class representing an exception in paclet code. More...
 
class  Logger
 Logger class is responsible for sending log messages via WSTP to Mathematica. More...
 
class  ManagedExpressionStore
 ManagedExpressionStore will keep track of instances of managed class T and will provide safe access to them. More...
 
class  MArgumentManager
 Manages arguments exchanged between the paclet C++ code and LibraryLink interface. More...
 
class  MArray
 This is a class template, where template parameter T is the type of data elements. MArray is the base class for NumericArray, Tensor and Image. More...
 
class  MArrayDimensions
 Helper class that carries meta-information about container's size and dimensions. More...
 
class  MContainer
 MContainer is an abstract class template for generic containers. Only specializations shall be used. More...
 
class  MContainer< MArgumentType::DataStore >
 MContainer specialization for DataStore, provides basic list interface for the underlying raw DataStore. More...
 
class  MContainer< MArgumentType::Image >
 MContainer specialization for MImage. More...
 
class  MContainer< MArgumentType::NumericArray >
 MContainer specialization for MNumericArray. More...
 
class  MContainer< MArgumentType::SparseArray >
 MContainer specialization for MSparseArray. More...
 
class  MContainer< MArgumentType::Tensor >
 MContainer specialization for MTensor. More...
 
class  MContainerBase
 Template of the base class for all generic containers. More...
 
struct  NameAdaptor
 Iterator adaptor for DataList that makes begin() and end() return proxy iterators for node names. More...
 
struct  NodeIterator
 Simple proxy input iterator that goes over a DataStore and returns proxy DataNodes when dereferenced. More...
 
struct  NodeNameIterator
 Simple proxy input iterator that goes over a DataStore and returns node names when dereferenced. More...
 
struct  NodeValueIterator
 Simple proxy input iterator that goes over a DataStore and returns node values of requested type when dereferenced. More...
 
class  NumericArray
 This is a class template, where template parameter T is the type of data elements. NumericArray is derived from MArray. More...
 
struct  NumericArrayFromEnum
 Utility structure that matches an MNumericArray data type with corresponding C++ type. More...
 
struct  NumericArrayInterface
 Abstract class that defines a basic set of operations on a numeric array. More...
 
class  NumericArrayTypedView
 Simple, light-weight, non-owning wrappper over MNumericArray. More...
 
class  NumericArrayView
 Simple, light-weight, non-owning, data-type-agnostic wrappper over MNumericArray. More...
 
class  PrimitiveWrapper
 Small class that wraps a reference to MArgument and provides proper API to work with this MArgument. More...
 
class  ProgressMonitor
 Stores and updates current progress of computation in a location shared between the library and WL Kernel. More...
 
struct  SharePolicy
 Base class for shared access policies on Windows. More...
 
class  SparseArray
 Strongly typed wrapper for MSparseArray. More...
 
class  Tensor
 This is a class template, where template parameter T is the type of data elements. Tensor is derived from MArray. More...
 
struct  TensorInterface
 Abstract class that defines a basic set of operations on a tensor. More...
 
class  TensorView
 Simple, light-weight, non-owning wrappper over MTensor. More...
 
class  TypedImage
 Typed interface for Image. More...
 
class  TypedNumericArray
 Typed interface for NumericArray. More...
 
class  TypedTensor
 Typed interface for Tensor. More...
 
struct  ValueAdaptor
 Iterator adaptor for DataList that makes begin() and end() return proxy iterators for node values. More...
 
class  WSStream
 Wrapper class over WSTP with a stream-like interface. More...
 

Type aliases

using BasicPool = Async::BasicThreadPool< Async::ThreadsafeQueue< Async::FunctionWrapper > >
 Alias for BasicThreadPool with ThreadsafeQueue storing Async::FunctionWrappers. More...
 
using ThreadPool = Async::GenericThreadPool< Async::ThreadsafeQueue< Async::FunctionWrapper >, Async::WorkStealingQueue< std::deque< Async::FunctionWrapper > >>
 Alias for GenericThreadPool with ThreadsafeQueue and WorkStealingQueue storing Async::FunctionWrappers. More...
 
using GenericDataList = MContainer< MArgumentType::DataStore >
 MContainer specialization for DataStore is called GenericDataList. More...
 
using GenericImage = MContainer< MArgumentType::Image >
 MContainer specialization for MImage is called GenericImage. More...
 
using GenericNumericArray = MContainer< MArgumentType::NumericArray >
 MContainer specialization for MNumericArray is called GenericNumericArray. More...
 
using GenericSparseArray = MContainer< MArgumentType::SparseArray >
 MContainer specialization for MSparseArray is called GenericSparseArray. More...
 
using GenericTensor = MContainer< MArgumentType::Tensor >
 MContainer specialization for MTensor is called GenericTensor. More...
 
using FilePtr = std::unique_ptr< std::FILE, int(*)(std::FILE *)>
 Smart pointer type around std::FILE. More...
 
template<typename T >
using remove_cv_ref = std::remove_cv_t< std::remove_reference_t< T > >
 Utility type that strips any given type from reference and cv qualifiers. More...
 
template<typename A , typename B >
using disable_if_same_or_derived = typename std::enable_if_t<!std::is_same< A, B >::value &&!std::is_base_of< A, remove_cv_ref< B > >::value >
 Utility type that is valid only if B is not A and not a subclass of A. More...
 
template<typename A , typename B >
using enable_if_same_or_derived = typename std::enable_if_t< std::is_same< A, B >::value||std::is_base_of< A, remove_cv_ref< B > >::value >
 Utility type that is valid only if B is A or a subclass of A. More...
 
template<typename Iterator >
using enable_if_input_iterator = enable_if_same_or_derived< std::input_iterator_tag, typename std::iterator_traits< Iterator >::iterator_category >
 Utility type that checks if given type can be treated as input iterator. More...
 
template<typename Container >
using enable_if_integral_elements = typename std::enable_if_t< std::is_integral< typename std::remove_reference_t< Container >::value_type >::value >
 Utility type that checks if given container type has elements that are integers (and therefore can be used as Tensor or NumericArray dimensions) More...
 
template<numericarray_data_t rat>
using NumericArrayTypeFromEnum = typename NumericArrayFromEnum< rat >::type
 Simple type alias to easily extract type from NumericArrayFromEnum. More...
 

Enumerations

enum  Ownership : uint8_t {
  Ownership::LibraryLink,
  Ownership::Library,
  Ownership::Shared
}
 An enum listing possible owners of a LibraryLink container. More...
 
enum  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...
 
enum  Passing {
  Automatic,
  Constant,
  Manual,
  Shared
}
 Enumerated type representing different modes in which a container can be passed from LibraryLink to the library. More...
 

Functions

template<typename T >
std::ostream & operator<< (std::ostream &os, const MArray< T > &c)
 Insertion operator to allow pretty-printing of MArray. More...
 
template<typename F >
auto asTypedSparseArray (const GenericSparseArray &sa, F &&callable)
 Take a SparseArray-like object t and a function callable and call the function with a SparseArrayTypedView created from t. More...
 
template<typename ImageT , typename F >
auto asTypedImage (ImageT &&img, F &&callable)
 Take a Image-like object img and a function callable and call the function with a ImageTypedView created from img. More...
 
template<typename NumericArrayT , typename F >
auto asTypedNumericArray (NumericArrayT &&na, F &&callable)
 Take a NumericArray-like object na and a function callable and call the function with a NumericArrayTypedView created from na. More...
 
template<typename TensorT , typename F >
auto asTypedTensor (TensorT &&t, F &&callable)
 Take a Tensor-like object t and a function callable and call the function with a TensorTypedView created from t. More...
 
FilePtr claimFile (std::FILE *f)
 Create a unique owning pointer of a FILE. More...
 
void validatePath (const std::string &fileName, std::ios::openmode mode)
 Check if the file fileName under open mode mode is accessible in the current sandbox setting. More...
 
template<typename T >
std::basic_string< T > fromUTF8toUTF16 (const std::string &source)
 Convert string from UTF8 to UTF16. More...
 
template<typename T >
std::string fromUTF16toUTF8 (const std::basic_string< T > &source)
 Convert string from UTF16 to UTF8. More...
 
template<typename T >
std::basic_string< T > fromUTF8toUTF32 (const std::string &source)
 Convert string from UTF8 to UTF32. More...
 
template<typename T >
std::string fromUTF32toUTF8 (const std::basic_string< T > &source)
 Convert string from UTF32 to UTF8. More...
 
FilePtr openFile (const std::string &fileName, std::ios::openmode mode, const SharePolicy &shp=AlwaysReadExclusiveWrite {})
 Open given file with specified mode (read, write, append, etc.). More...
 
std::fstream openFileStream (const std::string &fileName, std::ios::openmode mode, const SharePolicy &shp=AlwaysReadExclusiveWrite {})
 Open a file stream with specified mode (read, write, append, etc.). More...
 
template<class T >
void manageInstanceCallback (WolframLibraryData, mbool, mint)
 A template for library callback used by LibraryLink to manage instances of ManagedLibraryExpressions. More...
 
template<typename VariantType , typename T , std::size_t index = 0>
constexpr std::size_t variant_index ()
 Get index of given type in the variant. More...
 
template<typename... Ts>
void Unused (Ts &&...)
 Dummy function called on otherwise unused parameters to eliminate compiler warnings. More...
 
EXTERN_C DLLEXPORT int sendRegisteredErrors ([[maybe_unused]] WolframLibraryData libData, WSLINK mlp)
 LibraryLink function that LLU will call to send all errors registered in C++ to the Wolfram Language layer. More...
 
 LIBRARY_LINK_FUNCTION (setExceptionDetailsContext)
 LibraryLink function that LLU will call to set the context for the symbol, to which exception details are assigned. More...
 
 LIBRARY_LINK_FUNCTION (setLoggerContext)
 LibraryLink function that LLU will call to set the context for the symbol, to which log details are assigned. More...
 

Variables

template<MArgumentType T>
constexpr bool alwaysFalse = false
 Helper template variable that is always false. More...
 
template<typename Container >
constexpr bool has_size_v = has_size<Container>::value
 A type trait to check whether type Container has a member function size() More...
 
template<typename Container , typename T >
constexpr bool is_iterable_container_with_matching_type_v
 A type trait to check whether type Container is a class type with a member type alias value_type equal to T and with begin() and end() methods. More...
 
template<typename T >
constexpr bool dependent_false_v = dependent_false<T>::value
 Compile-time boolean constant false that "depends" on a template parameter. More...
 
template<typename T >
constexpr imagedata_t ImageType = MImage_Type_Undef
 Utility variable template that matches a C++ type with a corresponding MImage data type. More...
 
template<typename T >
constexpr numericarray_data_t NumericArrayType = MNumericArray_Type_Undef
 Utility structure that matches a C++ type with a corresponding MNumericArray data type. More...
 
template<typename T >
constexpr mint TensorType = MType_Undef
 Utility structure that matches a C++ type with a corresponding MTensor data type. More...
 

Type aliases documentation

◆ BasicPool

Alias for BasicThreadPool with ThreadsafeQueue storing Async::FunctionWrappers.

Good default choice for a thread pool for any paclet.

◆ disable_if_same_or_derived

template<typename A , typename B >
using LLU::disable_if_same_or_derived = typedef typename std::enable_if_t<!std::is_same<A, B>::value && !std::is_base_of<A, remove_cv_ref<B> >::value>

Utility type that is valid only if B is not A and not a subclass of A.

Template Parameters
A- any type
B- any type, will be stripped of reference and cv-qualifiers before comparing with A

◆ enable_if_input_iterator

template<typename Iterator >
using LLU::enable_if_input_iterator = typedef enable_if_same_or_derived<std::input_iterator_tag, typename std::iterator_traits<Iterator>::iterator_category>

Utility type that checks if given type can be treated as input iterator.

Template Parameters
Iterator- iterator type

◆ enable_if_integral_elements

template<typename Container >
using LLU::enable_if_integral_elements = typedef typename std::enable_if_t<std::is_integral<typename std::remove_reference_t<Container>::value_type>::value>

Utility type that checks if given container type has elements that are integers (and therefore can be used as Tensor or NumericArray dimensions)

Template Parameters
Container- container type

◆ enable_if_same_or_derived

template<typename A , typename B >
using LLU::enable_if_same_or_derived = typedef typename std::enable_if_t<std::is_same<A, B>::value || std::is_base_of<A, remove_cv_ref<B> >::value>

Utility type that is valid only if B is A or a subclass of A.

Template Parameters
A- any type
B- any type, will be stripped of reference and cv-qualifiers before comparing with A

◆ FilePtr

using LLU::FilePtr = typedef std::unique_ptr<std::FILE, int (*)(std::FILE*)>

Smart pointer type around std::FILE.

◆ GenericDataList

using LLU::GenericDataList = typedef MContainer<MArgumentType::DataStore>

MContainer specialization for DataStore is called GenericDataList.

◆ GenericImage

using LLU::GenericImage = typedef MContainer<MArgumentType::Image>

MContainer specialization for MImage is called GenericImage.

◆ GenericNumericArray

using LLU::GenericNumericArray = typedef MContainer<MArgumentType::NumericArray>

MContainer specialization for MNumericArray is called GenericNumericArray.

◆ GenericSparseArray

using LLU::GenericSparseArray = typedef MContainer<MArgumentType::SparseArray>

MContainer specialization for MSparseArray is called GenericSparseArray.

◆ GenericTensor

using LLU::GenericTensor = typedef MContainer<MArgumentType::Tensor>

MContainer specialization for MTensor is called GenericTensor.

◆ NumericArrayTypeFromEnum

template<numericarray_data_t rat>
using LLU::NumericArrayTypeFromEnum = typedef typename NumericArrayFromEnum<rat>::type

Simple type alias to easily extract type from NumericArrayFromEnum.

◆ remove_cv_ref

template<typename T >
using LLU::remove_cv_ref = typedef std::remove_cv_t<std::remove_reference_t<T> >

Utility type that strips any given type from reference and cv qualifiers.

Template Parameters
T- any type

◆ ThreadPool

Alias for GenericThreadPool with ThreadsafeQueue and WorkStealingQueue storing Async::FunctionWrappers.

Good choice for a thread pool if the tasks that will be executed involve submitting new tasks for the pool.

Enumeration Type Documentation

◆ MArgumentType

enum LLU::MArgumentType
strong

Strongly type enum with possible types of data stored in MArgument.

◆ Ownership

enum LLU::Ownership : uint8_t
strong

An enum listing possible owners of a LibraryLink container.

Ownership determines the memory management of a container.

Enumerator
LibraryLink 

LibraryLink is responsible for managing the container's memory. Corresponds to Automatic and "Constant" passing.

Library 

The library (LLU) is responsible for managing the container's memory. Used for Manual passing and containers created by the library.

Shared 

When the container is shared LLU only needs to decrease share count when it's done. Only used for arguments passed as "Shared".

◆ Passing

enum LLU::Passing
strong

Enumerated type representing different modes in which a container can be passed from LibraryLink to the library.

See also
https://reference.wolfram.com/language/LibraryLink/tutorial/InteractionWithWolframLanguage.html#97446640

Function Documentation

◆ asTypedImage()

template<typename ImageT , typename F >
auto LLU::asTypedImage ( ImageT &&  img,
F &&  callable 
)

Take a Image-like object img and a function callable and call the function with a ImageTypedView created from img.

Template Parameters
ImageT- a Image-like type (GenericImage, ImageView or MNumericAray)
F- any callable object
Parameters
img- Image-like object on which an operation will be performed
callable- a callable object that can be called with a ImageTypedView of any type
Returns
result of calling callable on a ImageTypedView over img

◆ asTypedNumericArray()

template<typename NumericArrayT , typename F >
auto LLU::asTypedNumericArray ( NumericArrayT &&  na,
F &&  callable 
)

Take a NumericArray-like object na and a function callable and call the function with a NumericArrayTypedView created from na.

Template Parameters
NumericArrayT- a NumericArray-like type (GenericNumericArray, NumericArrayView or MNumericAray)
F- any callable object
Parameters
na- NumericArray-like object on which an operation will be performed
callable- a callable object that can be called with a NumericArrayTypedView of any type
Returns
result of calling callable on a NumericArrayTypedView over na

◆ asTypedSparseArray()

template<typename F >
auto LLU::asTypedSparseArray ( const GenericSparseArray sa,
F &&  callable 
)

Take a SparseArray-like object t and a function callable and call the function with a SparseArrayTypedView created from t.

Template Parameters
SparseArrayT- a SparseArray-like type (GenericSparseArray, SparseArrayView or MNumericArray)
F- any callable object
Parameters
t- SparseArray-like object on which an operation will be performed
callable- a callable object that can be called with a SparseArrayTypedView of any type
Returns
result of calling callable on a SparseArrayTypedView over t

◆ asTypedTensor()

template<typename TensorT , typename F >
auto LLU::asTypedTensor ( TensorT &&  t,
F &&  callable 
)

Take a Tensor-like object t and a function callable and call the function with a TensorTypedView created from t.

Template Parameters
TensorT- a Tensor-like type (GenericTensor, TensorView or MNumericAray)
F- any callable object
Parameters
t- Tensor-like object on which an operation will be performed
callable- a callable object that can be called with a TensorTypedView of any type
Returns
result of calling callable on a TensorTypedView over t

◆ claimFile()

FilePtr LLU::claimFile ( std::FILE *  f)

Create a unique owning pointer of a FILE.

Parameters
f- a stream pointer obtained from fopen
Returns
a smart pointer owning f that will call fclose on f in destructor
Warning
if f is not a result of fopen, the behavior is undefined

◆ fromUTF16toUTF8()

template<typename T >
std::string LLU::fromUTF16toUTF8 ( const std::basic_string< T > &  source)

Convert string from UTF16 to UTF8.

Template Parameters
T- character type of the UTF16 string, supported types are char16_t, char32_t, or wchar_t
Parameters
source- string in UTF16 encoding
Returns
copy of the input string converted to UTF8
Note
char16_t and char32_t strings on Windows will be converted to std::wstring before encoding conversion due to a bug in VS2017

◆ fromUTF32toUTF8()

template<typename T >
std::string LLU::fromUTF32toUTF8 ( const std::basic_string< T > &  source)

Convert string from UTF32 to UTF8.

Template Parameters
T- character type of the UTF32 string
Parameters
source- string in UTF32 encoding
Returns
copy of the input string converted to UTF8

◆ fromUTF8toUTF16()

template<typename T >
std::basic_string<T> LLU::fromUTF8toUTF16 ( const std::string &  source)

Convert string from UTF8 to UTF16.

Template Parameters
T- character type for the result, supported types are char16_t, char32_t, or wchar_t
Parameters
source- string in UTF8 encoding
Returns
copy of the input string converted to UTF16
Note
char16_t and char32_t strings on Windows will be converted to a temporary std::wstring first due to a bug in VS2017

◆ fromUTF8toUTF32()

template<typename T >
std::basic_string<T> LLU::fromUTF8toUTF32 ( const std::string &  source)

Convert string from UTF8 to UTF32.

Template Parameters
T- character type for the result
Parameters
source- string in UTF8 encoding
Returns
copy of the input string converted to UTF32

◆ LIBRARY_LINK_FUNCTION() [1/2]

LLU::LIBRARY_LINK_FUNCTION ( setExceptionDetailsContext  )

LibraryLink function that LLU will call to set the context for the symbol, to which exception details are assigned.

This symbol is usually in the paclet's Private` context and it cannot be hardcoded in LLU.

◆ LIBRARY_LINK_FUNCTION() [2/2]

LLU::LIBRARY_LINK_FUNCTION ( setLoggerContext  )

LibraryLink function that LLU will call to set the context for the symbol, to which log details are assigned.

This symbol is usually in the paclet's Private` context and it cannot be hardcoded in LLU.

◆ manageInstanceCallback()

template<class T >
void LLU::manageInstanceCallback ( WolframLibraryData  ,
mbool  ,
mint   
)

A template for library callback used by LibraryLink to manage instances of ManagedLibraryExpressions.

Specializations should typically just call manageInstance method from the ManagedExpressionStore corresponding to class T.

Template Parameters
T- class to be managed
Note
This function must be explicitly specialized for any class that is supposed to be managed. Therefore instantiation of the general template will trigger compilation error.

◆ openFile()

FilePtr LLU::openFile ( const std::string &  fileName,
std::ios::openmode  mode,
const SharePolicy shp = AlwaysReadExclusiveWrite {} 
)

Open given file with specified mode (read, write, append, etc.).

Checks with WolframLibraryData if the path is "valid" (we don't know what that really means). Converts file name to UTF-16 wide string on Windows. Uses open modes from std::ios.

Parameters
fileName- path to the input file
mode- file open mode
shp- shared access policy, only used on Windows. See https://docs.microsoft.com/en-us/cpp/c-runtime-library/sharing-constants
Returns
Unique pointer to opened file
Exceptions
ErrorName::OpenFileFailedif the file could not be opened

◆ openFileStream()

std::fstream LLU::openFileStream ( const std::string &  fileName,
std::ios::openmode  mode,
const SharePolicy shp = AlwaysReadExclusiveWrite {} 
)

Open a file stream with specified mode (read, write, append, etc.).

Checks with WolframLibraryData if the path is "valid" (we don't know what that really means). Converts file name to UTF-16 wide string on Windows.

Parameters
fileName- path to the input file
mode- file open mode
shp- shared access policy, only used on Windows. See https://docs.microsoft.com/en-us/cpp/c-runtime-library/sharing-constants
Returns
Valid file stream
Exceptions
ErrorName::OpenFileFailedif the file could not be opened

◆ operator<<()

template<typename T >
std::ostream& LLU::operator<< ( std::ostream &  os,
const MArray< T > &  c 
)

Insertion operator to allow pretty-printing of MArray.

Template Parameters
T- type of elements in the container
Parameters
[out]os- output stream
[in]c- const& to the MArray we want to print

◆ sendRegisteredErrors()

EXTERN_C DLLEXPORT int LLU::sendRegisteredErrors ( [[maybe_unused] ] WolframLibraryData  libData,
WSLINK  mlp 
)

LibraryLink function that LLU will call to send all errors registered in C++ to the Wolfram Language layer.

This way LLU is able to translate exceptions from C++ to appropriate Failure expressions in the Wolfram Language.

Parameters
libData- WolframLibraryData
mlp- WSTP link to transfer data
Returns
error code

◆ Unused()

template<typename... Ts>
void LLU::Unused ( Ts &&  ...)

Dummy function called on otherwise unused parameters to eliminate compiler warnings.

Template Parameters
Ts- variadic template parameter, any number of arbitrary types

◆ validatePath()

void LLU::validatePath ( const std::string &  fileName,
std::ios::openmode  mode 
)

Check if the file fileName under open mode mode is accessible in the current sandbox setting.

Parameters
fileName- file whose path is to be validated
mode- file open mode

◆ variant_index()

template<typename VariantType , typename T , std::size_t index = 0>
constexpr std::size_t LLU::variant_index ( )
constexpr

Get index of given type in the variant.

Template Parameters
VariantType- any variant type
T- any type, if T is repeated in the variant, index of the first occurrence will be returned
index- implementation detail, do not specify explicitly
Returns
index of given type in the variant or out-of-bound value if the type is not a variant member
See also
https://stackoverflow.com/questions/52303316/get-index-by-type-in-stdvariant

Variable Documentation

◆ alwaysFalse

template<MArgumentType T>
constexpr bool LLU::alwaysFalse = false
inlineconstexpr

Helper template variable that is always false.

Useful in meta-programming.

◆ dependent_false_v

template<typename T >
constexpr bool LLU::dependent_false_v = dependent_false<T>::value
inlineconstexpr

Compile-time boolean constant false that "depends" on a template parameter.

Useful utility for static_assert.

◆ has_size_v

template<typename Container >
constexpr bool LLU::has_size_v = has_size<Container>::value
inlineconstexpr

A type trait to check whether type Container has a member function size()

◆ ImageType

template<typename T >
constexpr imagedata_t LLU::ImageType = MImage_Type_Undef
inlineconstexpr

Utility variable template that matches a C++ type with a corresponding MImage data type.

◆ is_iterable_container_with_matching_type_v

template<typename Container , typename T >
constexpr bool LLU::is_iterable_container_with_matching_type_v
inlineconstexpr
Initial value:
=
std::conjunction<std::is_class<Container>, has_value_type<Container>, is_iterable<Container>, has_matching_type<Container, T>>::value

A type trait to check whether type Container is a class type with a member type alias value_type equal to T and with begin() and end() methods.

◆ NumericArrayType

template<typename T >
constexpr numericarray_data_t LLU::NumericArrayType = MNumericArray_Type_Undef
inlineconstexpr

Utility structure that matches a C++ type with a corresponding MNumericArray data type.

◆ TensorType

template<typename T >
constexpr mint LLU::TensorType = MType_Undef
inlineconstexpr

Utility structure that matches a C++ type with a corresponding MTensor data type.