Inheritance diagram for GWE::GStorage:


Public Member Functions | |
| GStorage (QObject *parent=0) | |
| virtual | ~GStorage () |
| void | setDatabaseDriver (QString driver) |
| void | setDatabaseName (QString connection) |
| void | setDatabaseHost (QString host) |
| void | setDatabasePort (int port) |
| void | setDatabaseUser (QString user) |
| void | setDatabasePassword (QString password) |
| void | setDatabase (QString driver, QString name, QString user, QString password, QString host="", int port=0) |
| bool | connectDatabase () |
| bool | isDatabaseConnected () |
| bool | initializeDatabase () |
| bool | disconnectDatabase () |
| QString | getLastDatabaseError () |
| QStringList | getAllElementOwners () throw (GStorageException) |
| QStringList | getAllServers () throw (GStorageException) |
| bool | getServerExists (const QString &server) throw (GStorageException) |
| QStringList | getServersForElementChildren (const GCS::GElementID &parent) throw (GStorageException) |
| QList< GCS::GElementID > | getElementsForServer (const QString &server) throw (GStorageException) |
| QString | getManagingServerForElement (const GCS::GElementID &id) throw (GStorageException) |
| QString | getServerPresence (const QString &server) throw (GStorageException) |
| QStringList | getServersSubscribedToElementUpdates (const GCS::GElementID &id) throw (GStorageException) |
| QStringList | getServersSubscribedToDataUpdates (const GCS::GElementID &id) throw (GStorageException) |
| QStringList | getServersSubscribedToEnergyUpdates (const GCS::GElementID &id) throw (GStorageException) |
| QStringList | getServersSubscribedToFormUpdates (const GCS::GElementID &id) throw (GStorageException) |
| void | addServer (const QString &server, const QString &presence) throw (GStorageException) |
| void | updateServerPresence (const QString &server, const QString &presence) throw (GStorageException) |
| void | removeServer (const QString &server) throw (GStorageException) |
| void | setSubscription (const GCS::GElementID &element, const QString &server, const QString &type) throw (GStorageException) |
| void | clearSubscription (const GCS::GElementID &element, const QString &server, const QString &type) throw (GStorageException) |
| void | updateManagingServer (const GCS::GElementID &element, const QString &new_server) throw (GStorageException) |
| bool | getElementExists (const GCS::GElementID &id) throw (GStorageException) |
| QList< GCS::GElementID > | getAllElementIDs () throw (GStorageException) |
| QList< GCS::GElementID > | getAllElementIDsByServer (const QString &managing_server) throw (GStorageException) |
| GCS::GElement * | getElement (const GCS::GElementID &id, const GCS::GWorldData *data) throw (GStorageException) |
| QList< GCS::GElement * > | getElements (QList< GCS::GElementID > id_list, const GCS::GWorldData *worlddata) throw (GStorageException) |
| GCS::GElementData * | getElementData (const GCS::GElementID &id) throw (GStorageException) |
| GCS::GEnergy * | getElementEnergy (const GCS::GElementID &id) throw (GStorageException) |
| GCS::GForm * | getElementForm (const GCS::GElementID &id) throw (GStorageException) |
| QList< GCS::GElementID > | getChildren (const GCS::GElementID &id) throw (GStorageException) |
| GCS::GElementID | getParent (const GCS::GElementID &id) throw (GStorageException) |
| QStringList | getElementAgents (const GCS::GElementID &id) throw (GStorageException) |
| GCS::GElementID | getConnection (const GCS::GElementID &id) throw (GStorageException) |
| QStringList | getAllAgents () throw (GStorageException) |
| QString | getAgent (const QString &agent) throw (GStorageException) |
| void | addElement (const GCS::GElement *element, const QString &managing_server) throw (GStorageException) |
| void | updateElement (const GCS::GElement *element) throw (GStorageException) |
| void | removeElement (const GCS::GElementID &id) throw (GStorageException) |
| void | removeElements (QList< GCS::GElementID > id_list) throw (GStorageException) |
| void | reparentElement (const GCS::GElementID &element, const GCS::GElementID &old_parent, const GCS::GElementID &new_parent) throw (GStorageException) |
| void | changeConnection (const GCS::GElementID &element, const GCS::GElementID &connection) throw (GStorageException) |
| void | addElementAgent (const GCS::GElementID &element, const QString &agent) throw (GStorageException) |
| void | removeElementAgent (const GCS::GElementID &element, const QString &agent) throw (GStorageException) |
| QStringList | removeAllElementAgents (const GCS::GElementID &element) throw (GStorageException) |
| QList< GCS::GElementID > | removeAgentFromAllElements (const QString &agent) throw (GStorageException) |
| void | updateElementData (const GCS::GElementID &element, const GCS::GElementData *data) throw (GStorageException) |
| void | updateEnergy (const GCS::GElementID &element, const GCS::GEnergy *energy) throw (GStorageException) |
| void | updateForm (const GCS::GElementID &element, const GCS::GForm *form) throw (GStorageException) |
| void | removeAllAgents () throw (GStorageException) |
| void | addAgent (const QString &agent) throw (GStorageException) |
| void | removeAgent (const QString &agent) throw (GStorageException) |
Protected Member Functions | |
| GCS::GVector3 | getVector3 (unsigned long id) throw (GStorageException) |
Protected Attributes | |
| QSqlDatabase | Database |
| QString | DbDriver |
| QString | DbName |
| QString | DbHost |
| int | DbPort |
| QString | DbUser |
| QString | DbPassword |
GStorage* storage = new GStorage(); storage->setDatabase("QSQLITE",":memory:","user","password"); storage->connectDatabase(); //returns false on failure storage->initializeDatabase(); //returns false on failure GXmlDataController* dc = new GXmlDataController(storage,network);
Please consult the G System Architecture for the DB layout.
reuse existing database on init, see GXmlDataController to init with existing elements
| GWE::GStorage::GStorage | ( | QObject * | parent = 0 |
) |
Constructor.
| GWE::GStorage::~GStorage | ( | ) | [virtual] |
Destructor.
| void GWE::GStorage::addServer | ( | const QString & | server, | |
| const QString & | presence | |||
| ) | throw (GStorageException) |
A new server is added on registration.
| void GWE::GStorage::clearSubscription | ( | const GCS::GElementID & | element, | |
| const QString & | server, | |||
| const QString & | type | |||
| ) | throw (GStorageException) |
| type | must be either element, data, energy or form |
| bool GWE::GStorage::connectDatabase | ( | ) |
Connects to database. You must set all database parameters before connecting.
| bool GWE::GStorage::disconnectDatabase | ( | ) |
Disconnects from database.
| QString GWE::GStorage::getAgent | ( | const QString & | agent | ) | throw (GStorageException) |
| QStringList GWE::GStorage::getAllElementOwners | ( | ) | throw (GStorageException) |
| GCS::GElement * GWE::GStorage::getElement | ( | const GCS::GElementID & | id, | |
| const GCS::GWorldData * | data | |||
| ) | throw (GStorageException) |
| data | pointer to the used data controller, like the GXmlDataController |
| QString GWE::GStorage::getLastDatabaseError | ( | ) |
| bool GWE::GStorage::initializeDatabase | ( | ) |
Creates all tables, ... You must connect to the database before initializing.
| bool GWE::GStorage::isDatabaseConnected | ( | ) |
| void GWE::GStorage::removeAgent | ( | const QString & | agent | ) | throw (GStorageException) |
| QList< GCS::GElementID > GWE::GStorage::removeAgentFromAllElements | ( | const QString & | agent | ) | throw (GStorageException) |
| QStringList GWE::GStorage::removeAllElementAgents | ( | const GCS::GElementID & | element | ) | throw (GStorageException) |
| void GWE::GStorage::removeServer | ( | const QString & | server | ) | throw (GStorageException) |
Also removes all associated subscriptions of course. A server is generally removed when it unregisters.
| void GWE::GStorage::setDatabase | ( | QString | driver, | |
| QString | name, | |||
| QString | user, | |||
| QString | password, | |||
| QString | host = "", |
|||
| int | port = 0 | |||
| ) |
Set all database parameters at once.
| void GWE::GStorage::setDatabaseDriver | ( | QString | driver | ) |
Sets the database type or driver to use. You can get all available drivers with QSqlDatabase::drivers().
| void GWE::GStorage::setDatabaseHost | ( | QString | host | ) |
Sets the host where the DBMS is running. Leave empty for local connections.
| void GWE::GStorage::setDatabaseName | ( | QString | connection | ) |
Set the actual database connection string. The form of the string usually differs depending on the database driver that is used.
| void GWE::GStorage::setDatabasePassword | ( | QString | password | ) |
Set the user's password.
| void GWE::GStorage::setDatabasePort | ( | int | port | ) |
Sets the port on which the DBMS is listening. Leave empty or set to 0 for the default port.
| void GWE::GStorage::setDatabaseUser | ( | QString | user | ) |
Set the user with which to connect to the database.
| void GWE::GStorage::setSubscription | ( | const GCS::GElementID & | element, | |
| const QString & | server, | |||
| const QString & | type | |||
| ) | throw (GStorageException) |
| type | must be either element, data, energy or form |
QSqlDatabase GWE::GStorage::Database [protected] |
The database itself.
QString GWE::GStorage::DbDriver [protected] |
The database type or driver.
QString GWE::GStorage::DbHost [protected] |
The host where the DBMS is running. If no host is given, a local connection is used.
QString GWE::GStorage::DbName [protected] |
The database name.
QString GWE::GStorage::DbPassword [protected] |
The database password.
int GWE::GStorage::DbPort [protected] |
The port on which the DBMS is listening. If the port is set to 0 (the default) then the default port of the database driver is used instead.
QString GWE::GStorage::DbUser [protected] |
The database user.
1.4.7