![]() |
LibraryLink Utilities
3.0.1
Modern C++ wrapper over LibraryLink and WSTP
|
Contains definitions related to WSTP functionality in LLU. More...
Contains definitions related to WSTP functionality in LLU.
Namespaces | |
| EncodingConfig | |
| Contains configuration parameters that paclet developers may modify. | |
Classes | |
| struct | Association |
| Special type of a Function which corresponds to the Association expression when exchanged with the Kernel via WSStream. More... | |
| struct | BeginExpr |
| struct | CharTypeStruct |
| struct | DropExpr |
| struct | EndExpr |
| struct | Function |
| Structure representing any function in Wolfram Language, i.e. a head plus number of arguments. More... | |
| struct | GetAs |
| Utility structure used to enforce receiving given value via WSStream with encoding E. More... | |
| struct | List |
| Special type of a Function which corresponds to the List expression when exchanged with the Kernel via WSStream. More... | |
| struct | Missing |
| Special type of a Function which corresponds to the Missing expression when exchanged with the Kernel via WSStream. More... | |
| struct | PutAs |
| Utility structure used to enforce sending given value with encoding E via WSStream. More... | |
| struct | StringTypeStruct |
| struct | Symbol |
| Structure representing any symbol in Wolfram Language. More... | |
Type aliases | |
| template<Encoding E> | |
| using | CharType = typename CharTypeStruct< E >::type |
| Specializations of CharTypeStruct, encoding E has assigned type T iff WSPutEString takes const T* as second parameter. More... | |
| template<Encoding E> | |
| using | StringType = typename StringTypeStruct< E >::type |
| template<typename T > | |
| using | ListData = std::unique_ptr< T[], ReleaseList< T > > |
ListData with of type T is a unique_ptr to an array of Ts with custom destructor. More... | |
| template<typename T > | |
| using | ArrayData = std::unique_ptr< T[], ReleaseArray< T > > |
ArrayData with of type T is a unique_ptr to an array of Ts with custom destructor. More... | |
| template<Encoding E> | |
| using | StringData = std::unique_ptr< const CharType< E >[], ReleaseString< E > > |
StringData with Encoding E is a unique_ptr to an array of E-encoded characters It allows you to take ownership of raw string data from WSTP without making extra copies. More... | |
| template<typename T > | |
| using | GetStringFuncT = std::function< int(WSLINK, const T **, int *, int *)> |
| GetStringFuncT is a type of WSTP function that reads string from a link, e.g. WSGetByteString. More... | |
| template<typename T > | |
| using | PutStringFuncT = std::function< int(WSLINK, const T *, int)> |
| PutStringFuncT is a type of WSTP function that sends string data to a link, e.g. WSPutByteString. More... | |
| template<typename T > | |
| using | ReleaseStringFuncT = std::function< void(WSLINK, const T *, int)> |
| ReleaseStringFuncT is a type of WSTP function to release string data allocated by WSTP, e.g. WSReleaseByteString. More... | |
Enumerations | |
| enum | Encoding : std::uint8_t { Encoding::Undefined, Encoding::Native, Encoding::Byte, Encoding::UTF8, Encoding::UTF16, Encoding::UCS2, Encoding::UTF32 } |
| enum | Direction : bool { Get, Put } |
| Helper enum for tokens that can be sent via WSTP in both directions, e.g. WS::Null. More... | |
Functions | |
| constexpr const char * | getEncodingName (Encoding e) |
| Get the name of encoding. More... | |
| template<Encoding E, typename T > | |
| PutAs< E, T > | putAs (T &&obj) |
| This is a helper function to facilitate constructing WS::PutAs wrapper. More... | |
| template<Encoding E, typename T > | |
| GetAs< E, T > | getAs (T &obj) |
| This is a helper function to facilitate constructing WS::GetAs wrapper. More... | |
| template<WS::Encoding EIn, WS::Encoding EOut> | |
| WSStream< EIn, EOut > & | NewPacket (WSStream< EIn, EOut > &ms) |
| NewPacket is a WSStream token which tells WSTP to skip to the end of the current packet. More... | |
| template<WS::Encoding EIn, WS::Encoding EOut> | |
| WSStream< EIn, EOut > & | EndPacket (WSStream< EIn, EOut > &ms) |
| EndPacket is a WSStream token which tells WSTP that the current expression is complete and is ready to be sent. More... | |
| template<WS::Encoding EIn, WS::Encoding EOut> | |
| WSStream< EIn, EOut > & | Flush (WSStream< EIn, EOut > &ms) |
| Flush is a WSStream token which tells WSTP to flush out any buffers containing data waiting to be sent on link. More... | |
| template<WS::Encoding EIn, WS::Encoding EOut> | |
| WSStream< EIn, EOut > & | Rule (WSStream< EIn, EOut > &ms, Direction dir) |
| Rule is a WSStream token corresponding to a Rule expression in the WolframLanguage. More... | |
| template<WS::Encoding EIn, WS::Encoding EOut> | |
| WSStream< EIn, EOut > & | Null (WSStream< EIn, EOut > &ms, Direction dir) |
| Null is a WSStream token corresponding to a Null expression in the WolframLanguage. More... | |
Variables | |
| template<Encoding E, typename T > | |
| constexpr bool | CharacterTypesCompatible = (sizeof(T) == sizeof(CharType<E>)) |
| Check whether character type T is compatible with encoding E (i.e. More... | |
| template<typename T > | |
| constexpr bool | supportedInWSArithmeticQ = false |
| Utility trait that determines whether type T is a suitable data type for functions like WSPut*Array, WSGet*List, WSPutScalar, etc. More... | |
| template<typename T > | |
| constexpr bool | ScalarSupportedTypeQ = supportedInWSArithmeticQ<remove_cv_ref<T>> |
| Convenient alias for supportedInWSArithmeticQ<T> that strips T from cv-qualifiers and reference. More... | |
| template<typename T > | |
| constexpr bool | supportedInWSStringQ = false |
| Utility trait that determines whether type T is a suitable character type for WSPut*String and WSGet*String. More... | |
| template<typename T > | |
| constexpr bool | StringTypeQ = supportedInWSStringQ<remove_cv_ref<T>> |
| Convenient alias for supportedInWSStringQ<T> that strips T from cv-qualifiers and reference. More... | |
| using LLU::WS::ArrayData = typedef std::unique_ptr<T[], ReleaseArray<T> > |
ArrayData with of type T is a unique_ptr to an array of Ts with custom destructor.
It allows you to take ownership of raw array data from WSTP without making extra copies. The destructor object also carries information about the array's dimensions and heads.
| LLU::WS::CharType |
Specializations of CharTypeStruct, encoding E has assigned type T iff WSPutEString takes const T* as second parameter.
| E | - encoding |
Utility alias for type member of CharTypeStruct
| using LLU::WS::GetStringFuncT = typedef std::function<int(WSLINK, const T**, int*, int*)> |
GetStringFuncT is a type of WSTP function that reads string from a link, e.g. WSGetByteString.
| using LLU::WS::ListData = typedef std::unique_ptr<T[], ReleaseList<T> > |
ListData with of type T is a unique_ptr to an array of Ts with custom destructor.
It allows you to take ownership of raw list data from WSTP without making extra copies. The destructor object also carries information about the list's length.
| using LLU::WS::PutStringFuncT = typedef std::function<int(WSLINK, const T*, int)> |
PutStringFuncT is a type of WSTP function that sends string data to a link, e.g. WSPutByteString.
| using LLU::WS::ReleaseStringFuncT = typedef std::function<void(WSLINK, const T*, int)> |
ReleaseStringFuncT is a type of WSTP function to release string data allocated by WSTP, e.g. WSReleaseByteString.
| using LLU::WS::StringData = typedef std::unique_ptr<const CharType<E>[], ReleaseString<E> > |
StringData with Encoding E is a unique_ptr to an array of E-encoded characters It allows you to take ownership of raw string data from WSTP without making extra copies.
| LLU::WS::StringType |
| E | - encoding |
Utility alias for type member of StringTypeStruct
|
strong |
Helper enum for tokens that can be sent via WSTP in both directions, e.g. WS::Null.
|
strong |
List of all string encodings supported by WSTP
| WSStream<EIn, EOut>& LLU::WS::EndPacket | ( | WSStream< EIn, EOut > & | ms | ) |
EndPacket is a WSStream token which tells WSTP that the current expression is complete and is ready to be sent.
| EIn | - WSStream input encoding (will be inferred from the argument) |
| EOut | - WSStream output encoding (will be inferred from the argument) |
| ms | - stream object |
| WSStream<EIn, EOut>& LLU::WS::Flush | ( | WSStream< EIn, EOut > & | ms | ) |
Flush is a WSStream token which tells WSTP to flush out any buffers containing data waiting to be sent on link.
| EIn | - WSStream input encoding (will be inferred from the argument) |
| EOut | - WSStream output encoding (will be inferred from the argument) |
| ms | - stream object |
| GetAs<E, T> LLU::WS::getAs | ( | T & | obj | ) |
|
constexpr |
Get the name of encoding.
| e | - value of WS::Encoding enum |
| WSStream<EIn, EOut>& LLU::WS::NewPacket | ( | WSStream< EIn, EOut > & | ms | ) |
| WSStream<EIn, EOut>& LLU::WS::Null | ( | WSStream< EIn, EOut > & | ms, |
| Direction | dir | ||
| ) |
Null is a WSStream token corresponding to a Null expression in the WolframLanguage.
| EIn | - WSStream input encoding (will be inferred from the argument) |
| EOut | - WSStream output encoding (will be inferred from the argument) |
| ms | - stream object |
| dir | - stream direction, you don't need to specify this argument when using Null in a WSStream::operator<< or operator>> |
| PutAs<E, T> LLU::WS::putAs | ( | T && | obj | ) |
| WSStream<EIn, EOut>& LLU::WS::Rule | ( | WSStream< EIn, EOut > & | ms, |
| Direction | dir | ||
| ) |
Rule is a WSStream token corresponding to a Rule expression in the WolframLanguage.
| EIn | - WSStream input encoding (will be inferred from the argument) |
| EOut | - WSStream output encoding (will be inferred from the argument) |
| ms | - stream object |
| dir | - stream direction, you don't need to specify this argument when using Rule in a WSStream::operator<< or operator>> |
|
inlineconstexpr |
Check whether character type T is compatible with encoding E (i.e.
if it can be more or less safely used with WSPut/Get<E>String)
Each WSTP function WSPut/Get*String works with only one specific character type (see CharType<E>). In C++, on the other hand, there is no notion of encoding so std::string (with character type being char) can be used to store strings of any encoding.
We say that character type T is compatible with encoding E as long as the size of T is the same as size of CharType<E>.
|
inlineconstexpr |
Convenient alias for supportedInWSArithmeticQ<T> that strips T from cv-qualifiers and reference.
|
inlineconstexpr |
Convenient alias for supportedInWSStringQ<T> that strips T from cv-qualifiers and reference.
|
inlineconstexpr |
Utility trait that determines whether type T is a suitable data type for functions like WSPut*Array, WSGet*List, WSPutScalar, etc.
| T | - any type |
|
inlineconstexpr |
Utility trait that determines whether type T is a suitable character type for WSPut*String and WSGet*String.
| T | - any type |