ALBA
Public Member Functions | Protected Attributes | List of all members
albaObserverCallback Class Reference

#include <albaObserverCallback.h>

Inheritance diagram for albaObserverCallback:
Inheritance graph
[legend]
Collaboration diagram for albaObserverCallback:
Collaboration graph
[legend]

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 albaObjectNewObjectInstance () const =0
 
virtual const albaTypeIDGetTypeId () 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 albaTypeIDGetStaticTypeId ()
 
static albaObjectSafeDownCast (albaObject *o)
 

Detailed Description

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.

See also
albaEventBroadcaster albaObserver
Todo:
  • create a test

Definition at line 37 of file albaObserverCallback.h.

Constructor & Destructor Documentation

◆ albaObserverCallback()

albaObserverCallback::albaObserverCallback ( )

◆ ~albaObserverCallback()

virtual albaObserverCallback::~albaObserverCallback ( )
virtual

Member Function Documentation

◆ albaTypeMacro()

albaObserverCallback::albaTypeMacro ( albaObserverCallback  ,
albaObject   
)

◆ SetCallback()

void albaObserverCallback::SetCallback ( void(*)(void *sender, albaID eid, void *clientdata)  f)

Set function callback to be called by this observer.

◆ SetClientData()

void albaObserverCallback::SetClientData ( void *  cd)

set client data to be passed to callback function

◆ GetClientData()

void * albaObserverCallback::GetClientData ( )

return client data passed to callback function

◆ OnEvent()

virtual void albaObserverCallback::OnEvent ( albaEventBase e)
virtual

process the events sent by subjects

Implements albaObserver.

Member Data Documentation

◆ m_Callback

void(* albaObserverCallback::m_Callback) (void *, albaID, void *)
protected

Definition at line 58 of file albaObserverCallback.h.

◆ m_ClientData

void* albaObserverCallback::m_ClientData
protected

Definition at line 59 of file albaObserverCallback.h.


The documentation for this class was generated from the following file: