VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
vrfDatabaseLogger.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2024 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 #pragma once
6 
10 #include <tbb/concurrent_queue.h>
11 
28 {
29 public:
30 
37 
39  virtual ~DtVrfDatabaseLogger() override;
40 
42  virtual void initialize(const DtRwDatabaseLoggerConfig& config,
43  const DtSimulationAddress& simAddress,
44  std::unique_ptr<DtVrfDatabaseConnection> conn) override;
45 
47  virtual bool isEnabled() const override { return true; };
48 
50  virtual bool isEventEnabled(DtVrfDatabaseEvent::EventType eventType) const override;
51 
53  virtual bool logEvent(DtVrfDatabaseEvent::EventType eventType, const DtVrfDatabaseEvent& event) override;
54 
56  virtual bool logEvent(DtVrfDatabaseEvent::EventType eventType, DtVrfDatabaseEvent&& event) override;
57 
59  virtual bool logEvent(DtVrfDatabaseEvent::EventType eventType, std::function<DtVrfDatabaseEvent()> f) override;
60 
62  virtual std::unique_ptr<DtVrfDatabaseEvent> popEvent() override;
63 
65  virtual void setScenarioLoadInformation(int runId, const DtFilename& scenarioName,
66  DtTime simTime) override;
67 
69  virtual void setScenarioRunInformation(const DtFilename& scenarioName,
70  DtTime simTime, DtTime dateAndTimeOfDay, DtTime realWorldTime) override;
71 
73  virtual unsigned queueSize() override { return myEventQueue.size(); };
74 
76  virtual void forceDatabaseUpdate() override;
77 
81 
83  static DtString type() { return "standard-database-logger"; };
84 
85 protected:
86 
90 
91 private:
92 
95 
98 
99 protected:
100 
101  tbb::concurrent_bounded_queue<DtVrfDatabaseEvent*> myEventQueue;
102  std::vector<bool> myEnabledEventTypes;
103 };
104 
105 
virtual bool isEnabled() const override
Returns true if database logging is enabled.
Definition: vrfDatabaseLogger.h:47
DtVrfDatabaseLoggerInterface & operator=(const DtVrfDatabaseLoggerInterface &other)
Assignment Operator not implemented – Do Not copy.
The standard database logger used in VRF. The database logger is responsible for logging database eve...
Definition: vrfDatabaseLogger.h:27
EventType
The unique event types for different types of data that will be logged by VRF. Each event type will g...
Definition: vrfDatabaseEvent.h:28
Contains the configuration options for the database logger.
Definition: rwDatabaseLoggerConfig.h:22
The base class for database loggers. A database logger is responsible for logging database events int...
Definition: vrfDatabaseLoggerInterface.h:29
static const DtString theScenarioRealWorldTimeStartParamName
Definition: vrfDatabaseLogger.h:36
virtual void initialize(const DtRwDatabaseLoggerConfig &config, const DtSimulationAddress &simAddress, std::unique_ptr< DtVrfDatabaseConnection > conn)
static const DtString theScenarioDateAndTimeAtStartParamName
Definition: vrfDatabaseLogger.h:35
std::vector< bool > myEnabledEventTypes
Definition: vrfDatabaseLogger.h:102
static DtString type()
Type of this database logger.
Definition: vrfDatabaseLogger.h:83
static const DtString theScenarioSimTimeParamName
Definition: vrfDatabaseLogger.h:33
virtual void setScenarioLoadInformation(int runId, const DtFilename &scenarioName, DtTime simTime)
Sets information about the current scenario run at load time.
virtual unsigned queueSize() override
The number of events currently queued to be logged to the database.
Definition: vrfDatabaseLogger.h:73
virtual void forceDatabaseUpdate()
Forces all pending events to be written to the database. Normally it is not necessary to call this...
Definition: vrfDatabaseLoggerInterface.h:78
static DtVrfDatabaseLoggerInterface * create()
Creator function for this class. Not generally used directly. Created by the DtVrfDatabaseLoggerCreat...
Definition: vrfDatabaseLogger.h:80
virtual bool logEvent(DtVrfDatabaseEvent::EventType eventType, const DtVrfDatabaseEvent &event)=0
Logs an event to be recorded in the database.
tbb::concurrent_bounded_queue< DtVrfDatabaseEvent * > myEventQueue
Definition: vrfDatabaseLogger.h:101
virtual std::unique_ptr< DtVrfDatabaseEvent > popEvent()=0
Pops the next event from the queue. Logger gives up ownership of the popped event.
Represents a single event to be recorded in the database. Anytime something occurs that requires data...
Definition: vrfDatabaseEvent.h:22
static const DtString theScenarioNameParamName
Definition: vrfDatabaseLogger.h:31
static const DtString theScenarioSimAddressParamName
Definition: vrfDatabaseLogger.h:34
#define DT_DLL_vrfMsgTransport
This file is used to determine how to build Disable inconsistent dll linkage warning Visual Studio 6...
Definition: vrfCommunicationManagerDefines.h:26
static const DtString theScenarioRunIdParamName
Definition: vrfDatabaseLogger.h:32
virtual void setScenarioRunInformation(const DtFilename &scenarioName, DtTime simTime, DtTime dateAndTimeOfDay, DtTime realWorldTime)
Sets information about the current scenario run when run, in case it changed since load...
virtual bool isEventEnabled(DtVrfDatabaseEvent::EventType eventType) const =0
Returns true if logging is enabled for the specified event type.

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)