ALBA
albaDeviceSet.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: ALBA (Agile Library for Biomedical Applications)
4 Module: albaDeviceSet
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 __albaDeviceSet_h
17#define __albaDeviceSet_h
18
19#include "albaDevice.h"
20#include <list>
21
22#ifdef ALBA_EXPORTS
23#include "albaDllMacros.h"
24EXPORT_STL_LIST(ALBA_EXPORT,albaDevice *);
25#endif
26
27//----------------------------------------------------------------------------
28// forward declarations :
29//----------------------------------------------------------------------------
30class albaMutexLock;
38class ALBA_EXPORT albaDeviceSet : public albaDevice
39{
40public:
41 //------------------------------------------------------------------------------
42 // Events
43 //------------------------------------------------------------------------------
52 ALBA_ID_DEC(DEVICE_ADDED);
55 ALBA_ID_DEC(DEVICE_REMOVING);
58 //ALBA_ID_DEC(MCH_DEVICE_SETUP);
61 //ALBA_ID_DEC(MCH_DEVICE_SETDOWN);
62
64
66 virtual void AddDevice(albaDevice *device);
67
70
73
75 albaDevice *GetDevice(const char *name);
76
79
81 int RemoveDeviceByIndex(int idx, bool force=false);
82
84 int RemoveDevice(albaID id, bool force=false);
85
87 int RemoveDevice(albaDevice *device, bool force=false);
88
90 int RemoveDevice(const char *name, bool force=false);
91
93 void RemoveAllDevices(bool force=false);
94
96 virtual void OnEvent(albaEventBase *event);
97
99 std::list<albaDevice*> *GetDevices() {return &m_Devices;}
100
101protected:
103 virtual ~albaDeviceSet();
104
107
109 virtual int InternalInitialize();
110
112 virtual void InternalShutdown();
113
114 std::list<albaDevice *> m_Devices;
115
117
118private:
119 albaDeviceSet(const albaDeviceSet&); // Not implemented.
120 void operator=(const albaDeviceSet&); // Not implemented.
121};
122
123#endif
DEVICE_ADD
Definition: albaDecl.h:308
DEVICE_REMOVE
Definition: albaDecl.h:309
long albaID
type for IDs inside ALBA
Definition: albaDefines.h:58
#define EXPORT_STL_LIST(declspec_, T_)
Definition: albaDllMacros.h:87
This class manages a set of usb-devices, and stores a list of all child devices' pointers.
Definition: albaDeviceSet.h:39
int RemoveDevice(albaDevice *device, bool force=false)
Remove a device from the manager's list.
virtual void AddDevice(albaDevice *device)
Add a new device.
virtual ~albaDeviceSet()
albaMutexLock * m_DevicesMutex
virtual int InternalRestore(albaStorageElement *node)
This function fills in the device with settings restored from the node.
int GetNumberOfDevices()
Return the number of devices assigned to this manager.
virtual int InternalInitialize()
Initialization automatically initialize subdevices.
albaDevice * GetDevice(albaID id)
Return a device in the set given its ID.
std::list< albaDevice * > m_Devices
virtual void InternalShutdown()
shutdown also subdevices
void RemoveAllDevices(bool force=false)
Remove all devices (as as RemoveAllSenders())
albaDevice * GetDeviceByIndex(int idx)
Return a device in the set given its ID.
virtual int InternalStore(albaStorageElement *node)
This is used to allow nested serialization of subclasses.
int RemoveDevice(albaID id, bool force=false)
Remove a device from the manager's list given its ID.
int RemoveDeviceByIndex(int idx, bool force=false)
Remove a device from the manager's list given its ID.
std::list< albaDevice * > * GetDevices()
Return the list of devices pluged into this device set.
Definition: albaDeviceSet.h:99
int RemoveDevice(const char *name, bool force=false)
Remove a device from the manager's list given its name.
albaDevice * GetDevice(const char *name)
Return a device in the set given its name.
albaTypeMacro(albaDeviceSet, albaDevice)
New channel for settings.
virtual void OnEvent(albaEventBase *event)
Reimplemented to manage AddDevice event.
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
Critical section locking class that can be allocated on the stack.
Definition: albaMutexLock.h:33
Abstract class representing the interface for the unit of information stored in the storage.
ALBA_ID_DEC(DEVICE_REMOVE)
Remove a device (passed in the Data argument) from this set (to be removed)
ALBA_ID_DEC(DEVICE_ADDED)
Issued when a new device (passed in the Data argument) is added to this set.
ALBA_ID_DEC(DEVICE_REMOVING)
Issued when a device (passed in the Data argument) is being removed from this set.
ALBA_ID_DEC(DEVICE_ADD)
Adds a device (passed in the Data argument) to this set (to be removed)