PikaScript
|
We provide two Native template classes for bridging PikaScript calls to C++ "functors". More...
#include <PikaScript.h>
Protected Member Functions | |
template<class T > | |
const Value | arg (Frame &f, const T &) |
Get the first argument from the frame f . | |
Frame & | arg (Frame &f, const Dumb< Frame & > &) |
Overloaded arg() that returns the actual frame instead of getting the argument value if the functor argument references a Script::Frame& type. | |
const Frame & | arg (Frame &f, const Dumb< const Frame & > &) |
Overloaded arg() that returns the actual frame instead of getting the argument value if the functor argument references a const Script::Frame& type. | |
template<class A , class T > | |
Value | call (A &a, const Dumb< T > &) |
Call the functor with the argument a . | |
template<class A > | |
Value | call (A &a, const Dumb< void > &) |
Overloaded to return the void value for functors that returns the void type. | |
template<class T > | |
const Value | arg (Frame &f, const T &) |
Get the first argument from the frame f . | |
Frame & | arg (Frame &f, const Dumb< Frame & > &) |
Overloaded arg() that returns the actual frame instead of getting the argument value if the functor argument references a Script::Frame& type. | |
const Frame & | arg (Frame &f, const Dumb< const Frame & > &) |
Overloaded arg() that returns the actual frame instead of getting the argument value if the functor argument references a const Script::Frame& type. | |
template<class A , class T > | |
Value | call (A &a, const Dumb< T > &) |
Call the functor with the argument a . | |
template<class A > | |
Value | call (A &a, const Dumb< void > &) |
Overloaded to return the void value for functors that returns the void type. | |
Additional Inherited Members |
We provide two Native template classes for bridging PikaScript calls to C++ "functors".
One that takes a single argument (UnaryFunctor) and one that takes two arguments (BinaryFunctor). A "functor" is either a class that has an overloaded operator() or a C / C++ function. It is a concept introduced to C++ with STL so please refer to your STL documentation of choice for more info. (For example: http://www.sgi.com/tech/stl/functors.html )
Thanks to some clever template tricks, these classes are very flexible when it comes to what type of arguments your functor can take and what type it may return. Here are your options:
bool
, long
, double
etc).void
result type.$0
, $1
, $2
etc from the Frame (via Frame::get() or Frame::getOptional()).In Frame you will find a template function (Frame::registerNative()) that allows you to register a native C++ function directly through a functor. It will construct the proper functor instance for you "in the background".
If you need use examples, please see the standard library implementation in PikaScriptImpl.h.
Definition at line 484 of file PikaScript.h.