PikaScript
Protected Member Functions | List of all members
Pika::Script< Config >::UnaryFunctor< F, A0, R > Class Template Reference

We provide two Native template classes for bridging PikaScript calls to C++ "functors". More...

#include <PikaScript.h>

Inheritance diagram for Pika::Script< Config >::UnaryFunctor< F, A0, R >:
Inheritance graph
[legend]
Collaboration diagram for Pika::Script< Config >::UnaryFunctor< F, A0, R >:
Collaboration graph
[legend]

Protected Member Functions

template<class T >
const Value arg (Frame &f, const T &)
 Get the first argument from the frame f.
 
Framearg (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 Framearg (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.
 
Framearg (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 Framearg (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

Detailed Description

template<class Config>
template<class F, class A0 = typename F::argument_type, class R = typename F::result_type>
class Pika::Script< Config >::UnaryFunctor< F, A0, R >

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:

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.


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