![]() |
VR-Forces Developer's Guide
|
The base class for all database connections. The database connection is responsible for reading queued up events from the database logger, and then recording those events to the connected database. This is normally done by a dedicated thread that is launched during initialization.
By default the DtVrfNoDatabaseConnection will be created, which does not connect to any database. VR-Forces can be configured to create a DtVrfSqliteDatabaseConnection instead, which will open and write to an SQLite database. Other database implementations could be added via plugins. The database connection used can be configured in appData/settings/databaseConfig.mtl.

Public Member Functions | |
| virtual | ~DtVrfDatabaseConnection () |
| virtual bool | initialize (const DtRwDatabaseLoggerConfig &config, DtVrfDatabaseLoggerInterface *dbLogger) |
| virtual void | run () |
Protected Member Functions | |
| DtVrfDatabaseConnection () | |
| virtual bool | processConfiguration (const DtRwDatabaseLoggerConfig &config) |
| virtual bool | connect ()=0 |
| virtual bool | createDatabase ()=0 |
| virtual bool | stop () |
| virtual bool | createTableForEvent (const DtVrfDatabaseEvent &event)=0 |
| virtual bool | insertOrIgnoreEntriesForEvents (const DtVrfDatabaseEventVector &events)=0 |
| virtual bool | insertOrUpdateEntriesForEvents (const DtVrfDatabaseEventVector &events)=0 |
| virtual bool | updateEntryForEvent (const DtVrfDatabaseEvent &event)=0 |
Protected Attributes | |
| DtVrfDatabaseLoggerInterface * | myDatabaseLogger |
| double | myLogPeriod |
| std::vector< bool > | myCreatedTables |
| std::atomic< bool > | myTimeToStop |
| std::atomic< bool > | myStopped |
| LogToDatabaseTask * | myTask |
Private Member Functions | |
| DtVrfDatabaseConnection (const DtVrfDatabaseConnection &other) | |
| DtVrfDatabaseConnection & | operator= (const DtVrfDatabaseConnection &other) |
|
virtual |
Destructor.
|
protected |
Constructor.
|
private |
Copy Constructor not implemented – Do Not copy.
|
virtual |
Initializes the connection to the database server. Stores the database logger pointer and calls processConfiguration(), connect(), and createDatabase().
|
virtual |
The main processing loop executed by the connection thread. This function will loop until the connection is stopped.
|
protectedvirtual |
Processes the configuration for this connection.
Reimplemented in DtVrfNoDatabaseConnection, and DtVrfSqliteDatabaseConnection.
|
protectedpure virtual |
Connects to the configured server.
Implemented in DtVrfNoDatabaseConnection, and DtVrfSqliteDatabaseConnection.
|
protectedpure virtual |
Creates the database.
Implemented in DtVrfNoDatabaseConnection, and DtVrfSqliteDatabaseConnection.
|
protectedvirtual |
Stops the thread.
|
protectedpure virtual |
Creates a table a database table, if necessary.
Implemented in DtVrfNoDatabaseConnection, and DtVrfSqliteDatabaseConnection.
|
protectedpure virtual |
Logs the given events to the database, ignoring duplicates. NOTE: All events in the list must be of the same event type!
Implemented in DtVrfNoDatabaseConnection, and DtVrfSqliteDatabaseConnection.
|
protectedpure virtual |
Logs the given events to the database, updating duplicates. NOTE: All events in the list must be of the same event type!
Implemented in DtVrfNoDatabaseConnection, and DtVrfSqliteDatabaseConnection.
|
protectedpure virtual |
Updates the given event in the database.
Implemented in DtVrfNoDatabaseConnection, and DtVrfSqliteDatabaseConnection.
|
private |
Assignment Operator not implemented – Do Not copy.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |