ALBA
albaDeviceManager.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: ALBA (Agile Library for Biomedical Applications)
4 Module: albaDeviceManager
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#ifndef __albaDeviceManager_h
17#define __albaDeviceManager_h
18
20#include "albaStorable.h"
21
22#include <list>
23
24//----------------------------------------------------------------------------
25// forward declarations :
26//----------------------------------------------------------------------------
27class albaDevice;
28class albaDeviceSet;
29
52class ALBA_EXPORT albaDeviceManager : public albaAgentEventHandler, public albaStorable
53{
54public:
55 //------------------------------------------------------------------------------
56 // Events
57 //------------------------------------------------------------------------------
60 ALBA_ID_DEC(DISPATCH_START)
63 ALBA_ID_DEC(DISPATCH_END)
64
67
69
72 virtual albaID AddDevice(albaDevice *device);
73
78 virtual albaDevice *AddDevice(const char *type, bool persistent=false);
79
82 int RemoveDevice(albaDevice *device, bool force=false);
84 int RemoveDevice(const char *name, bool force=false);
85
87 albaDevice *GetDevice(const char *name);
88
90 albaDevice *GetDevice(albaID id);
91
93 int GetNumberOfDevices();
94
97 void RemoveAllDevices(bool force=false);
98
100 std::list<albaDevice *> *GetDevices();
101
103 albaDeviceSet *GetDeviceSet() {return m_DeviceSet;}
104
105 virtual void OnEvent(albaEventBase *event);
106
112 virtual bool DispatchEvents();
113protected:
120
121 virtual int InternalInitialize();
122 virtual void InternalShutdown();
123
128
129private:
130 albaDeviceManager(const albaDeviceManager&); // Not implemented.
131 void operator=(const albaDeviceManager&); // Not implemented.
132};
133
134#endif
#define albaTypeMacro(thisClass, superclass)
Macro used by albaObjects for RTTI information.
Definition: albaDefines.h:162
#define ALBA_ID_DEC(idname)
This macros is used to define a new Id and should be placed in a .cpp file.
Definition: albaDefines.h:214
long albaID
type for IDs inside ALBA
Definition: albaDefines.h:58
albaAgentEventHandler - This class synchronizes events with wxWindows event pump.
Class managing the devices inside a ALBA application and the synchronization with wxWindows message p...
virtual int InternalStore(albaStorageElement *node)
Implement storing and restoring of this object.
virtual void InternalShutdown()
to be redefined by subclasses to define the shutdown actions
virtual int InternalRestore(albaStorageElement *node)
This is called by Restore() and must be reimplemented by subclasses The element from which the object...
albaID m_DeviceIdCounter
number of plugged devices
albaDeviceSet * m_DeviceSet
container for first level devices
albaID m_PersistentDeviceIdCounter
number of persistent plugged devices
virtual int InternalInitialize()
This function is overridden by subclasses to perform custom initialization.
virtual void OnEvent(albaEventBase *event)
Process an event: the event is processed immediately and synchronously, i.e.
virtual bool DispatchEvents()
Redefined to manage the synchronization with display rendering: during the event dispatching all rend...
This class manages a set of usb-devices, and stores a list of all child devices' pointers.
Definition: albaDeviceSet.h:39
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
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.