ALBA
|
#include <albaAgent.h>
Public Member Functions | |
albaAbstractTypeMacro (albaAgent, albaReferenceCounted) | |
ALBA_ID_DEC (AGENT_INITIALIZE) | |
void | AddObserver (albaObserver *listener, albaID channel=MCH_UP) |
void | RemoveObserver (albaObserver *listener) |
void | RemoveAllObservers () |
virtual void | OnEvent (albaEventBase *event) |
bool | HasObservers (albaID channel) |
void | GetObservers (albaID channel, std::vector< albaObserver * > &olist) |
int | Initialize () |
void | Shutdown () |
int | IsInitialized () |
virtual void | SetName (const char *name) |
const char * | GetName () |
Public Member Functions inherited from albaReferenceCounted | |
albaReferenceCounted () | |
virtual | ~albaReferenceCounted () |
albaAbstractTypeMacro (albaReferenceCounted, albaObject) | |
virtual void | Delete () |
void | Register (void *obj) |
virtual void | UnRegister (void *obj) |
int | GetReferenceCount () |
void | SetReferenceCount (int) |
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 |
Public Member Functions inherited from albaEventBroadcaster | |
albaEventBroadcaster (void *owner=NULL) | |
virtual | ~albaEventBroadcaster () |
albaEventBroadcaster (const albaEventBroadcaster &c) | |
void | AddObserver (albaObserver *obj) |
void | AddObserver (albaObserver &obj) |
albaObserverCallback * | AddObserverCallback (void(*f)(void *sender, albaID eid, void *clientdata, void *calldata)) |
bool | RemoveObserver (albaObserver *obj) |
void | RemoveAllObservers () |
bool | IsObserver (albaObserver *obj) |
bool | HasObservers () |
void | GetObservers (std::vector< albaObserver * > &olist) |
void | InvokeEvent (albaEventBase &e) |
void | InvokeEvent (albaEventBase *e) |
void | InvokeEvent (void *sender, albaID id=ID_NO_EVENT, void *data=NULL) |
void | SetChannel (albaID ch) |
albaID | GetChannel () |
virtual void | SetListener (albaObserver *o) |
Public Member Functions inherited from albaEventSender | |
albaEventSender () | |
virtual void | SetListener (albaObserver *o) |
virtual albaObserver * | GetListener () |
virtual bool | HasListener () |
virtual void | InvokeEvent (albaEventBase &e) |
virtual void | InvokeEvent (albaEventBase *e) |
virtual void | InvokeEvent (void *sender, albaID id=ID_NO_EVENT, void *data=NULL) |
Protected Member Functions | |
albaAgent () | |
virtual | ~albaAgent () |
virtual int | InternalInitialize () |
virtual void | InternalShutdown () |
void | InvokeEvent (albaEventBase &event, albaID channel=-1) |
void | InvokeEvent (albaEventBase *event, albaID channel=-1) |
void | InvokeEvent (void *sender, int id, albaID channel=MCH_UP, void *data=NULL) |
Protected Attributes | |
albaString | m_Name |
bool | m_Initialized |
std::vector< albaEventBroadcaster * > | m_Channels |
Protected Attributes inherited from albaReferenceCounted | |
int | m_ReferenceCount |
Protected Attributes inherited from albaObject | |
bool | m_HeapFlag |
Protected Attributes inherited from albaEventBroadcaster | |
albaObserversList | m_Observers |
albaID | m_Channel |
Protected Attributes inherited from albaEventSender | |
albaObserver * | m_Listener |
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) |
Protected Types inherited from albaEventBroadcaster | |
typedef std::list< albaObserver * > | albaObserversList |
An agent is a computational object with a default I/O interface.
An agent is a computational object with a conventional events I/O interface, processing its input events, taking some action and producing output events toward other agents. An agent is a albaObserver, thus an object able to listen to ALBA events coming from other objects and extends the idea of channels keeping an internal dynamic array of channels: this was an agent can be attached as observer of events on any channel of other events, allowing the creation of a network of agents. This class support also bridging of events coming from VTK: a albaAgent can be set as observer of VTK events which are tunneled inside ALBA events.
Definition at line 49 of file albaAgent.h.
|
protected |
|
protectedvirtual |
albaAgent::albaAbstractTypeMacro | ( | albaAgent | , |
albaReferenceCounted | |||
) |
void albaAgent::AddObserver | ( | albaObserver * | listener, |
albaID | channel = MCH_UP |
||
) |
Attach/Detach this object as event source for the specified listener.
If the specified channel is the MCH_UP, the SetListener(listener) is called. For all other channel more then one listener can be specified, and a broad cast using the VTK Subject/Observer is performed. UnPlugListener works for all channels at the same time. NULL listeners are ignored.
void albaAgent::RemoveObserver | ( | albaObserver * | listener | ) |
void albaAgent::RemoveAllObservers | ( | ) |
|
virtual |
Process an event: the event is processed immediately and synchronously, i.e.
the function doesn't return until the event is processed by someone. If the class cannot manage the event it is passed to its listeners on the same channel and so on, until it's processed.
Implements albaObserver.
Reimplemented in albaAction, albaAgentThreaded, albaAvatar, albaAvatar2D, albaAvatar3D, albaDevice, albaDeviceButtonsPadMouse, albaDeviceButtonsPadTracker, albaDeviceManager, albaDeviceSet, albaInteractor, albaInteractor2DDistance, albaInteractor2DMeasure, albaInteractor6DOFCameraMove, albaInteractorCameraMove, albaInteractorCameraPicker, albaInteractorCompositorMouse, albaInteractorCompositorMouseFloatVME, albaInteractorDICOMImporter, albaInteractorGeneric6DOF, albaInteractorPER, albaInteractorPERBrushFeedback, albaInteractorPERScalarInformation, albaInteractorPicker, albaInteractorSegmentationPicker, albaInteractorSlider, and mmiInfoImage.
bool albaAgent::HasObservers | ( | albaID | channel | ) |
return true if there's an observer on the specified channel.
(noarg == MCH_UP)
void albaAgent::GetObservers | ( | albaID | channel, |
std::vector< albaObserver * > & | olist | ||
) |
return a list of the observers on a channel
int albaAgent::Initialize | ( | ) |
Initialize this agent.
Subclasses can redefine InternalInitialize() to customize the initialization.
void albaAgent::Shutdown | ( | ) |
Shutdown the agent, Subclasses can redefine InternalShutdown() to customize actions for shutting down.
|
inline |
Return true if this agent has been initialized.
Definition at line 95 of file albaAgent.h.
Referenced by albaAgentThreaded::Update().
|
inlinevirtual |
The Agent name is used to identify the Agent in a unique way.
Reimplemented in albaDevice.
Definition at line 99 of file albaAgent.h.
|
inline |
Definition at line 100 of file albaAgent.h.
|
inlineprotectedvirtual |
This function is overridden by subclasses to perform custom initialization.
Reimplemented in albaAgentThreaded, albaAvatar, albaAvatar3D, albaDevice, albaDeviceButtonsPadTracker, albaDeviceButtonsPadTrackerP5Glove, albaDeviceManager, albaDeviceSet, and albaDeviceTrackerWIIMote.
Definition at line 108 of file albaAgent.h.
|
inlineprotectedvirtual |
to be redefined by subclasses to define the shutdown actions
Reimplemented in albaAgentThreaded, albaAvatar, albaAvatar3D, albaDeviceButtonsPadTracker, albaDeviceButtonsPadTrackerP5Glove, albaDeviceManager, albaDeviceSet, and albaDeviceTrackerWIIMote.
Definition at line 111 of file albaAgent.h.
|
protected |
This function make an event to be passed to observers of this class for the specified channel.
In case of MCH_UP the message is passed to the object pointed by the "m_Listener" member variable, otherwise the event is broadcasted by means of the Subject/Observer on the specified channel.
|
protected |
|
protected |
|
protected |
Definition at line 128 of file albaAgent.h.
|
protected |
Definition at line 129 of file albaAgent.h.
|
protected |
Definition at line 131 of file albaAgent.h.