Lomse library. API documentation  0.30.0
Observer Class Reference

#include <lomse_events.h>

Detailed Description

Auxiliary object responsible for keeping information about an Observable object being observed, the events to listen to and the methods that must invoke to dispatch each event. It is also responsible for doing this dispatch when requested.

Public Member Functions

virtual ~Observer ()
 
Observabletarget ()
 
void notify (SpEventInfo pEvent)
 
void remove_handler (int evtType)
 
int get_observable_type ()
 
void add_handler (int eventType, void(*pt2Func)(SpEventInfo event))
 
void add_handler (int eventType, void *pThis, void(*pt2Func)(void *pObj, SpEventInfo event))
 
void add_handler (int eventType, EventHandler *pHandler)
 
void add_handler (int eventType, int childType, ImoId childId, EventHandler *pHandler)
 

Friends

class EventNotifier
 

Constructor & Destructor Documentation

◆ ~Observer()

virtual Observer::~Observer ( )
virtual

Destructor.

Member Function Documentation

◆ add_handler() [1/4]

void Observer::add_handler ( int  eventType,
void(*)(SpEventInfo event)  pt2Func 
)

Register to receive notifications from this Observer.

◆ add_handler() [2/4]

void Observer::add_handler ( int  eventType,
void *  pThis,
void(*)(void *pObj, SpEventInfo event)  pt2Func 
)

Register to receive notifications from this Observer.

◆ add_handler() [3/4]

void Observer::add_handler ( int  eventType,
EventHandler pHandler 
)

Register to receive notifications from this Observer.

◆ add_handler() [4/4]

void Observer::add_handler ( int  eventType,
int  childType,
ImoId  childId,
EventHandler pHandler 
)

Register to receive notifications from this Observer.

◆ get_observable_type()

int Observer::get_observable_type ( )
inline

Returns the type of the observed event generator object.

◆ notify()

void Observer::notify ( SpEventInfo  pEvent)

Notify the event pEvent to all registered objects observing events of the same type than pEvent type.

◆ remove_handler()

void Observer::remove_handler ( int  evtType)

Remove a registered handler so that in future it will not be notified of new events.

◆ target()

Observable* Observer::target ( )

Returns the event generator object that is being observed by this Observer.