RTBKit  0.9
Open-source framework to create real-time ad bidding systems.
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes
Datacratic::JS::JSWrapped2< Shared, Wrapper, ClassNameT, ModuleT, defaultWrapper > Struct Template Reference
Inheritance diagram for Datacratic::JS::JSWrapped2< Shared, Wrapper, ClassNameT, ModuleT, defaultWrapper >:
Datacratic::JS::JSWrapped< Shared > Datacratic::JS::JSWrappedBase

List of all members.

Public Types

typedef Shared shared_type
typedef Shared base_shared_type
typedef JSWrapped< Shared > base_type
typedef base_type root_type
typedef Shared root_shared_type
typedef JSWrapped2< Shared,
Wrapper, ClassNameT, ModuleT,
defaultWrapper > 
WrapperType

Public Member Functions

virtual size_t memusage (void *object) const
virtual std::string getJsTypeName () const

Static Public Member Functions

static void check_tmpl ()
static v8::Local< v8::Object > toJS (const std::shared_ptr< Shared > &shared)
static v8::Local< v8::Object > toJS (Shared &shared, const std::shared_ptr< void > &owner)
static std::shared_ptr< Shared > fromJS (v8::Handle< v8::Object > obj)
static Wrapper * getWrapper (v8::Handle< v8::Value > handle)
static Wrapper * getWrapper (const v8::Arguments &args)
static Shared * getShared (v8::Handle< v8::Value > handle)
static Shared * getShared (const v8::Arguments &args)
static std::shared_ptr< Shared > getSharedPtr (v8::Handle< v8::Value > handle)
static std::shared_ptr< Shared > getSharedPtr (const v8::Arguments &args)
static void setShared (v8::Handle< v8::Value > handle, const std::shared_ptr< Shared > &shared)
template<typename Owner >
static void setShared (v8::Handle< v8::Value > handle, Shared &shared, const std::shared_ptr< Owner > &owner)
static v8::Handle< v8::Value > NoConstructor (const v8::Arguments &args)
static v8::Handle< v8::Value > wrapperType (const v8::Arguments &args)
static void addMethods ()
static v8::Persistent
< v8::FunctionTemplate > 
Register (SetupFunction setup=JSWrapped< Shared >::Setup)
static v8::Persistent
< v8::FunctionTemplate > 
Register (v8::InvocationCallback constructor, SetupFunction setup=JSWrapped< Shared >::Setup)
static v8::Local< v8::Object > constructMe (void *smart_ptr, const void *object)
static void unwrapMe (const v8::Handle< v8::Value > &wrapper, void *outputPtr, const std::type_info &wrapperType)
static void InitializeFunction ()
static void DestructionFunction ()
template<typename T , typename Obj >
static void registerRWProperty (T(Obj::*ptr), const char *name, unsigned options=v8::DontDelete)
template<typename T , typename Obj >
static void registerROProperty (T(Obj::*ptr), const char *name, unsigned options=v8::DontDelete|v8::ReadOnly)
template<typename T , typename Obj >
static void registerROProperty (T(Obj::*pmf)() const, const char *name, unsigned options=v8::DontDelete|v8::ReadOnly)
template<typename Fn >
static void registerROProperty (const Fn &lambda, const char *name, unsigned options=v8::DontDelete|v8::ReadOnly, decltype(lambda(*(Shared *) 0))*=0)
static void registerROProperty (const std::string &getterFn, const char *name, unsigned options=v8::DontDelete|v8::ReadOnly)
static void registerROProperty (const std::string &getterFn, unsigned options=v8::DontDelete|v8::ReadOnly)
template<typename R , typename Obj , typename... Args>
static void registerAsyncCallback (boost::function< R(Args...)>(Obj::*ptr), const char *name, unsigned options=v8::DontDelete)
template<typename R , typename Obj , typename... Args, typename... Defaults>
static void registerMemberFn (R(Obj::*pmf)(Args...args) const, const char *name, Defaults...defaults)
template<typename R , typename Obj , typename... Args, typename... Defaults>
static void registerMemberFn (R(Obj::*pmf)(Args...args), const char *name, Defaults...defaults)
static void addMemberFn (const std::string &functionSource, const char *name, unsigned options=v8::DontDelete|v8::ReadOnly)
static void addMemberFn (const std::string &functionSource, unsigned options=v8::DontDelete|v8::ReadOnly)
static v8::Handle< v8::Value > extend (const v8::Arguments &args)

Static Public Attributes

static const char *const & ClassName = ClassNameT
static const char *const & Module = ModuleNameT
static v8::Persistent
< v8::FunctionTemplate > 
tmpl
static DoInitialize initializer

Detailed Description

template<typename Shared, typename Wrapper, const char *const & ClassNameT, const char *const & ModuleT, bool defaultWrapper = true>
struct Datacratic::JS::JSWrapped2< Shared, Wrapper, ClassNameT, ModuleT, defaultWrapper >

Definition at line 594 of file js_wrapped.h.


Member Function Documentation

template<typename Shared, typename Wrapper, const char *const & ClassNameT, const char *const & ModuleT, bool defaultWrapper = true>
static v8::Local<v8::Object> Datacratic::JS::JSWrapped2< Shared, Wrapper, ClassNameT, ModuleT, defaultWrapper >::constructMe ( void *  smart_ptr,
const void *  object 
) [inline, static]

Function used by the registry to construct this object from a shared pointer to a base class. Used by the magic that allows a wrapper to be found by the registry for any derived class of a base.

Does manipulation of the internals of a shared pointer. Not for the unwary.

Reimplemented in Datacratic::JS::JSWrapped3< Bzip2Decompressor, Bzip2DecompressorJS, FilterJS, Bzip2DecompressorName, loggerModule, true >, Datacratic::JS::JSWrapped3< NullBanker, NullBankerJS, BankerJS, NullBankerName, rtbModule, true >, Datacratic::JS::JSWrapped3< IdentityFilter, IdentityFilterJS, FilterJS, IdentityFilterName, loggerModule, true >, Datacratic::JS::JSWrapped3< ZlibDecompressor, ZlibDecompressorJS, FilterJS, ZlibDecompressorName, loggerModule, true >, Datacratic::JS::JSWrapped3< LzmaDecompressor, LzmaDecompressorJS, FilterJS, LzmaDecompressorName, loggerModule, true >, Datacratic::JS::JSWrapped3< JsonDecompressor, JsonDecompressorJS, FilterJS, JsonDecompressorName, loggerModule, true >, Datacratic::JS::JSWrapped3< RotatingFileOutput, RotatingFileOutputJS, LogOutputJS, RotatingFileOutputName, loggerModule, true >, Datacratic::JS::JSWrapped3< ReDerived, ReDerivedJS, DerivedJS, ReDerivedName, Module >, Datacratic::JS::JSWrapped3< JSOutput, JSOutputJS, LogOutputJS, JSOutputName, loggerModule, true >, Datacratic::JS::JSWrapped3< GzipDecompressor, GzipDecompressorJS, FilterJS, GzipDecompressorName, loggerModule, true >, Datacratic::JS::JSWrapped3< FileOutput, FileOutputJS, LogOutputJS, FileOutputName, loggerModule, true >, Datacratic::JS::JSWrapped3< Derived, DerivedJS, BaseJS, DerivedName, Module >, Datacratic::JS::JSWrapped3< ZlibCompressor, ZlibCompressorJS, FilterJS, ZlibCompressorName, loggerModule, true >, Datacratic::JS::JSWrapped3< Bzip2Compressor, Bzip2CompressorJS, FilterJS, Bzip2CompressorName, loggerModule, true >, Datacratic::JS::JSWrapped3< RemoteOutput, RemoteOutputJS, LogOutputJS, RemoteOutputName, loggerModule, true >, Datacratic::JS::JSWrapped3< PublishOutput, PublishOutputJS, LogOutputJS, PublishOutputName, loggerModule, true >, Datacratic::JS::JSWrapped3< GzipCompressorFilter, GzipCompressorJS, FilterJS, GzipCompressorName, loggerModule, true >, Datacratic::JS::JSWrapped3< JsonCompressor, JsonCompressorJS, FilterJS, JsonCompressorName, loggerModule, true >, and Datacratic::JS::JSWrapped3< LzmaCompressor, LzmaCompressorJS, FilterJS, LzmaCompressorName, loggerModule, true >.

Definition at line 789 of file js_wrapped.h.

template<typename Shared, typename Wrapper, const char *const & ClassNameT, const char *const & ModuleT, bool defaultWrapper = true>
template<typename R , typename Obj , typename... Args>
static void Datacratic::JS::JSWrapped2< Shared, Wrapper, ClassNameT, ModuleT, defaultWrapper >::registerAsyncCallback ( boost::function< R(Args...)> Obj::*  ptr,
const char *  name,
unsigned  options = v8::DontDelete 
) [inline, static]

This function is used in a very particular case.

If we have a C++ object that has a data member that is a boost::function<...>, then calling this function will expose that data member as a data member in the JS object. Assigning a JS function to that member will overwrite the boost::function with a synthisized callback that performs the following:

1. Check if we're currently in the thread that's active in the JS runtime. If so, call the JS function immediately. 2. If not, then queue the JS function on libuv so that node will eventually call it back with the supplied parameters. Once enqueued, the boost::function will then return.

Note that the return code of the function has to be void, as there is no way for an asynchonous function's return code to be later applied at the source of the call (which has already terminated). Any information fedback needs to be passed through callbacks.

Note also that to make this function work, you need to #include "soa/js/js_call.h"

Definition at line 968 of file js_wrapped.h.

template<typename Shared, typename Wrapper, const char *const & ClassNameT, const char *const & ModuleT, bool defaultWrapper = true>
template<typename T , typename Obj >
static void Datacratic::JS::JSWrapped2< Shared, Wrapper, ClassNameT, ModuleT, defaultWrapper >::registerROProperty ( T(Obj::*)() const  pmf,
const char *  name,
unsigned  options = v8::DontDelete | v8::ReadOnly 
) [inline, static]

Register a read-only property from a getter member function.

Definition at line 854 of file js_wrapped.h.


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