class CDeviceStorage

Class used as a database for all device & service related information.

Public Methods

[more]CDeviceStorage* GetInstance()
Getter to the singleton instance of the class.
[more] CDeviceStorage()
Default constructor, initilizes the mutex used for thread-safety. values.
[more]void Update(const char* aProto, const std::list<CDaemonDevice* >& aList)
Updates the list of devices.
[more]void Lock()
Locks the internal thread-safety mutex.
[more]void Unlock()
Unlocks the internal thread-safety mutex.
[more]TDEVICE_ITERATOR FirstDevice()
Returns an iterator to the first device.
[more]TDEVICE_ITERATOR LastDevice()
Returns an iterator to the last device.
[more]void ReleaseDeviceList()
Releases database's internal lock.
[more]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.

oCDeviceStorage* 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)

o CDeviceStorage()
Default constructor, initializes the internal mutex used for thread-safety.

Returns:
none

ovoid 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

ovoid Lock()
Locks the internal thread-safety mutex.

Returns:
none

ovoid Unlock()
Unlocks the internal thread-safety mutex.

Returns:
none

oTDEVICE_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

oTDEVICE_ITERATOR LastDevice()
Returns an iterator to the last device.

Returns:
iterator pointing to the last device in the database

ovoid ReleaseDeviceList()
Releases database's internal lock. After this call is completed, new commits to the database can be made.

Returns:
none

oconst 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++.