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 albaAgent;
31class vtkRenderer;
32
34class ALBA_EXPORT albaAction : public albaAgent, public albaStorable
35{
36public:
39 ALBA_ID_DEC(DEVICE_BIND);
40
42 {
43 SHARED_ACTION = 0,
44 EXCLUSIVE_ACTION
45 };
46
47 typedef std::list<albaAutoPointer<albaDevice> > mmuDeviceList;
48
50
52 int GetType() {return m_Type;}
53 void SetType(int t) {if (t==SHARED_ACTION||t==EXCLUSIVE_ACTION) m_Type=t;}
54 void SetTypeToShared() {SetType(SHARED_ACTION);}
55 void SetTypeToExclusive() {SetType(EXCLUSIVE_ACTION);}
56
58 void BindDevice(albaDevice *device);
59 void UnBindDevice(albaDevice *device);
60
64
66 const mmuDeviceList *GetDevices() {return &m_Devices;}
67
70
73
75 virtual void OnEvent(albaEventBase *event);
76
77protected:
79 virtual ~albaAction();
80
81 int m_Type;
82 std::list<albaAutoPointer<albaDevice> > m_Devices;
83
84private:
85 albaAction(const albaAction&); // Not implemented.
86 void operator=(const albaAction&); // Not implemented.
87};
88
89#endif
Class used to route events from devices to interactors.
Definition: albaAction.h:35
std::list< albaAutoPointer< albaDevice > > m_Devices
Definition: albaAction.h:82
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:81
void SetType(int t)
Definition: albaAction.h:53
void BindInteractor(albaAgent *inter)
Bind/Unbind an interactor to this action.
void UnBindInteractor(albaAgent *inter)
virtual void OnEvent(albaEventBase *event)
Redefined to answer incoming queries about connected devices.
void BindDevice(albaDevice *device)
Bind/Unbind a device to this action.
virtual ~albaAction()
const mmuDeviceList * GetDevices()
Get list of devices assigned to this action.
Definition: albaAction.h:66
void UnBindDevice(albaDevice *device)
int GetType()
Set the type of action.
Definition: albaAction.h:52
void SetTypeToExclusive()
Definition: albaAction.h:55
std::list< albaAutoPointer< albaDevice > > mmuDeviceList
Definition: albaAction.h:47
albaTypeMacro(albaAction, albaAgent)
void SetTypeToShared()
Definition: albaAction.h:54
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:42
Implementation of the message object for the Subject/Observer design pattern.
Definition: albaEventBase.h:49
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)