ALBA
|
#include <albaObserverCallback.h>
Public Member Functions | |
albaObserverCallback () | |
virtual | ~albaObserverCallback () |
albaTypeMacro (albaObserverCallback, albaObject) | |
void | SetCallback (void(*f)(void *sender, albaID eid, void *clientdata)) |
void | SetClientData (void *cd) |
void * | GetClientData () |
virtual void | OnEvent (albaEventBase *e) |
Public Member Functions inherited from albaObject | |
albaObject () | |
virtual | ~albaObject () |
virtual void | Delete () |
virtual const char * | GetTypeName () const |
virtual bool | IsA (const char *type_name) const |
virtual bool | IsA (const albaTypeID &type_id) const |
virtual albaObject * | NewObjectInstance () const =0 |
virtual const albaTypeID & | GetTypeId () const |
virtual void | Print (std::ostream &os, const int indent=0) const |
albaObject (const albaObject &c) | |
Public Member Functions inherited from albaObserver | |
albaObserver () | |
virtual | ~albaObserver () |
virtual void | OnEvent (albaEventBase *e)=0 |
Protected Attributes | |
void(* | m_Callback )(void *, albaID, void *) |
void * | m_ClientData |
Protected Attributes inherited from albaObject | |
bool | m_HeapFlag |
Additional Inherited Members | |
Static Public Member Functions inherited from albaObject | |
static const char * | GetStaticTypeName () |
static bool | IsStaticType (const char *type_name) |
static bool | IsStaticType (const albaTypeID &type_id) |
static const albaTypeID & | GetStaticTypeId () |
static albaObject * | SafeDownCast (albaObject *o) |
Concrete implementation of Observer calling a callback function.
albaObserverCallback is a class implementing an "observer" that launches a callback function. It's useful for attaching as observers objects that do not inherit from albaObserver. When an event is rise the callback function is called passing as argument some event content plus event source Data and this class ClientData, that can be set to any value. Usually ClientData is used to store the (self) pointer of the class to whom the callback function belongs.
Definition at line 37 of file albaObserverCallback.h.
albaObserverCallback::albaObserverCallback | ( | ) |
|
virtual |
albaObserverCallback::albaTypeMacro | ( | albaObserverCallback | , |
albaObject | |||
) |
void albaObserverCallback::SetCallback | ( | void(*)(void *sender, albaID eid, void *clientdata) | f | ) |
Set function callback to be called by this observer.
void albaObserverCallback::SetClientData | ( | void * | cd | ) |
set client data to be passed to callback function
void * albaObserverCallback::GetClientData | ( | ) |
return client data passed to callback function
|
virtual |
process the events sent by subjects
Implements albaObserver.
|
protected |
Definition at line 58 of file albaObserverCallback.h.
|
protected |
Definition at line 59 of file albaObserverCallback.h.