#include <driverManager.h>
Public Member Functions | |
void | registerDriver (Driver *driver, const std::string &name) |
Registers a new driver to the driver manager. | |
void | registerDriverExtension (DriverExtension *driverEx, const std::string &driverName, const std::string &name) |
Registers a driver extension to a driver. | |
Driver & | getDriverInst (const std::string &name) |
Gets a driver registered by a name. | |
void | initDrivers () |
Runs driver initialization blocks. | |
void | shutdownDrivers () |
Runs driver termination blocks. | |
Static Public Member Functions | |
static Driver & | getDriver (const std::string &name) |
Gets a driver registered by a name. | |
static void | returnDatabase (Database *db) |
A shortcut for Driver::returnDatabase(Database* db). |
Each driver is registered under a name at application startup. A user can later get a reference to a driver by specifying its name when calling the getDriver(const std::string& name) static method.
This class is threadsafe for driver reference retrieval.
void iopc::DriverManager::registerDriver | ( | Driver * | driver, | |
const std::string & | name | |||
) |
Registers a new driver to the driver manager.
This method is called automatically by a Driver::Driver(const std::string& driverName) constructor which is called during static driver initilaization.
driver | A pointer to the driver to be registered (global instance!) | |
name | Name of the driver being registered |
void iopc::DriverManager::registerDriverExtension | ( | DriverExtension * | driverEx, | |
const std::string & | driverName, | |||
const std::string & | name | |||
) |
Registers a driver extension to a driver.
This method is called automatically by a DriverExtension::DriverExtension(const std::string& driverName, const std::string& name) constructior which is called during static driver extension initialization.
driverEx | A pointer to the driver extension to be registered (stored in global variable) | |
driverName | Name of a registered driver which the extension to add to | |
name | Name of the extension being registered |
Driver & iopc::DriverManager::getDriverInst | ( | const std::string & | name | ) |
Gets a driver registered by a name.
name | The driver name |
void iopc::DriverManager::initDrivers | ( | ) |
Runs driver initialization blocks.
This method should be run after static initialization has completed and the main() method has been run. The method is run automatically from IopcDb::init(). The Driver::init(std::map<std::string, DriverExtension*>& extensions) method is called on each registered driver.
void iopc::DriverManager::shutdownDrivers | ( | ) |
Runs driver termination blocks.
This method should be run before exiting the program. The method is run automatically from IopcDb::shutdown(). The Driver::shutdown() method is called on each registered driver.
static Driver& iopc::DriverManager::getDriver | ( | const std::string & | name | ) | [inline, static] |
Gets a driver registered by a name.
name | The driver name |
static void iopc::DriverManager::returnDatabase | ( | Database * | db | ) | [inline, static] |