RTBKit  0.9
Open-source framework to create real-time ad bidding systems.
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator
Public Member Functions | Static Public Member Functions
Datacratic::Slot Struct Reference

#include <slot.h>

Inheritance diagram for Datacratic::Slot:
Datacratic::SlotT< Fn >

List of all members.

Public Member Functions

 Slot (Slot &&other)
Slotoperator= (Slot &&other)
void swap (Slot &other)
 Slot (const Slot &other)
Slotoperator= (const Slot &other)
template<typename Fn >
 Slot (const boost::function< Fn > &fn, Operations ops=FunctionOps< Fn >::ops, JS::JSOperations jsops=JS::getOps(typeid(Fn)))
 Slot (const v8::Handle< v8::Function > &fn)
 Slot (const v8::Handle< v8::Value > &fn)
std::string print () const
bool isEmpty () const
template<typename CallAs , typename... Args>
boost::function< CallAs >
::result_type 
call (Args...args) const
v8::Handle< v8::Value > call (const v8::Arguments &args) const
v8::Handle< v8::Value > call (const v8::Handle< v8::Object > &This, int argc, v8::Handle< v8::Value > argv[]) const
v8::Local< v8::Function > toJsFunction () const
const std::type_info & type () const
template<typename Fn >
boost::function< Fn > as (JS::JSOperations jsops=0) const
template<typename Fn >
 operator boost::function< Fn > () const
template<typename R >
 operator boost::function0< R > () const

Static Public Member Functions

template<typename Fn , typename F >
static Slot fromF (const boost::function< F > &fn, Operations ops=FunctionOps< Fn >::ops, JS::JSOperations jsops=JS::getOps(typeid(Fn)))
template<typename Fn , typename F >
static Slot fromF (F fn, Operations ops=FunctionOps< Fn >::ops, JS::JSOperations jsops=JS::getOps(typeid(Fn)))

Detailed Description

Encapsulates a function that can be called with a specific argument list, without knowing the actual argument list.

Note that in the C++ world, the signatures under which we are calling and the signature of the wrapped function must match exactly (ie, no type coersion.

These can be:

Definition at line 126 of file slot.h.


Constructor & Destructor Documentation

Datacratic::Slot::Slot ( const v8::Handle< v8::Function > &  fn)

Initialize from a Javascript function.

Definition at line 89 of file slot.cc.

Datacratic::Slot::Slot ( const v8::Handle< v8::Value > &  fn)

Initialize from a Javascript value that must be convertible to a function.

Definition at line 99 of file slot.cc.


Member Function Documentation

template<typename Fn >
boost::function<Fn> Datacratic::Slot::as ( JS::JSOperations  jsops = 0) const [inline]

Return a boost function object that will synchronously call the given callback.

Definition at line 236 of file slot.h.

template<typename CallAs , typename... Args>
boost::function<CallAs>::result_type Datacratic::Slot::call ( Args...  args) const [inline]

Call from C++, knowing exactly what kinds of parameters there are.

Reimplemented in Datacratic::SlotT< Fn >, Datacratic::SlotT< void()>, and Datacratic::SlotT< void(std::string, std::string)>.

Definition at line 204 of file slot.h.

v8::Handle< v8::Value > Datacratic::Slot::call ( const v8::Arguments &  args) const

Call from Javascript, unpacking the parameters as we go and wrapping up the return value.

Definition at line 188 of file slot.cc.

bool Datacratic::Slot::isEmpty ( ) const [inline]

Is it empty?

Definition at line 199 of file slot.h.

template<typename Fn >
Datacratic::Slot::operator boost::function< Fn > ( ) const [inline]

Implicit conversion to boost::function<x>

Reimplemented in Datacratic::SlotT< Fn >.

Definition at line 273 of file slot.h.

std::string Datacratic::Slot::print ( ) const

Print a string representation giving information about the slot.

Reimplemented in Datacratic::SlotT< Fn >, Datacratic::SlotT< void()>, and Datacratic::SlotT< void(std::string, std::string)>.

Definition at line 171 of file slot.cc.

v8::Local< v8::Function > Datacratic::Slot::toJsFunction ( ) const

Convert directly into a JS function. NOTE: this is slow; due to v8 limitations we need to actually parse a JS file each time.

If it was already a JS function, then that function is simply returned.

Definition at line 117 of file slot_js.cc.

const std::type_info & Datacratic::Slot::type ( ) const

Return the type info node of the function type. Will return the typeinfo node of the v8 function if it's a JS value.

Definition at line 248 of file slot.cc.


The documentation for this struct was generated from the following files:
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator