VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Private Member Functions
DtVrfDatabaseLogger Class Reference

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.

Inheritance diagram for DtVrfDatabaseLogger:
Inheritance graph
[legend]

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 DtVrfDatabaseConnectiondatabaseConnection () const
 
DtVrfDatabaseConnectiondatabaseConnection ()
 

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< boolmyEnabledEventTypes
 
- 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)
 
DtVrfDatabaseLoggeroperator= (const DtVrfDatabaseLogger &other)
 

Constructor & Destructor Documentation

virtual DtVrfDatabaseLogger::~DtVrfDatabaseLogger ( )
overridevirtual

Destructor.

DtVrfDatabaseLogger::DtVrfDatabaseLogger ( )
protected

Constructor. Should only be created using the creator function through the DtVrfDatabaseLoggerCreator.

DtVrfDatabaseLogger::DtVrfDatabaseLogger ( const DtVrfDatabaseLogger other)
private

Copy Constructor not implemented – Do Not copy.

Member Function Documentation

virtual void DtVrfDatabaseLogger::initialize ( const DtRwDatabaseLoggerConfig config,
const DtSimulationAddress &  simAddress,
std::unique_ptr< DtVrfDatabaseConnection conn 
)
overridevirtual

Reimplemented from DtVrfDatabaseLoggerInterface.

virtual bool DtVrfDatabaseLogger::isEnabled ( ) const
inlineoverridevirtual

Returns true if database logging is enabled.

Implements DtVrfDatabaseLoggerInterface.

virtual bool DtVrfDatabaseLogger::isEventEnabled ( DtVrfDatabaseEvent::EventType  eventType) const
overridevirtual

Returns true if logging is enabled for the specified event type.

Implements DtVrfDatabaseLoggerInterface.

virtual bool DtVrfDatabaseLogger::logEvent ( DtVrfDatabaseEvent::EventType  eventType,
const DtVrfDatabaseEvent event 
)
overridevirtual
virtual bool DtVrfDatabaseLogger::logEvent ( DtVrfDatabaseEvent::EventType  eventType,
DtVrfDatabaseEvent &&  event 
)
overridevirtual
virtual bool DtVrfDatabaseLogger::logEvent ( DtVrfDatabaseEvent::EventType  eventType,
std::function< DtVrfDatabaseEvent()>  f 
)
overridevirtual
virtual std::unique_ptr<DtVrfDatabaseEvent> DtVrfDatabaseLogger::popEvent ( )
overridevirtual

Pops the next event from the queue. Logger gives up ownership of the popped event.

Implements DtVrfDatabaseLoggerInterface.

virtual void DtVrfDatabaseLogger::setScenarioLoadInformation ( int  runId,
const DtFilename &  scenarioName,
DtTime  simTime 
)
overridevirtual

Sets information about the current scenario run at load time.

Reimplemented from DtVrfDatabaseLoggerInterface.

virtual void DtVrfDatabaseLogger::setScenarioRunInformation ( const DtFilename &  scenarioName,
DtTime  simTime,
DtTime  dateAndTimeOfDay,
DtTime  realWorldTime 
)
overridevirtual

Sets information about the current scenario run when run, in case it changed since load.

Reimplemented from DtVrfDatabaseLoggerInterface.

virtual unsigned DtVrfDatabaseLogger::queueSize ( )
inlineoverridevirtual

The number of events currently queued to be logged to the database.

Reimplemented from DtVrfDatabaseLoggerInterface.

virtual void DtVrfDatabaseLogger::forceDatabaseUpdate ( )
overridevirtual

Forces all pending events to be written to the database. Normally it is not necessary to call this.

Reimplemented from DtVrfDatabaseLoggerInterface.

static DtVrfDatabaseLoggerInterface* DtVrfDatabaseLogger::create ( )
inlinestatic

Creator function for this class. Not generally used directly. Created by the DtVrfDatabaseLoggerCreator.

static DtString DtVrfDatabaseLogger::type ( void  )
inlinestatic

Type of this database logger.

DtVrfDatabaseLogger& DtVrfDatabaseLogger::operator= ( const DtVrfDatabaseLogger other)
private

Assignment Operator not implemented – Do Not copy.

Member Data Documentation

const DtString DtVrfDatabaseLogger::theScenarioNameParamName
static
const DtString DtVrfDatabaseLogger::theScenarioRunIdParamName
static
const DtString DtVrfDatabaseLogger::theScenarioSimTimeParamName
static
const DtString DtVrfDatabaseLogger::theScenarioSimAddressParamName
static
const DtString DtVrfDatabaseLogger::theScenarioDateAndTimeAtStartParamName
static
const DtString DtVrfDatabaseLogger::theScenarioRealWorldTimeStartParamName
static
tbb::concurrent_bounded_queue<DtVrfDatabaseEvent*> DtVrfDatabaseLogger::myEventQueue
protected
std::vector<bool> DtVrfDatabaseLogger::myEnabledEventTypes
protected

The documentation for this class was generated from the following file:

Document ID: Generated on Thu Oct 23 22:29:17 EDT 2025 from SVN revision 280951
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)