Bitstream Interpretation Library (BIL)
0.1
|
A registry associating device IDs with their names and vice versa. More...
#include <deviceinfo/DeviceRegistry.hpp>
Public Types | |
typedef std::pair< const DeviceID::ID_t, std::string > | pair_t |
type for contained device ID/name pairs |
Public Member Functions | |
DeviceRegistry () | |
Constructs a new DeviceRegistry instance. | |
void | insert (DeviceID::ID_t deviceID, const std::string &deviceName) |
Copies a ID/name pair into registry. | |
bool | erase (DeviceID::ID_t deviceID) |
Erases a ID/name pair from registry. | |
bool | erase (const std::string &deviceName) |
Erases a ID/name pair from registry. | |
void | clear () |
Erases all ID/name pairs. | |
size_t | size () const |
Gets the number of contained ID/name pairs. | |
const pair_t & | at (size_t index) const |
Gets a device ID/name pair by index read only. | |
std::string | lookup (DeviceID::ID_t deviceID) const |
Looks up a device name by ID. | |
DeviceID::ID_t | lookup (const std::string &deviceName) const |
Looks up a device ID by name. |
Friends | |
void | writeBinary (const DeviceRegistry &data, std::ostream &outputStream) |
Writes data from a DeviceRegistry into a binary stream. | |
void | readBinary (DeviceRegistry &data, std::istream &inputStream) |
Reads data into a DeviceRegistry from a binary stream. |
A registry associating device IDs with their names and vice versa.
Every device has got a device ID and a name. This registry holds pairs of them and allows for lookup by ID and by name.
Definition at line 26 of file DeviceRegistry.hpp.
typedef std::pair<const DeviceID::ID_t, std::string> bil::DeviceRegistry::pair_t |
type for contained device ID/name pairs
Definition at line 82 of file DeviceRegistry.hpp.
DeviceRegistry::DeviceRegistry | ( | ) |
Constructs a new DeviceRegistry instance.
Definition at line 14 of file DeviceRegistry.cpp.
void DeviceRegistry::insert | ( | DeviceID::ID_t | deviceID, |
const std::string & | deviceName | ||
) |
Copies a ID/name pair into registry.
deviceID | ID of the device. |
deviceName | Name of the device. |
. |
Definition at line 20 of file DeviceRegistry.cpp.
bool DeviceRegistry::erase | ( | DeviceID::ID_t | deviceID | ) |
Erases a ID/name pair from registry.
deviceID | ID of the ID/name pair to erase. |
Definition at line 40 of file DeviceRegistry.cpp.
bool DeviceRegistry::erase | ( | const std::string & | deviceName | ) |
Erases a ID/name pair from registry.
deviceName | Name of the ID/name pair to erase. |
Definition at line 56 of file DeviceRegistry.cpp.
void DeviceRegistry::clear | ( | ) |
Erases all ID/name pairs.
Definition at line 72 of file DeviceRegistry.cpp.
size_t DeviceRegistry::size | ( | ) | const |
Gets the number of contained ID/name pairs.
Definition at line 79 of file DeviceRegistry.cpp.
const DeviceRegistry::pair_t & DeviceRegistry::at | ( | size_t | index | ) | const |
Gets a device ID/name pair by index read only.
index | Index of the pair to query. |
. |
Definition at line 85 of file DeviceRegistry.cpp.
std::string DeviceRegistry::lookup | ( | DeviceID::ID_t | deviceID | ) | const |
Looks up a device name by ID.
deviceID | ID to query. |
Definition at line 96 of file DeviceRegistry.cpp.
DeviceID::ID_t DeviceRegistry::lookup | ( | const std::string & | deviceName | ) | const |
Looks up a device ID by name.
deviceName | Name to query. |
Definition at line 106 of file DeviceRegistry.cpp.
|
friend |
Writes data from a DeviceRegistry into a binary stream.
data | The DeviceRegistry to write. |
outputStream | The stream to write into. |
. |
|
friend |
Reads data into a DeviceRegistry from a binary stream.
data | The DeviceRegistry to read into. |
inputStream | The stream to read from. |
. |