RTBKit
0.9
Open-source framework to create real-time ad bidding systems.
|
00001 /* js_call_fwd.h -*- C++ -*- 00002 Jeremy Barnes, 16 November 2010 00003 Copyright (c) 2010 Datacratic. All rights reserved. 00004 00005 Forward definitions for the js_call infrastructure. 00006 */ 00007 00008 #ifndef __js__js_call_fwd_h__ 00009 #define __js__js_call_fwd_h__ 00010 00011 #include <typeinfo> 00012 #include <boost/function.hpp> 00013 00014 namespace v8 { 00015 struct Arguments; 00016 template<typename T> struct Handle; 00017 template<typename T> struct Persistent; 00018 template<typename T> struct Local; 00019 struct Value; 00020 struct Function; 00021 struct Object; 00022 00023 } // namespace v8 00024 00025 namespace Datacratic { 00026 namespace JS { 00027 00028 template<typename Fn, int arity = Fn::arity> 00029 struct callfromjs; 00030 00031 template<typename Fn, int arity = boost::function<Fn>::arity> 00032 struct calltojs; 00033 00034 00035 struct JSArgs; 00036 00049 typedef void (*JSCallsBoost) (int op, 00050 const boost::function_base & fn, 00051 const JS::JSArgs & args, 00052 v8::Handle<v8::Value> & result); 00053 00054 typedef void (*JSAsBoost) (int op, 00055 const v8::Persistent<v8::Function> & fn, 00056 const v8::Handle<v8::Object> & This, 00057 boost::function_base & result); 00058 00059 // This is compatible with the previous two 00060 typedef void (*JSOperations) (int op, 00061 const void * arg1, 00062 const void * arg2, 00063 void * result); 00064 00065 JSOperations getOps(const std::type_info & fntype); 00066 void registerJsOps(const std::type_info & type, 00067 JS::JSOperations ops); 00068 00069 00070 00071 } // namespace JS 00072 } // namespace Datacratic 00073 00074 #endif /* __js__js_call_fwd_h__ */ 00075