ALBA
|
#include <albaEventBroadcaster.h>
Protected Types | |
typedef std::list< albaObserver * > | albaObserversList |
Protected Attributes | |
albaObserversList | m_Observers |
albaID | m_Channel |
Protected Attributes inherited from albaEventSender | |
albaObserver * | m_Listener |
This class inerith form albaEventSender and extends albaEventSender with the capacity of send events to multiple objects.
Set/Get listener are overridded, when you call set listener you also remove all other observers and get listener returns the first observer on the list. albaEventBroadcaster is a class implementing the "subject" in the Subject/Observer design pattern. Objective of this object is to generate events to be sent to observers. An observer must be registered to a subject to create the communication channel between the two.
Definition at line 46 of file albaEventBroadcaster.h.
|
protected |
Definition at line 104 of file albaEventBroadcaster.h.
albaEventBroadcaster::albaEventBroadcaster | ( | void * | owner = NULL | ) |
|
virtual |
|
inline |
Definition at line 52 of file albaEventBroadcaster.h.
void albaEventBroadcaster::AddObserver | ( | albaObserver * | obj | ) |
Register an observer of this subject.
void albaEventBroadcaster::AddObserver | ( | albaObserver & | obj | ) |
Register an observer of this subject.
albaObserverCallback * albaEventBroadcaster::AddObserverCallback | ( | void(*)(void *sender, albaID eid, void *clientdata, void *calldata) | f | ) |
Add as observer a callback function.
This function returns
pointer to an observer object that must be deleted by consumer after having detached it from the event source
bool albaEventBroadcaster::RemoveObserver | ( | albaObserver * | obj | ) |
Unregister an observer.
Return false if object is not an observer
void albaEventBroadcaster::RemoveAllObservers | ( | ) |
remove all observers at once
bool albaEventBroadcaster::IsObserver | ( | albaObserver * | obj | ) |
return true if object is an observer of this subject
bool albaEventBroadcaster::HasObservers | ( | ) |
return true if this class has observers
void albaEventBroadcaster::GetObservers | ( | std::vector< albaObserver * > & | olist | ) |
return a vector with the list of observers of this event source
|
virtual |
invoke an event of this subject
Reimplemented from albaEventSender.
|
virtual |
invoke an event of this subject
Reimplemented from albaEventSender.
|
virtual |
invoke an event of this subject
Reimplemented from albaEventSender.
void albaEventBroadcaster::SetChannel | ( | albaID | ch | ) |
set the channel Id assigned to this event source.
If set to <0 no channel is assigned
albaID albaEventBroadcaster::GetChannel | ( | ) |
return the channel assigned to this event source.
If <0 no channel has been assigned
|
virtual |
Removes all the observer and add o to the observer list.
Reimplemented from albaEventSender.
|
protected |
list of observers
Definition at line 106 of file albaEventBroadcaster.h.
|
protected |
a channel assigned to this event source, if <0 no channel is assigned
Definition at line 107 of file albaEventBroadcaster.h.