CARMA C++
|
A lookup class for mapping names and IDs of locations and devices. More...
#include <carma/dbms/PhysicalDeviceIDAuthority.h>
Public Member Functions | |
::std::string | getDevice (const int &deviceID) const |
return the device name for for an ID More... | |
int | getDeviceID (const ::std::string &device) const |
return the ID for a given hardware device name More... | |
::std::string | getLocation (const int &locationID) const |
return the location name for for an ID More... | |
int | getLocationID (const ::std::string &location) const |
return the ID for a given hardware location name More... | |
Static Public Member Functions | |
static void | closeAuthority () |
indicate that one's use of the authority is complete. More... | |
static const PhysicalDeviceIDAuthority & | getAuthority (bool production=false, const dbms::DBConfigurator *dbconf=0) |
get the singleton instance of the PhysicalDeviceIDAuthority. More... | |
::std::string | getDevice (const int &deviceID, bool production, const dbms::DBConfigurator *dbconf) |
static int | getDeviceCount () |
return the number of devices More... | |
static int | getDeviceID (const ::std::string &device, bool production, const dbms::DBConfigurator *dbconf) |
::std::string | getLocation (const int &locationID, bool production, const dbms::DBConfigurator *dbconf) |
static int | getLocationCount () |
return the number of locations More... | |
static int | getLocationID (const ::std::string &location, bool production, const dbms::DBConfigurator *dbconf) |
A lookup class for mapping names and IDs of locations and devices.
This class is instantiated as a singleton via a factory method. The CARMA Database is the authoritative source for location and device names and IDs. However, because the Locations and Devices database tables are initialized using the names and array indices of locationnames and deviceNames of this class this class only needs to use these arrays. Because of this interdependence, IT IS NECESSARY THAT NEW LOCATIONS AND DEVICES ARE ADDED ONLY AT THE END OF locationNames_ and deviceNames_. If this isn't done, loss of database integrity will occur.
Definition at line 39 of file PhysicalDeviceIDAuthority.h.
|
static |
indicate that one's use of the authority is complete.
If we are running in production mode, the singleton instance will be deleted. It is safe to call getAuthority() at anytime before or after this function is called.
|
static |
get the singleton instance of the PhysicalDeviceIDAuthority.
if the instance doesn't already exist, this method will create it if it does exist, this method simply returns the instance
production | use the database to get IDs |
dbconf | DBConfigurator pointer for configuring the db connection, not used if production=false |
::std::string carma::dbms::PhysicalDeviceIDAuthority::getDevice | ( | const int & | deviceID | ) | const |
return the device name for for an ID
deviceID | the deviceID |
NotFoundException | if name is not matched |
|
static |
return the number of devices
Definition at line 189 of file PhysicalDeviceIDAuthority.h.
int carma::dbms::PhysicalDeviceIDAuthority::getDeviceID | ( | const ::std::string & | device | ) | const |
return the ID for a given hardware device name
device | the device name |
NotFoundException | if name is not matched |
::std::string carma::dbms::PhysicalDeviceIDAuthority::getLocation | ( | const int & | locationID | ) | const |
return the location name for for an ID
locationID | the locationID |
NotFoundException | if name is not matched |
|
static |
return the number of locations
Definition at line 182 of file PhysicalDeviceIDAuthority.h.
int carma::dbms::PhysicalDeviceIDAuthority::getLocationID | ( | const ::std::string & | location | ) | const |
return the ID for a given hardware location name
location | the location name |
NotFoundException | if name is not matched |