 |
LibraryLink Utilities
3.0.1
Modern C++ wrapper over LibraryLink and WSTP
|
Go to the documentation of this file.
7 #ifndef LLU_WSTP_UTILITIES_H_
8 #define LLU_WSTP_UTILITIES_H_
20 template<WS::Encoding, WS::Encoding>
43 explicit Symbol(std::string h) : head(std::move(h)) {};
49 const std::string&
getHead()
const;
151 const std::string&
why()
const {
167 void checkError(WSLINK m,
int statusOk,
const std::string& errorName,
const std::string& debugInfo =
"");
174 [[noreturn]]
void throwLLUException(
const std::string& errorName,
const std::string& debugInfo =
"");
181 WSLINK getNewLoopback(WSLINK m);
188 int countExpressionsInLoopbackLink(WSLINK& lpbckLink);
202 template<WS::Encoding EIn, WS::Encoding EOut>
216 template<WS::Encoding EIn, WS::Encoding EOut>
230 template<WS::Encoding EIn, WS::Encoding EOut>
244 template<WS::Encoding EIn, WS::Encoding EOut>
246 if (dir == Direction::Put) {
260 template<WS::Encoding EIn, WS::Encoding EOut>
262 if (dir == Direction::Put) {
263 return ms <<
Symbol(
"Null");
265 return ms >>
Symbol(
"Null");
List(int argCount)
Create a WSStream-compatible structure that corresponds to a List of given length.
Definition: WSTP/Utilities.h:130
Direction
Helper enum for tokens that can be sent via WSTP in both directions, e.g. WS::Null.
Definition: WSTP/Utilities.h:192
Symbol()=default
Default constructor.
void setHead(std::string h)
Set Symbol name/head.
Definition: Utilities.cpp:17
Main namespace of LibraryLink Utilities.
Definition: Queue.h:13
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 sen...
Definition: WSTP/Utilities.h:231
Wrapper class over WSTP with a stream-like interface.
Definition: WSTP/Utilities.h:21
Structure representing any function in Wolfram Language, i.e. a head plus number of arguments.
Definition: WSTP/Utilities.h:65
Special type of a Function which corresponds to the Missing expression when exchanged with the Kernel...
Definition: WSTP/Utilities.h:136
Definition: WSTP/Utilities.h:272
Structure representing any symbol in Wolfram Language.
Definition: WSTP/Utilities.h:32
Missing()
Default constructor - sets "Missing" to be the head of expression with no arguments.
Definition: WSTP/Utilities.h:138
BeginExpr(const std::string &head)
Create a token for the WSStream which initiates sending an expression with given head and unknown num...
Definition: WSTP/Utilities.h:277
Function()
Default constructor.
Definition: WSTP/Utilities.h:73
Association(int argCount)
Create a WSStream-compatible structure that corresponds to an Association with given number of argume...
Definition: WSTP/Utilities.h:116
const std::string WSFlowControlError
One of the flow control functions failed.
Defines possible encodings together with their properties and related types.
Missing(std::string r)
Create a WSStream-compatible structure that corresponds to a Missing expression with given "reason".
Definition: WSTP/Utilities.h:144
int getArgc() const
Get argument count.
Definition: Utilities.cpp:21
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 t...
Definition: WSTP/Utilities.h:217
void setArgc(int newArgc)
Set argument count.
Definition: Utilities.cpp:25
Association()
Default constructor - sets "Association" to be the head of expression with no arguments.
Definition: WSTP/Utilities.h:110
WSStream< EIn, EOut > & Null(WSStream< EIn, EOut > &ms, Direction dir)
Null is a WSStream token corresponding to a Null expression in the WolframLanguage.
Definition: WSTP/Utilities.h:261
Definitions of error names and error codes used across LLU.
List()
Default constructor - sets "List" to be the head of expression with no arguments.
Definition: WSTP/Utilities.h:124
const std::string WSPacketHandleError
One of the packet handling functions failed.
Special type of a Function which corresponds to the Association expression when exchanged with the Ke...
Definition: WSTP/Utilities.h:108
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.
Definition: WSTP/Utilities.h:203
Definition: WSTP/Utilities.h:284
Function(const std::string &h, int argCount)
Construct a Function with given head and number of arguments.
Definition: WSTP/Utilities.h:87
Definition: WSTP/Utilities.h:290
WSStream< EIn, EOut > & Rule(WSStream< EIn, EOut > &ms, Direction dir)
Rule is a WSStream token corresponding to a Rule expression in the WolframLanguage.
Definition: WSTP/Utilities.h:245
const std::string & why() const
Get the first argument of the expression which is the reason for the data's being missing.
Definition: WSTP/Utilities.h:151
Function(const std::string &h)
Create a Function with given head but unknown number of arguments.
Definition: WSTP/Utilities.h:80
Symbol(std::string h)
Constructs a Symbol given its head.
Definition: WSTP/Utilities.h:43
Special type of a Function which corresponds to the List expression when exchanged with the Kernel vi...
Definition: WSTP/Utilities.h:122
WSLINK & get() noexcept
Returns a reference to underlying low-level WSTP handle.
Definition: WSStream.hpp:76
const std::string & getHead() const
Get Symbol name/head.
Definition: Utilities.cpp:13