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

#include <signal.h>

Inheritance diagram for Datacratic::SignalRegistryBase:
Datacratic::SignalRegistry< Class >

List of all members.

Classes

struct  Info

Public Member Functions

 SignalRegistryBase ()
 SignalRegistryBase (SignalRegistryBase &inheritFrom)
size_t size () const
template<typename Class >
SlotDisconnector on (const std::string &name, Class *object, const Slot &slot, int priority=0) const
std::vector< std::string > names () const
SignalInfo info (const std::string &name) const
void inheritSignals (SignalRegistryBase &inheritFrom)

Protected Types

typedef SlotDisconnector(* RegisterFn )(void *thisPtr, const std::type_info &thisType, const std::string &name, const Slot &slotToRegister, int priority, void *data)
typedef std::unordered_map
< std::string, Info
Signals
typedef void( NewEvent )(const SignalRegistryBase &, const Info &)

Protected Member Functions

SlotDisconnector doOn (const std::string &name, void *object, const std::type_info &objectType, const Slot &slot, int priority) const
void add (const std::string &eventName, const std::type_info &callbackType, const std::type_info &objectType, RegisterFn registerFn, void *data=0)
void addSignal (const Info &signal, bool inherited)

Protected Attributes

Signals signals
 The set of signals.
boost::signals2::signal< NewEventnewEvent
std::vector
< boost::signals2::connection > 
parentRegistrations

Detailed Description

Base class that handles the type-independent (non templated) parts of the signal registration.

Definition at line 52 of file signal.h.


Member Typedef Documentation

typedef void( Datacratic::SignalRegistryBase::NewEvent)(const SignalRegistryBase &, const Info &) [protected]

Subscribe to this to be notified of new events. By doing that, we can subscribe to all of our parents' notifications and thereby add them to our list of notifications.

Definition at line 153 of file signal.h.

typedef SlotDisconnector(* Datacratic::SignalRegistryBase::RegisterFn)(void *thisPtr, const std::type_info &thisType, const std::string &name, const Slot &slotToRegister, int priority, void *data) [protected]

Callback function to register a callback of a given type with a given function.

The void * is actually the this pointer for the owning class. The passed-in thisType parameter gives the type info node for the actual class that this is. Doing things this way allows us to use the internal compiler exception handling machinery to deal with different object types at run-time without requiring anything like a common base class, etc.

The return value should provide a boost::function that can be used to disconnect the slot.

Definition at line 110 of file signal.h.


Constructor & Destructor Documentation

Construct a new signal registry that doesn't inherit signals from anywhere.

Definition at line 42 of file signal.cc.

Construct a new signal registry that inherits signals from the given base class.

Definition at line 47 of file signal.cc.


Member Function Documentation

void Datacratic::SignalRegistryBase::add ( const std::string &  eventName,
const std::type_info &  callbackType,
const std::type_info &  objectType,
RegisterFn  registerFn,
void *  data = 0 
) [protected]

Add the given event to the set of known events.

Definition at line 108 of file signal.cc.

void Datacratic::SignalRegistryBase::addSignal ( const Info signal,
bool  inherited 
) [protected]

Inherit this signal from the other handler. The following are the error conditions: 1. If the same signal is inherited from more than one place; 2. If an inherited signal has a different callback type to the locally registered version.

Definition at line 127 of file signal.cc.

SlotDisconnector Datacratic::SignalRegistryBase::doOn ( const std::string &  name,
void *  object,
const std::type_info &  objectType,
const Slot slot,
int  priority 
) const [protected]

Do the work to actually add a registration.

Definition at line 80 of file signal.cc.

SignalInfo Datacratic::SignalRegistryBase::info ( const std::string &  name) const

Get information about the given signal.

Definition at line 70 of file signal.cc.

Inherit the entire set of signals from the other given signal registry.

Definition at line 94 of file signal.cc.

std::vector< std::string > Datacratic::SignalRegistryBase::names ( ) const

List the names of the signals. Can be used for discovery.

Definition at line 62 of file signal.cc.

template<typename Class >
SlotDisconnector Datacratic::SignalRegistryBase::on ( const std::string &  name,
Class *  object,
const Slot slot,
int  priority = 0 
) const [inline]

Set up for the given object to call the given signal on an event with the given name.

Will throw an exception if the given event isn't found or the class that we're trying to add it for isn't convertible to the class that the event expects.

Definition at line 77 of file signal.h.

size_t Datacratic::SignalRegistryBase::size ( ) const [inline]

Return the number of signals that are registered for this class.

Definition at line 67 of file signal.h.


Member Data Documentation

boost::signals2::signal<NewEvent> Datacratic::SignalRegistryBase::newEvent [protected]

List of events to be notified of.

Definition at line 156 of file signal.h.

std::vector<boost::signals2::connection> Datacratic::SignalRegistryBase::parentRegistrations [protected]

List of registrations to parents.

Definition at line 159 of file signal.h.


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