Clingo
Loading...
Searching...
No Matches
Clingo::Script Class Referenceabstract

Interface for custom scripts. More...

#include <script.hh>

Public Member Functions

 Script ()=default
 The default constructor.
 
 Script (Script &&other)=delete
 Disable copy and move operations.
 
virtual ~Script ()=default
 The default destructor.
 
void execute (std::string_view code)
 Callback to execute the given code.
 
auto call (Library &lib, std::string_view name, SymbolSpan arguments) -> SymbolVector
 Callback to call the function with the given name and arguments.
 
auto callable (std::string_view name, size_t arguments) -> bool
 Callback to check if the given signature is callable.
 
void main (Library &lib, const Control &ctl)
 Callback to customize the main function.
 
auto name () -> std::string_view
 Get the name of the script.
 
auto version () -> std::string_view
 Get the version of the script.
 

Detailed Description

Interface for custom scripts.

Member Function Documentation

◆ call()

auto Clingo::Script::call ( Library lib,
std::string_view  name,
SymbolSpan  arguments 
) -> SymbolVector
inline

Callback to call the function with the given name and arguments.

Parameters
libthe library object for storing symbols
namethe name of the function to call
argumentsthe arguments to the function
Returns
the symbols returned by the function

◆ callable()

auto Clingo::Script::callable ( std::string_view  name,
size_t  arguments 
) -> bool
inline

Callback to check if the given signature is callable.

Parameters
namethe name of the function to check
argumentsthe number of arguments of the function
Returns
whether the function is callable

◆ execute()

void Clingo::Script::execute ( std::string_view  code)
inline

Callback to execute the given code.

Parameters
codethe code to execute

◆ main()

void Clingo::Script::main ( Library lib,
const Control ctl 
)
inline

Callback to customize the main function.

Parameters
libthe library object for storing symbols
ctlthe control object

◆ name()

auto Clingo::Script::name ( ) -> std::string_view
inline

Get the name of the script.

Returns
the name of the script

◆ version()

auto Clingo::Script::version ( ) -> std::string_view
inline

Get the version of the script.

Returns
the version of the script

The documentation for this class was generated from the following file: