LibraryLink Utilities  3.0.1
Modern C++ wrapper over LibraryLink and WSTP
LLU::WS::Function Struct Reference

Description

Structure representing any function in Wolfram Language, i.e. a head plus number of arguments.

+ Inheritance diagram for LLU::WS::Function:
+ Collaboration diagram for LLU::WS::Function:

#include <Utilities.h>

Public Member Functions

 Function ()
 Default constructor. More...
 
 Function (const std::string &h)
 Create a Function with given head but unknown number of arguments. More...
 
 Function (const std::string &h, int argCount)
 Construct a Function with given head and number of arguments. More...
 
int getArgc () const
 Get argument count. More...
 
void setArgc (int newArgc)
 Set argument count. More...
 
const std::string & getHead () const
 Get Symbol name/head. More...
 
void setHead (std::string h)
 Set Symbol name/head. More...
 

Constructor & Destructor Documentation

◆ Function() [1/3]

LLU::WS::Function::Function ( )
inline

Default constructor.

The head is empty and number of arguments is set to a dummy value. This constructor should only be used to create a Function right before calling WSStream::operator>> on it, which will read a function from top-level.

◆ Function() [2/3]

LLU::WS::Function::Function ( const std::string &  h)
inlineexplicit

Create a Function with given head but unknown number of arguments.

You can later call WSStream::operator>> on such constructed Function to populate argument count with a value read from top-level.

Parameters
h- function head

◆ Function() [3/3]

LLU::WS::Function::Function ( const std::string &  h,
int  argCount 
)
inline

Construct a Function with given head and number of arguments.

Parameters
h- function head
argCount- number of arguments this function takes

Member Function Documentation

◆ getArgc()

int LLU::WS::Function::getArgc ( ) const

Get argument count.

Returns
number of arguments this function takes

◆ getHead()

const std::string & LLU::WS::Symbol::getHead ( ) const
inherited

Get Symbol name/head.

Returns
head

◆ setArgc()

void LLU::WS::Function::setArgc ( int  newArgc)

Set argument count.

Parameters
newArgc- new value for argument count

◆ setHead()

void LLU::WS::Symbol::setHead ( std::string  h)
inherited

Set Symbol name/head.

Parameters
h- new head for the Symbol