Class used as a database for all device & service related information.
Public Methods
-
CDeviceStorage* GetInstance()
- Getter to the singleton instance of the class.
-
CDeviceStorage()
- Default constructor, initilizes the mutex used for thread-safety. values.
-
void Update(const char* aProto, const std::list<CDaemonDevice* >& aList)
- Updates the list of devices.
-
void Lock()
- Locks the internal thread-safety mutex.
-
void Unlock()
- Unlocks the internal thread-safety mutex.
-
TDEVICE_ITERATOR FirstDevice()
- Returns an iterator to the first device.
-
TDEVICE_ITERATOR LastDevice()
- Returns an iterator to the last device.
-
void ReleaseDeviceList()
- Releases database's internal lock.
-
const TDEVICE_LIST GetDeviceList()
- Returns a list containing all devices in the database.
Documentation
Class used as a database for all device & service related information.
Every device is stored as a MAbstractDevice object and services of the
device are stored in that object. The implementation of this class follows
the singleton design pattern so at any given moment of time there should
exist only one instance of this class. Note that this class is thread-safe.
CDeviceStorage* GetInstance()
-
Getter to the singleton instance of the class. If an old instance
exists then it is returned. Otherwise a new instance is created and
returned. This function follows the idea of the singleton design pattern.
- Returns:
- me, myself and I (e.i. pointer to the singleton instance of the class)
CDeviceStorage()
-
Default constructor, initializes the internal mutex used for
thread-safety.
- Returns:
- none
void Update(const char* aProto, const std::list<CDaemonDevice* >& aList)
-
Updates the internal list of devices. First, every device whose id
matches the given id is removed from the list. Then every device in the list
given as a parameter is added to the internal list using the copy
constructor of the device class.
- Parameters:
- aProto - Prototype id of the devices to be updated.
aList - List of the devices to be updated.
- Returns:
- none
void Lock()
-
Locks the internal thread-safety mutex.
- Returns:
- none
void Unlock()
-
Unlocks the internal thread-safety mutex.
- Returns:
- none
TDEVICE_ITERATOR FirstDevice()
-
Returns an iterator to the first device. <b>Database's internal lock is
set within this function so the <code>ReleaseDeviceLock</code> must be
called also!</b>
- Returns:
- iterator pointing to the first device in the database
TDEVICE_ITERATOR LastDevice()
-
Returns an iterator to the last device.
- Returns:
- iterator pointing to the last device in the database
void ReleaseDeviceList()
-
Releases database's internal lock. After this call is completed, new
commits to the database can be made.
- Returns:
- none
const TDEVICE_LIST GetDeviceList()
-
Returns a list containing all devices in the database. <b>Database's
internal lock is set within this function so the <code>ReleaseDeviceList
</code> must be called when the list is no longer used!</b>
- Returns:
- list containing all devices in the database
- This class has no child classes.
- See Also:
- MAbstractDevice
Alphabetic index HTML hierarchy of classes or Java
This page was generated with the help of DOC++.