![]() |
VR-Forces Developer's Guide
|
The standard database logger used in VRF. The database logger is responsible for logging database events internally. It does this using a concurrent queue. Whenever a database event is logged, it is added to the queue. A separate database connection is responsible for popping events from the queue and recording them in the database.
All event logging should be done by calling the logEvent() funtions. These are designed to be as efficient as possible, as event logging should not be a serious performance impact to the simulation threads. Popping events from the queue, using popeEvent(), may be less efficient, as the database connection thread is not as performance critical.
Each piece of data that should be recorded to the database is stored in a DtVrfDatabaseEvent. For a list of the default events supported by VR-Forces, please see VR-Forces Database Events.

Public Member Functions | |
| virtual | ~DtVrfDatabaseLogger () override |
| virtual void | initialize (const DtRwDatabaseLoggerConfig &config, const DtSimulationAddress &simAddress, std::unique_ptr< DtVrfDatabaseConnection > conn) override |
| virtual bool | isEnabled () const override |
| virtual bool | isEventEnabled (DtVrfDatabaseEvent::EventType eventType) const override |
| virtual bool | logEvent (DtVrfDatabaseEvent::EventType eventType, const DtVrfDatabaseEvent &event) override |
| virtual bool | logEvent (DtVrfDatabaseEvent::EventType eventType, DtVrfDatabaseEvent &&event) override |
| virtual bool | logEvent (DtVrfDatabaseEvent::EventType eventType, std::function< DtVrfDatabaseEvent()> f) override |
| virtual std::unique_ptr < DtVrfDatabaseEvent > | popEvent () override |
| virtual void | setScenarioLoadInformation (int runId, const DtFilename &scenarioName, DtTime simTime) override |
| virtual void | setScenarioRunInformation (const DtFilename &scenarioName, DtTime simTime, DtTime dateAndTimeOfDay, DtTime realWorldTime) override |
| virtual unsigned | queueSize () override |
| virtual void | forceDatabaseUpdate () override |
Public Member Functions inherited from DtVrfDatabaseLoggerInterface | |
| virtual | ~DtVrfDatabaseLoggerInterface () |
| virtual void | tick (double simTime) |
| virtual double | resourceThresholdPercentage () const |
| virtual void | setResourceThresholdPercentage (double p) |
| const DtVrfDatabaseConnection * | databaseConnection () const |
| DtVrfDatabaseConnection * | databaseConnection () |
Static Public Member Functions | |
| static DtVrfDatabaseLoggerInterface * | create () |
| static DtString | type () |
Static Public Attributes | |
| static const DtString | theScenarioNameParamName |
| static const DtString | theScenarioRunIdParamName |
| static const DtString | theScenarioSimTimeParamName |
| static const DtString | theScenarioSimAddressParamName |
| static const DtString | theScenarioDateAndTimeAtStartParamName |
| static const DtString | theScenarioRealWorldTimeStartParamName |
Protected Member Functions | |
| DtVrfDatabaseLogger () | |
Protected Member Functions inherited from DtVrfDatabaseLoggerInterface | |
| DtVrfDatabaseLoggerInterface () | |
Protected Attributes | |
| tbb::concurrent_bounded_queue < DtVrfDatabaseEvent * > | myEventQueue |
| std::vector< bool > | myEnabledEventTypes |
Protected Attributes inherited from DtVrfDatabaseLoggerInterface | |
| double | myResourceThresholdPercentage |
| DtSimulationAddress | mySimAddress |
| double | mySimTime |
| double | myDateAndTimeStart |
| double | myRealWorldTimeStart |
| bool | myScenarioRunInfoSet |
| int | myRunId |
| DtString | myScenarioName |
| double | myLogPeriod |
| double | myNextLogTime |
| std::unique_ptr < DtVrfDatabaseConnection > | myDatabaseConnection |
Private Member Functions | |
| DtVrfDatabaseLogger (const DtVrfDatabaseLogger &other) | |
| DtVrfDatabaseLogger & | operator= (const DtVrfDatabaseLogger &other) |
|
overridevirtual |
Destructor.
|
protected |
Constructor. Should only be created using the creator function through the DtVrfDatabaseLoggerCreator.
|
private |
Copy Constructor not implemented – Do Not copy.
|
overridevirtual |
Reimplemented from DtVrfDatabaseLoggerInterface.
|
inlineoverridevirtual |
Returns true if database logging is enabled.
Implements DtVrfDatabaseLoggerInterface.
|
overridevirtual |
Returns true if logging is enabled for the specified event type.
Implements DtVrfDatabaseLoggerInterface.
|
overridevirtual |
Implements DtVrfDatabaseLoggerInterface.
|
overridevirtual |
Implements DtVrfDatabaseLoggerInterface.
|
overridevirtual |
Implements DtVrfDatabaseLoggerInterface.
|
overridevirtual |
Pops the next event from the queue. Logger gives up ownership of the popped event.
Implements DtVrfDatabaseLoggerInterface.
|
overridevirtual |
Sets information about the current scenario run at load time.
Reimplemented from DtVrfDatabaseLoggerInterface.
|
overridevirtual |
Sets information about the current scenario run when run, in case it changed since load.
Reimplemented from DtVrfDatabaseLoggerInterface.
|
inlineoverridevirtual |
The number of events currently queued to be logged to the database.
Reimplemented from DtVrfDatabaseLoggerInterface.
|
overridevirtual |
Forces all pending events to be written to the database. Normally it is not necessary to call this.
Reimplemented from DtVrfDatabaseLoggerInterface.
|
inlinestatic |
Creator function for this class. Not generally used directly. Created by the DtVrfDatabaseLoggerCreator.
|
inlinestatic |
Type of this database logger.
|
private |
Assignment Operator not implemented – Do Not copy.
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
protected |
|
protected |