![]() |
VR-Forces Developer's Guide
|
Represents a single event to be recorded in the database. Anytime something occurs that requires data to be logged to the database, a new event is generated and logged by the database logger to then be recorded in the database. Each event will be logged with an EventType identifying what type of event it is. Each EventType is mapped to a database table where the event will be logged as a new entry.
Public Types | |
| enum | EventType { UnknownEvent = 0, WakeupEvent = 1, ShutdownEvent = 2, InternalStatsEvent = 3, SimEngineEvent = 4, ScenarioRunEvent = 5, DetonationEvent = 6, FireEvent = 7, DamageEvent = 8, ObjectEvent = 9, DetectionEvent = 10, FuelResourceEvent = 11, WeaponResourceEvent = 12, OtherResourceEvent = 13, UserEvent = 500 } |
| enum | TableUpdateFlag { InsertOrIgnore = 1, InsertOrUpdate = 2, UpdateExisting = 3 } |
| using | ParamVector = std::vector< DtVrfDatabaseEventParam * > |
Public Member Functions | |
| virtual | ~DtVrfDatabaseEvent () |
| virtual DtVrfDatabaseEvent::EventType | eventType () const |
| virtual void | setEventType (DtVrfDatabaseEvent::EventType et) |
| virtual TableUpdateFlag | updateOrInsert () const |
| virtual const ParamVector & | parameters () const |
| virtual bool | hasParameter (const DtString &name) const |
| virtual void | setCreateTableOnly (bool v) |
| virtual bool | createTableOnly () const |
| DtVrfDatabaseEvent (TableUpdateFlag updateRule=InsertOrIgnore) | |
| DtVrfDatabaseEvent (const DtVrfDatabaseEvent &orig) | |
| DtVrfDatabaseEvent (DtVrfDatabaseEvent &&orig) noexcept | |
| DtVrfDatabaseEvent & | operator= (const DtVrfDatabaseEvent &) |
| DtVrfDatabaseEvent & | operator= (DtVrfDatabaseEvent &&) noexcept |
| virtual DtVrfDatabaseEvent & | addParameter (const DtString &name, bool p, bool isPrimaryKey=false) |
| virtual DtVrfDatabaseEvent & | addParameter (const DtString &name, int p, bool isPrimaryKey=false) |
| virtual DtVrfDatabaseEvent & | addParameter (const DtString &name, unsigned p, bool isPrimaryKey=false) |
| virtual DtVrfDatabaseEvent & | addParameter (const DtString &name, float p, bool isPrimaryKey=false) |
| virtual DtVrfDatabaseEvent & | addParameter (const DtString &name, double p, bool isPrimaryKey=false) |
| virtual DtVrfDatabaseEvent & | addParameter (const DtString &name, std::string &&p, bool isPrimaryKey=false) |
| virtual DtVrfDatabaseEvent & | addParameter (const DtString &name, const std::string &p, bool isPrimaryKey=false) |
| virtual DtVrfDatabaseEvent & | addParameter (const DtString &name, const DtString &p, bool isPrimaryKey=false) |
| virtual DtVrfDatabaseEvent & | addParameter (const DtString &name, const DtEntityType &p, bool isPrimaryKey=false) |
| virtual DtVrfDatabaseEvent & | addParameter (const DtString &name, const DtEntityIdentifier &p, bool isPrimaryKey=false) |
| virtual DtVrfDatabaseEvent & | addParameter (const DtString &name, const DtSimulationAddress &p, bool isPrimaryKey=false) |
| virtual DtVrfDatabaseEvent & | addParameter (const DtString &name, const DtUUID &p, bool isPrimaryKey=false) |
| virtual DtVrfDatabaseEvent & | addParameter (const DtString &name, const DtVector &p, bool isPrimaryKey=false) |
Static Public Member Functions | |
| static const std::string & | eventTableName (EventType) |
| static void | initializeDefaultEventTypes () |
| static void | addEventType (unsigned eventType, const std::string &eventTableName) |
| static std::map< EventType, std::string > | eventTypeMapping () |
| static const std::map < EventType, DtVrfDatabaseEvent > & | eventPrototypes () |
| static DtVrfDatabaseEvent::EventType | highestEventType () |
| static void | setEventTypeMapping (const std::map< EventType, std::string > &mapping) |
| static void | setEventPrototypes (const std::map< EventType, DtVrfDatabaseEvent > &mapping) |
Static Public Attributes | |
| static const bool | PrimaryKey = true |
Protected Member Functions | |
| void | copyParameters (const DtVrfDatabaseEvent &orig) |
Protected Attributes | |
| DtVrfDatabaseEvent::EventType | myEventType |
| TableUpdateFlag | myUpdateOrInsert |
| bool | myCreateTableOnly |
| ParamVector | myParams |
Static Protected Attributes | |
| static std::map< EventType, std::string > | theEventTypeMapping |
| static std::map< EventType, DtVrfDatabaseEvent > | theEventPrototypes |
| using DtVrfDatabaseEvent::ParamVector = std::vector<DtVrfDatabaseEventParam*> |
The unique event types for different types of data that will be logged by VRF. Each event type will generate a different table in the database.
| DtVrfDatabaseEvent::DtVrfDatabaseEvent | ( | TableUpdateFlag | updateRule = InsertOrIgnore | ) |
Constructor. Additionally you can specify if this event should insert a new event or update an existing, and how to handle insertions when there is a duplicate.
| DtVrfDatabaseEvent::DtVrfDatabaseEvent | ( | const DtVrfDatabaseEvent & | orig | ) |
Constructor. Additionally you can specify if this event should insert a new event or update an existing, and how to handle insertions when there is a duplicate.
|
noexcept |
Constructor. Additionally you can specify if this event should insert a new event or update an existing, and how to handle insertions when there is a duplicate.
|
virtual |
Destructor.
| DtVrfDatabaseEvent& DtVrfDatabaseEvent::operator= | ( | const DtVrfDatabaseEvent & | ) |
Assignment operator.
|
noexcept |
Assignment operator.
|
inlinevirtual |
The DtVrfDatabaseEvent::EventType for this event. The DtVrfDatabaseEvent::EventType determines what table in which the database event will be stored.
|
inlinevirtual |
Sets the DtVrfDatabaseEvent::EventType.
|
inlinevirtual |
Returns the rule for how this event should be updated or inserted.
|
virtual |
Adds a new parameter to this event. Parameters can be of many types, and are then converted into types supported by the database. The following is a list of types and how they will be logged to an SQL database.
|
virtual |
Adds a new parameter to this event. Parameters can be of many types, and are then converted into types supported by the database. The following is a list of types and how they will be logged to an SQL database.
|
virtual |
Adds a new parameter to this event. Parameters can be of many types, and are then converted into types supported by the database. The following is a list of types and how they will be logged to an SQL database.
|
virtual |
Adds a new parameter to this event. Parameters can be of many types, and are then converted into types supported by the database. The following is a list of types and how they will be logged to an SQL database.
|
virtual |
Adds a new parameter to this event. Parameters can be of many types, and are then converted into types supported by the database. The following is a list of types and how they will be logged to an SQL database.
|
virtual |
Adds a new parameter to this event. Parameters can be of many types, and are then converted into types supported by the database. The following is a list of types and how they will be logged to an SQL database.
|
virtual |
Adds a new parameter to this event. Parameters can be of many types, and are then converted into types supported by the database. The following is a list of types and how they will be logged to an SQL database.
|
virtual |
Adds a new parameter to this event. Parameters can be of many types, and are then converted into types supported by the database. The following is a list of types and how they will be logged to an SQL database.
|
virtual |
Adds a new parameter to this event. Parameters can be of many types, and are then converted into types supported by the database. The following is a list of types and how they will be logged to an SQL database.
|
virtual |
Adds a new parameter to this event. Parameters can be of many types, and are then converted into types supported by the database. The following is a list of types and how they will be logged to an SQL database.
|
virtual |
Adds a new parameter to this event. Parameters can be of many types, and are then converted into types supported by the database. The following is a list of types and how they will be logged to an SQL database.
|
virtual |
Adds a new parameter to this event. Parameters can be of many types, and are then converted into types supported by the database. The following is a list of types and how they will be logged to an SQL database.
|
virtual |
Adds a new parameter to this event. Parameters can be of many types, and are then converted into types supported by the database. The following is a list of types and how they will be logged to an SQL database.
|
inlinevirtual |
Returns the list of all parameters in this event.
Returns true if the event has the named parameter.
|
virtual |
Set to true if only the table should be created, but no event should be logged.
|
virtual |
|
static |
Converts the given DtVrfDatabaseEvent::EventType to the string to be used for its database table name.
|
static |
Internal function used to initialize all default EventTypes. Sets up the type mappings from DtVrfDatabaseEvent::EventType to table name as well as a list of prototype events. Typically DtDefaultDatabaseEvents::eventTypes() is used to initialize the default type mappings and DtDefaultDatabaseEvents::eventPrototypes() is used to initialize any prototypes, however these can be replaced by calling setEventTypeMapping() and setEventPrototypes().
|
static |
Adds a new DtVrfDatabaseEvent::EventType. This is required if you are defining additional database events beyond what VR-Forces supports by default. It is recommended all user added events start with the UserEvent value.
|
static |
The full mapping of EventTypes to strings.
|
static |
The full mapping of EventTypes to their prototypes. It is not required that an event have a predefined prototype, though by default standard VR-Forces events will. If you are adding additional database events, adding a prototype is not required.
|
static |
The highest configured event type value.
|
static |
Completely replaces the DtVrfDatabaseEvent::EventType mapping. Not usually necessary. If you want to add additional mappings use addEventType() instead. Calling this function means that mappings defined by DtDefaultDatabaseEvents::eventTypes() will be ignored.
|
static |
Defines prototypes for events. This is not usually necessary. Event prototypes are not required. If you want to add a new event type, callign addEventType() is sufficient. Event prototypes are only used to pre-generate database tables up front if they are not already created. If they are not pre-generated, they will automatically be created the first time an event is logged of the matching event type. Calling this function means that mappings defined by DtDefaultDatabaseEvents::eventPrototypes() will be ignored.
|
protected |
Copies all of the parameters from another event. Used internally.
|
static |
|
protected |
|
protected |
|
protected |
|
protected |
|
staticprotected |
|
staticprotected |