![]() |
ArkScript
A small, lisp-inspired, functional scripting language
|
Storage class to hold custom functions. More...
#include <Procedure.hpp>
Public Types | |
using | PointerType = Value (*)(std::vector<Value>&, VM*) |
using | CallbackType = std::function<Value(std::vector<Value>&, VM*)> |
Public Member Functions | |
template<typename T > | |
Procedure (T &&cb) | |
Create a new procedure. | |
Procedure (PointerType c_ptr) | |
Create a new procedure from a stateless C function pointer. | |
Value | operator() (std::vector< Value > &, VM *) const |
bool | operator< (const Procedure &other) const noexcept |
bool | operator== (const Procedure &other) const noexcept |
Private Attributes | |
CallbackType | m_procedure |
Storage class to hold custom functions.
Definition at line 25 of file Procedure.hpp.
using Ark::Procedure::CallbackType = std::function<Value(std::vector<Value>&, VM*)> |
Definition at line 29 of file Procedure.hpp.
using Ark::Procedure::PointerType = Value (*)(std::vector<Value>&, VM*) |
Definition at line 28 of file Procedure.hpp.
|
inline |
Create a new procedure.
Due to clang (sometimes) rejecting forward declared types in templates (Value
causes issues), we have to implement the constructor for the actual CallbackType
using SFINAE and a templated constructor, such that when clang encounters the constructor, it knows the actual declaration of Value
.
Definition at line 43 of file Procedure.hpp.
Ark::Procedure::Procedure | ( | PointerType | c_ptr | ) |
Create a new procedure from a stateless C function pointer.
Definition at line 13 of file Procedure.cpp.
References m_procedure.
Definition at line 8 of file Procedure.cpp.
References m_procedure.
|
noexcept |
Definition at line 18 of file Procedure.cpp.
|
noexcept |
Definition at line 23 of file Procedure.cpp.
|
private |
Definition at line 59 of file Procedure.hpp.
Referenced by operator()(), and Procedure().