ALBA
albaAction.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: ALBA (Agile Library for Biomedical Applications)
4 Module: albaAction
5 Authors: Marco Petrone
6
7 Copyright (c) BIC
8 All rights reserved. See Copyright.txt or
9
10
11 This software is distributed WITHOUT ANY WARRANTY; without even
12 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
13 PURPOSE. See the above copyright notice for more information.
14
15=========================================================================*/
16
17#ifndef __albaAction_h
18#define __albaAction_h
19
20#include "albaAgent.h"
21#include "albaStorable.h"
22#include "albaSmartPointer.h"
23#include <list>
24
25//----------------------------------------------------------------------------
26// forward declarations :
27//----------------------------------------------------------------------------
28template <class T> class vtkTemplatedList;
29class albaDevice;
30class albaInteractor;
31class vtkRenderer;
32
34class ALBA_EXPORT albaAction : public albaAgent, public albaStorable
35{
36public:
39 ALBA_ID_DEC(DEVICE_BIND);
40 ALBA_ID_DEC(QUERY_CONNECTED_DEVICES);
41 ALBA_ID_DEC(DEVICE_PLUGGED);
42 ALBA_ID_DEC(DEVICE_UNPLUGGED);
43
45 {
46 SHARED_ACTION = 0,
47 EXCLUSIVE_ACTION
48 };
49
50 typedef std::list<albaAutoPointer<albaDevice> > mmuDeviceList;
51
53
55 int GetType() {return m_Type;}
56 void SetType(int t) {if (t==SHARED_ACTION||t==EXCLUSIVE_ACTION) m_Type=t;}
57 void SetTypeToShared() {SetType(SHARED_ACTION);}
58 void SetTypeToExclusive() {SetType(EXCLUSIVE_ACTION);}
59
61 void BindDevice(albaDevice *device);
62 void UnBindDevice(albaDevice *device);
63
67
69 const mmuDeviceList *GetDevices() {return &m_Devices;}
70
73
76
78 virtual void OnEvent(albaEventBase *event);
79
80protected:
82 virtual ~albaAction();
83
84 int m_Type;
85 std::list<albaAutoPointer<albaDevice> > m_Devices;
86
87private:
88 albaAction(const albaAction&); // Not implemented.
89 void operator=(const albaAction&); // Not implemented.
90};
91
92#endif
Class used to route events from devices to interactors.
Definition: albaAction.h:35
void BindInteractor(albaInteractor *inter)
Bind/Unbind an interactor to this action.
std::list< albaAutoPointer< albaDevice > > m_Devices
Definition: albaAction.h:85
virtual int InternalRestore(albaStorageElement *node)
Restore of action's bindings from an XML file.
virtual int InternalStore(albaStorageElement *node)
Store of action's bindings to an XML file.
int m_Type
Definition: albaAction.h:84
void SetType(int t)
Definition: albaAction.h:56
void UnBindInteractor(albaInteractor *inter)
virtual void OnEvent(albaEventBase *event)
Redefined to answer incoming queries about connected devices.
ALBA_ID_DEC(DEVICE_UNPLUGGED)
Issued by devices when connected to actions or when queried.
void BindDevice(albaDevice *device)
Bind/Unbind a device to this action.
ALBA_ID_DEC(QUERY_CONNECTED_DEVICES)
Issued by interactors to query for connected devices.
virtual ~albaAction()
const mmuDeviceList * GetDevices()
Get list of devices assigned to this action.
Definition: albaAction.h:69
void UnBindDevice(albaDevice *device)
int GetType()
Set the type of action.
Definition: albaAction.h:55
void SetTypeToExclusive()
Definition: albaAction.h:58
ALBA_ID_DEC(DEVICE_PLUGGED)
Issued by devices when connected to actions or when queried.
std::list< albaAutoPointer< albaDevice > > mmuDeviceList
Definition: albaAction.h:50
albaTypeMacro(albaAction, albaAgent)
void SetTypeToShared()
Definition: albaAction.h:57
An agent is a computational object with a default I/O interface.
Definition: albaAgent.h:50
This abstract class manages function calls coming from devices and issue specific events to interacto...
Definition: albaDevice.h:40
Implementation of the message object for the Subject/Observer design pattern.
Definition: albaEventBase.h:49
Abstract class for ALBA interactors This class provides base interface and features of ALBA continuou...
albaStorable is an interface for serializable objects.
Definition: albaStorable.h:41
Abstract class representing the interface for the unit of information stored in the storage.
ALBA_ID_DEC(DEVICE_BIND)