VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
aggregateDatabaseLoggingController.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2024 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
8 
9 #pragma once
10 
13 
16 
20 {
21 public:
24  DtSimulationServices * simManager, DtComponentDescriptor* desc = NULL,
25  DtReaderWriterRegistry * parentRegistry = 0);
26 
28  virtual ~DtAggregateDatabaseLoggingController() override;
29 
30 private:
33 
36 
37 public:
38  virtual const char* type() const override;
39 
40  virtual void preFirstTickInit() override;
41 
44  virtual void tick() override;
45 
47  virtual bool tickWhileDestroyed() const override;
48 
50  static DtSimComponent* creator(const DtString & name, DtLocalObject* owner,
51  DtSimulationServices * simManager, DtComponentDescriptor* desc,
52  DtReaderWriterRegistry * parentRegistry);
53 
54 protected:
55 
57  virtual void logEngagements();
58 
60  virtual void logResources();
61 
64  virtual bool validateEngagementProperties();
65 
67  virtual void logCurrentEngagementStatus(bool onlyOnChange, DtTime endTime = -1);
68 
70  virtual void logCurrentEngagementCasualties(bool onlyOnChange);
71 
73  virtual void logCurrentEngagementEquipmentDamage(bool onlyOnChange);
74 
75  virtual void logCurrentEngagementAttacks(DtTime simTime);
76 
77  virtual DtEntityType entityTypeFromResourceName(const DtString& resName);
78 
79 protected:
80 
82 
83  unsigned myStartHealth;
90  std::map<DtString, unsigned> myStartEquipment;
91  std::map<DtString, unsigned> myStartWeapons;
92 
93  unsigned myPreviousHealth;
99  std::map<DtString, unsigned> myPreviousEquipment;
100  std::map<DtString, unsigned> myPreviousWeapons;
101 
102  unsigned myEngagementId;
105 
106  const DtPropertyInterface* myHealthProp = 0;
107  const DtPropertyInterface* myEngagedProp = 0;
108  const DtPropertyInterface* myEngagementIdProp = 0;
109  const DtPropertyInterface* myAttacksDefendingIdProp = 0;
110  const DtPropertyInterface* myAttacksProp = 0;
111  const DtPropertyInterface* myLimitedMunitionAttacksProp = 0;
112  const DtPropertyInterface* myEngagementHistoryProp = 0;
113  const DtPropertyInterface* myNumberKilledProp = 0;
114  const DtPropertyInterface* myNumberCapturedProp = 0;
115  const DtPropertyInterface* myNumberWoundedProp = 0;
116  const DtPropertyInterface* myNumberMissingProp = 0;
117  const DtPropertyInterface* myPrimaryEquipmentProp = 0;
118  const DtPropertyInterface* myEquipmentProp = 0;
119  const DtPropertyInterface* myWeaponsProp = 0;
120 
122  {
124  : fullAmount(0), previousPercent(-1.0)
125  , property(nullptr), entityType(DtEntityType::nullType()) {};
126  ResourceInfo(const DtPropertyInterface* prop, DtEntityType et,
127  double fa, DtString fn)
128  : fullAmount(fa), previousPercent(-1.0)
129  , property(prop), valueFieldName(fn), entityType(et) {};
130 
131  double fullAmount;
135  DtEntityType entityType;
136  };
137  std::map<DtEntityType, ResourceInfo> myResourceInfo;
138 
140 
141  std::set<unsigned> myIncompleteEngagements;
142 };
143 
ResourceInfo(const DtPropertyInterface *prop, DtEntityType et, double fa, DtString fn)
Definition: aggregateDatabaseLoggingController.h:126
double previousPercent
Definition: aggregateDatabaseLoggingController.h:132
#define DT_DLL_vrfmodel
This file is used to determine how to build.
Definition: vrfmodelDefines.h:24
std::map< DtString, unsigned > myPreviousWeapons
Definition: aggregateDatabaseLoggingController.h:100
std::map< DtString, unsigned > myStartWeapons
Definition: aggregateDatabaseLoggingController.h:91
unsigned myPreviousNumberKilled
Definition: aggregateDatabaseLoggingController.h:94
const DtControllerComponent & operator=(const DtControllerComponent &orig)
assignment operator
DtAggregateDatabaseLoggingControllerDescriptor * myLoggingDescriptor
Definition: aggregateDatabaseLoggingController.h:81
unsigned myStartNumberMissing
Definition: aggregateDatabaseLoggingController.h:87
virtual void preFirstTickInit()
This function can be overridden to initialize a component before it is ticked for the first time...
unsigned myPreviousNumberMissing
Definition: aggregateDatabaseLoggingController.h:97
A readable, writable type whose name is the name of a component and that has a list of component name...
Definition: componentDescriptor.h:49
std::map< DtString, unsigned > myStartEquipment
Definition: aggregateDatabaseLoggingController.h:90
virtual const char * type() const override=0
This returns a string from compTypes.h, and identifies the type of component.
Instances of DtAggregateDatabaseLoggingControllerDescriptor are used to specify the parameters for a ...
Definition: aggregateDatabaseLoggingControllerDescriptor.h:21
Definition: readerWriterRegistry.h:39
bool myHasPrimaryEquip
Definition: aggregateDatabaseLoggingController.h:89
std::set< unsigned > myIncompleteEngagements
Definition: aggregateDatabaseLoggingController.h:141
ResourceInfo()
Definition: aggregateDatabaseLoggingController.h:123
Interface class used to define minimal interface for a property. The DtPropertyInterface class provid...
Definition: propertyInterface.h:53
Definition: aggregateDatabaseLoggingController.h:121
unsigned myPreviousNumberWounded
Definition: aggregateDatabaseLoggingController.h:96
unsigned myPreviousPrimaryEquip
Definition: aggregateDatabaseLoggingController.h:98
bool myIsEngaged
Definition: aggregateDatabaseLoggingController.h:104
unsigned myStartNumberKilled
Definition: aggregateDatabaseLoggingController.h:84
unsigned myStartNumberCaptured
Definition: aggregateDatabaseLoggingController.h:85
unsigned myPreviousNumberCaptured
Definition: aggregateDatabaseLoggingController.h:95
unsigned myStartPrimaryEquip
Definition: aggregateDatabaseLoggingController.h:88
virtual void tick()
This gives the thread of control to the component. The component is ticked once each simulation from ...
unsigned myEngagementId
Definition: aggregateDatabaseLoggingController.h:102
virtual bool tickWhileDestroyed() const
If the component returns true here, it will be ticked regardless of the destroyed state of the host e...
std::map< DtEntityType, ResourceInfo > myResourceInfo
Definition: aggregateDatabaseLoggingController.h:137
DtEntityType entityType
Definition: aggregateDatabaseLoggingController.h:135
double myEngagementStartTime
Definition: aggregateDatabaseLoggingController.h:103
DtTime myPreviousUpdateTime
Definition: aggregateDatabaseLoggingController.h:139
This controller is responsible for logging information about AggregateLevel events to a database...
Definition: aggregateDatabaseLoggingController.h:19
End User Description: DtControllerComponent is the base class for all controllers components...
Definition: controllerComponent.h:31
Central access point of all non-object-specific the services and managers that are available for use ...
Definition: simulationServices.h:96
The DtSimComponent class is the base class for the entire simulation model component hierarchy...
Definition: simComponent.h:89
unsigned myStartNumberWounded
Definition: aggregateDatabaseLoggingController.h:86
const DtPropertyInterface * property
Definition: aggregateDatabaseLoggingController.h:133
unsigned myStartHealth
Definition: aggregateDatabaseLoggingController.h:83
std::map< DtString, unsigned > myPreviousEquipment
Definition: aggregateDatabaseLoggingController.h:99
DtString valueFieldName
Definition: aggregateDatabaseLoggingController.h:134
unsigned myPreviousHealth
Definition: aggregateDatabaseLoggingController.h:93
A locally simulated VRF object.
Definition: localObject.h:98

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)