VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtModelSemanticsMapper.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2026 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvCore/vrvCore.h>
14 
15 #include <map>
16 #include <string>
17 #include <unordered_map>
18 
19 namespace makVrv
20 {
21  class DtDe;
22  class DtBaseConnection;
28  {
29  public:
30 
32 
36  struct States
37  {
38  //The default state ids, note using a string of the exact text of an enumeration
39  //is a valid name for the id.
40  enum Id
41  {
42  invalidId = 0,
43  mobility = 1,
44  fire_power = 2,
45  damage = 3,
46  trailing_effects = 4,
47  hatch = 5,
48  moving = 6,
49  paint_scheme = 7,
50  density = 8,
51  frozen_status = 9,
52  power_plant_status = 10,
53  launcher = 11,
54  camouflage_type = 12,
55  concealed = 13,
56  head_lights = 14,
57  tail_lights = 15,
58  brake_lights = 16,
59  blackout_lights = 17,
60  blackout_brake_lights = 18,
61  spot_lights = 19,
62  interior_lights = 20,
63  afterburner = 21,
64  landing_lights = 22,
65  navigation_lights = 23,
66  anticollision_lights = 24,
67  formation_lights = 25,
68  launch_flash = 26,
69  smoke = 27,
70  flaming = 28,
71  running_lights = 29,
72  lights = 30,
73  life_form_state = 31,
74  weapon_1 = 32,
75  weapon_2 = 33,
76  flashlight = 34,
77  compliance = 35,
78  health = 36,
79  masked_cloaked = 37,
80  internal_heat_status = 38,
81  exterior_lights = 39,
82  mission = 40,
83  antenna = 41,
84  tent = 42,
85  ramp = 43,
86  wind_effect = 50, // things that change state due to wind
87  light_color = 51, // switch for light color on buoys and beacons
88  daymark = 52, // switch for daymark sign on beacons
89  daymark_shape = 53, // switch for daymark sign shape on beacons
90  topmark = 54, // switch for topmarks on beacons or buoys
91  topmark_shape = 55, // switch for topmark shapes on beacons or buoys
92  label_char_count = 56, // switch for number of characters on a label,
93  // with characters determined by UV offset into an atlas
94  shadow_polygon = 57, // switch for shadow polygon underneath cars and other objects
95  segment_count = 58, // switch for number of characters on a taxiway sign,
96  // with characters determined by UV offset into an atlas
97  // switch for the color of the expendable
98  exp_color = 59,
99  exp_parachute = 60, // expendable parachute state
100  lower_anti_collision_lights = 61,
101  upper_anti_collision_lights = 62,
102  anti_collision_lights_day_night = 63,
103  is_blinking = 64,
104  landing_gear_extended = 65,
105  cargo_doors_opened = 66,
106  navigation_position_brightness = 67,
107  reverse_thrust_engaged = 68,
108  weight_on_wheels = 69,
109  occupants_surrendered = 70,
110  nvg_mode = 71,
111  cover_shroud = 72,
112  signal_smoke = 73,
113  signal_mirror = 74,
114  ir_strobe = 75,
115  ir_illuminator = 76,
116  mounted_status = 77,
117  concealed_movement = 78,
118  flare_smoke_status = 79,
119  spot_chaff_status = 80,
120  supply_deployed_status = 81,
121  left_indicator_light = 82,
122  right_indicator_light = 83,
123  emergency_lights = 84,
124  hdu_lights = 85,
125  anchor_lights = 86,
126  warning_safety_lights = 87,
127  distress_beacons_strobes = 88,
128  upper_deck_flood_lights = 89,
129  upper_deck_lights = 90,
130  wave_off_light = 91,
131  not_under_command_lights = 92,
132  ram_lights = 93, // restricted ability to maneuver
133  fishing_with_lines_lights = 94,
134  fishing_with_nets_lights = 95,
135  mine_hunting_lights = 96,
136  taxi_lights = 97,
137  aground_lights = 98,
138  constrained_by_draft_lights = 99,
139  mob_operation_lights = 100,
140  signal_lights = 101,
141  side_lights = 102,
142  // Refueling station lights (1=port, 2=center, 3=starboard)
143  refueling_station_1_light_on = 103,
144  refueling_station_1_light_day_night = 104,
145  refueling_station_1_flashing = 105,
146  refueling_station_1_light_color = 106,
147  refueling_station_2_light_on = 107,
148  refueling_station_2_light_day_night = 108,
149  refueling_station_2_flashing = 109,
150  refueling_station_2_light_color = 110,
151  refueling_station_3_light_on = 111,
152  refueling_station_3_light_day_night = 112,
153  refueling_station_3_flashing = 113,
154  refueling_station_3_light_color = 114,
155  user_start = 500,
156  user_end = 999,
157  // sub-system damage state id range
158  // The max number of sub-system functions is 256 and zone numbers per
159  // function is 256, hence the range 1000 to 66536
160  // id = = sub_system_damage_start + ((256*system id) + zone id)
161  sub_system_damage_start = 1000,
162  sub_system_damage_end = 66792
163  };
164  };
165 
169  struct Parts
170  {
171  enum Id
172  {
173  rudder = 1024, // 32 X 32
174  left_flap = 1056, // 33 X 32
175  right_flap = 1088, // 34 X 32
176  left_aileron = 1120, // etc. all art part numbers are multiples of 32
177  right_aileron = 1152,
178  helicopter_main_rotor = 1184,
179  helicopter_tail_rotor = 1216,
180  other_aircraft_control_surfaces_defined_as_needed = 1248,
181  propeller_number_1 = 1280,
182  propeller_number_2 = 1312,
183  propeller_number_3 = 1344,
184  propeller_number_4 = 1376,
185  left_stabilator_stabilator_number_1 = 1408,
186  right_stabilator_stabilator_number_2 = 1440,
187  left_ruddervator_ruddervator_number_1 = 1472,
188  right_ruddervator_ruddervator_number_2 = 1504,
189  left_leading_edge_flap_slat = 1536,
190  right_leading_edge_flap_slat = 1568,
191  left_elevator = 1600,
192  right_elevator = 1632,
193  canard_left = 1664,
194  canard_right = 1696,
195  elevon_inner_left = 1728,
196  elevon_inner_right = 1760,
197  elevon_middle_left = 1792,
198  elevon_middle_right = 1824,
199  elevon_outer_left = 1856,
200  elevon_outer_right = 1888,
201  canopy_aircraft = 1920,
202  periscope = 2048,
203  generic_antenna = 2080,
204  snorkel = 2112,
205  other_extendible_parts_defined_as_needed = 2144,
206  dive_plane_sail_left = 2176,
207  dive_plane_sail_right = 2208,
208  dive_plane_bow_left = 2240,
209  dive_plane_bow_right = 2272,
210  dive_plane_stern_left = 2304,
211  dive_plane_stern_right = 2336,
212  landing_gear = 3072,
213  tail_hook = 3104,
214  speed_brake = 3136,
215  left_weapon_bay_door = 3168,
216  right_weapon_bay_doors = 3200,
217  tank_or_apc_hatch = 3232,
218  wingsweep = 3264,
219  bridge_launcher = 3296,
220  bridge_section_1 = 3328,
221  bridge_section_2 = 3360,
222  bridge_section_3 = 3392,
223  primary_blade_1 = 3424,
224  primary_blade_2 = 3456,
225  primary_boom = 3488,
226  primary_launcher_arm = 3520,
227  Landing_Gear_Nose = 3584,
228  Landing_Gear_Left_Main = 3616,
229  Landing_Gear_Right_Main = 3648,
230  Doors_of_Left_Side_Weapon_Bay = 3680,
231  Doors_of_Right_Side_Weapon_Bay = 3712,
232  Spot_Search_Light_1 = 3744,
233  Spot_Search_Light_2 = 3776,
234  Spot_Search_Light_3 = 3808,
235  Spot_Search_Light_4 = 3840,
236  Landing_Light = 3872,
237  other_fixed_position_parts_defined_as_needed = 3552,
238  primary_turret_number_1 = 4096,
239  primary_turret_number_2 = 4128,
240  primary_turret_number_3 = 4160,
241  primary_turret_number_4 = 4192,
242  primary_turret_number_5 = 4224,
243  primary_turret_number_6 = 4256,
244  primary_turret_number_7 = 4288,
245  primary_turret_number_8 = 4320,
246  primary_turret_number_9 = 4352,
247  primary_turret_number_10 = 4384,
248  primary_gun_number_1 = 4416,
249  primary_gun_number_2 = 4448,
250  primary_gun_number_3 = 4480,
251  primary_gun_number_4 = 4512,
252  primary_gun_number_5 = 4544,
253  primary_gun_number_6 = 4576,
254  primary_gun_number_7 = 4608,
255  primary_gun_number_8 = 4640,
256  primary_gun_number_9 = 4672,
257  primary_gun_number_10 = 4704,
258  primary_launcher_1 = 4736,
259  primary_launcher_2 = 4768,
260  primary_launcher_3 = 4800,
261  primary_launcher_4 = 4832,
262  primary_launcher_5 = 4864,
263  primary_launcher_6 = 4896,
264  primary_launcher_7 = 4928,
265  primary_launcher_8 = 4960,
266  primary_launcher_9 = 4992,
267  primary_launcher_10 = 5024,
268  primary_defense_systems_1 = 5056,
269  primary_defense_systems_2 = 5088,
270  primary_defense_systems_3 = 5120,
271  primary_defense_systems_4 = 5152,
272  primary_defense_systems_5 = 5184,
273  primary_defense_systems_6 = 5216,
274  primary_defense_systems_7 = 5248,
275  primary_defense_systems_8 = 5280,
276  primary_defense_systems_9 = 5312,
277  primary_defense_systems_10 = 5344,
278  primary_radar_1 = 5376,
279  primary_radar_2 = 5408,
280  primary_radar_3 = 5440,
281  primary_radar_4 = 5472,
282  primary_radar_5 = 5504,
283  primary_radar_6 = 5536,
284  primary_radar_7 = 5568,
285  primary_radar_8 = 5600,
286  primary_radar_9 = 5632,
287  primary_radar_10 = 5664,
288  secondary_turret_number_1 = 5696,
289  secondary_turret_number_2 = 5728,
290  secondary_turret_number_3 = 5760,
291  secondary_turret_number_4 = 5792,
292  secondary_turret_number_5 = 5824,
293  secondary_turret_number_6 = 5856,
294  secondary_turret_number_7 = 5888,
295  secondary_turret_number_8 = 5920,
296  secondary_turret_number_9 = 5952,
297  secondary_turret_number_10 = 5984,
298  secondary_gun_number_1 = 6016,
299  secondary_gun_number_2 = 6048,
300  secondary_gun_number_3 = 6080,
301  secondary_gun_number_4 = 6112,
302  secondary_gun_number_5 = 6144,
303  secondary_gun_number_6 = 6176,
304  secondary_gun_number_7 = 6208,
305  secondary_gun_number_8 = 6240,
306  secondary_gun_number_9 = 6272,
307  secondary_gun_number_10 = 6304,
308  secondary_launcher_1 = 6336,
309  secondary_launcher_2 = 6368,
310  secondary_launcher_3 = 6400,
311  secondary_launcher_4 = 6432,
312  secondary_launcher_5 = 6464,
313  secondary_launcher_6 = 6496,
314  secondary_launcher_7 = 6528,
315  secondary_launcher_8 = 6560,
316  secondary_launcher_9 = 6592,
317  secondary_launcher_10 = 6624,
318  secondary_defense_systems_1 = 6656,
319  secondary_defense_systems_2 = 6688,
320  secondary_defense_systems_3 = 6720,
321  secondary_defense_systems_4 = 6752,
322  secondary_defense_systems_5 = 6784,
323  secondary_defense_systems_6 = 6816,
324  secondary_defense_systems_7 = 6848,
325  secondary_defense_systems_8 = 6880,
326  secondary_defense_systems_9 = 6912,
327  secondary_defense_systems_10 = 6944,
328  secondary_radar_1 = 6976,
329  secondary_radar_2 = 7008,
330  secondary_radar_3 = 7040,
331  secondary_radar_4 = 7072,
332  secondary_radar_5 = 7104,
333  secondary_radar_6 = 7136,
334  secondary_radar_7 = 7168,
335  secondary_radar_8 = 7200,
336  secondary_radar_9 = 7232,
337  secondary_radar_10 = 7264,
338  deck_Elevator_1 = 7296,
339  deck_Elevator_2 = 7328,
340  catapult_1 = 7360,
341  catapult_2 = 7392,
342  jet_blast_deflector_1 = 7424,
343  jet_blast_deflector_2 = 7456,
344  arrestor_wires_1 = 7488,
345  arrestor_wires_2 = 7520,
346  arrestor_wires_3 = 7552,
347  wing__fold = 7584,
348  rotor_fold = 7584,
349  fuselage_fold = 7616,
350  Main_Cargo_Door = 7648,
351  cargo_ramp = 7680,
352  air_to_air_refueling_boom = 7680,
353  primary_aerial_refueling_receptacle_door = 7680,
354  secondary_aerial_refueling_receptacle_door = 7776,
355  aerial_refueling_receptacle_latch = 7808,
356  cargo_door_1 = 7840,
357  cargo_door_2 = 7872,
358  cargo_door_3 = 7904,
359  cargo_door_4 = 7936,
360  cargo_door_5 = 7968,
361  cargo_door_6 = 8000,
362  cargo_door_7 = 8032,
363  cargo_door_8 = 8064,
364  cargo_door_9 = 8096,
365  cargo_door_10 = 8128,
366  centre_refuelling_drogue = 8160,
367  port_refuelling_drogue = 8192,
368  starboard_refuelling_drogue = 8224,
369  submarine_engine_exhaust_mast = 8256,
370  submarine_mast_1 = 8288,
371  submarine_mast_2 = 8320,
372  submarine_mast_3 = 8352,
373  submarine_mast_4 = 8384,
374  submarine_mast_5 = 8416,
375  submarine_mast_6 = 8448,
376  submarine_mast_7 = 8480,
377  submarine_mast_8 = 8512,
378  submarine_mast_9 = 8544,
379  submarine_mast_10 = 8576,
380  vectored_thrust_nozzle = 8608,
381  left_door_of_the_left_weapon_bay = 8640,
382  right_door_of_the_left_weapon_bay = 8672,
383  left_door_of_the_right_weapon_bay = 8704,
384  right_door_of_the_right_weapon_bay = 8736,
385  gun_door = 8768,
386  countermeasure_door_left = 8800,
387  countermeasure_door_right = 8832,
388  hook_door_forward = 8864,
389  hook_door_aft = 8896,
390  lift_fan_upper_door = 8928,
391  lift_fan_lower_door_left = 8960,
392  lift_fan_lower_door_right = 8992,
393  refuel_probe_door = 9024,
394  left_engine_nacelle = 9056,
395  right_engine_nacelle = 9088,
396  first_left_wheel = 9120, // wheels
397  first_right_wheel = 9152,
398  second_left_wheel = 9184,
399  second_right_wheel = 9216,
400  third_left_wheel = 9248,
401  third_right_wheel = 9280,
402  fourth_left_wheel = 9312,
403  fourth_right_wheel = 9344,
404  fifth_left_wheel = 9376,
405  fifth_right_wheel = 9408,
406  sixth_left_wheel = 9440,
407  sixth_right_wheel = 9472,
408  seventh_left_wheel = 9504,
409  seventh_right_wheel = 9536,
410  eighth_left_wheel = 9568,
411  eighth_right_wheel = 9600,
412  ninth_left_wheel = 9632,
413  ninth_right_wheel = 9664,
414  tenth_left_wheel = 9696,
415  tenth_right_wheel = 9728, // 304 X 32
416  refueling_probe = 9760,
417  steering_wheel = 9792,
418  gimabled_sensor_azimuth_1 = 15424, // match VRF parts
419  gimabled_sensor_azimuth_2 = 15456,
420  gimabled_sensor_azimuth_3 = 15488,
421  gimabled_sensor_azimuth_4 = 15520,
422  gimabled_sensor_azimuth_5 = 15552,
423  gimabled_sensor_azimuth_6 = 15584,
424  gimabled_sensor_azimuth_7 = 15616,
425  gimabled_sensor_azimuth_8 = 15648,
426  gimabled_sensor_azimuth_9 = 15680,
427  gimabled_sensor_azimuth_10 = 15712,
428  gimabled_sensor_elevation_1 = 15744, // match VRF parts
429  gimabled_sensor_elevation_2 = 15776,
430  gimabled_sensor_elevation_3 = 15808,
431  gimabled_sensor_elevation_4 = 15840,
432  gimabled_sensor_elevation_5 = 15872,
433  gimabled_sensor_elevation_6 = 15904,
434  gimabled_sensor_elevation_7 = 15936,
435  gimabled_sensor_elevation_8 = 15968,
436  gimabled_sensor_elevation_9 = 16000,
437  gimabled_sensor_elevation_10 = 16032,
438  //
439  // For MAK extensions, start at the opposite end and work backwards
440  // largest value in 32 bit field that is a multiple of 32 is 134,217,727? X 32 = 4,294,967,264?
441  // However, we don't really need *that* many, and since the risk of someone not using *unsigned*
442  // or *short* (or both) somewhere along the pipeline is real, lets used max signed short instead
443  //
444  wind_blades = 32736, // 1023 X 32 parts that rotate into the wind direction
445  wind_direction = 32704 // 1022 X 32 parts that rotate based on wind speed, like turbine blades
446  };
447  };
448 
449 
451  static DtModelSemanticsMapper& instance(DtDe&);
452 
454  virtual DtModelSemanticsMapper* clone();
455 
457  static void copyInstance( DtBaseConnection& con, DtDe& de);
458 
460  static DtModelSemanticsMapper& instance( DtBaseConnection& con );
461 
462  virtual ~DtModelSemanticsMapper();
463 
470  const std::string* findStateName(States::Id id) const;
471 
479  const States::Id* findStateId(const std::string& name) const;
480 
487  const std::string* findPartName(Parts::Id id) const;
488 
496  const Parts::Id* findPartId(const std::string& name) const;
497 
499  void addState(const std::string& name, States::Id id);
500 
502  void removeState(const std::string& name);
503 
507  States::Id findFreeUserStateId() const;
508 
510  void addPart(const std::string& name, Parts::Id id);
511 
513  void removePart( const std::string& name);
514 
520 
522  static int calculateDamageSystemZoneId( const unsigned short functionNum, const unsigned short zoneNum );
523 
524  std::string damageSystemZoneName( const unsigned short functionNum, const unsigned short zoneNum ) const;
525  const States::Id* findDamageSystemZoneId( const std::string& functionName, const std::string& zoneName ) const;
526  const States::Id* findDamageSystemZoneId( const std::string& functionZoneName ) const;
527 
528  void addDamageSystemFunction( const std::string& functionName, const unsigned short functionNum );
529  void removeDamageSystemFunction( const std::string& functionName );
530 
531  std::string damageSystemFunctionName( const unsigned short functionNum ) const;
532  const unsigned short findDamageSystemFunctionNum( const std::string& functionName ) const;
533 
536  bool getDamageZoneIdInts( States::Id zoneId, unsigned short& outFunctionNum, unsigned short& outZoneNum ) const;
538 
539  protected:
540 
544  virtual std::string cleanUpName(const std::string&) const;
545 
547  virtual bool partNameIsNumber(const std::string& partName) const;
548 
550 
552  virtual void initialize( DtDe& de );
553 
557  void loadSubsystemDamageMappingsFromCsv( std::string csvFilePath );
558 
559  typedef std::map<std::string,States::Id> StateNameToIdMap;
560  typedef std::map<States::Id,std::string> StateIdToNameMap;
561 
562  typedef std::map<std::string,Parts::Id> PartNameToIdMap;
563  typedef std::map<Parts::Id,std::string> PartIdToNameMap;
564 
567 
570 
571  std::unordered_map<std::string, unsigned short> myDamageFunctionNameToNumMap;
572  std::unordered_map<unsigned short, std::string> myDamageFunctionNumToNameMap;
573 
575  };
576 
580  {
581  public:
582 
584  static void registerInstance(DtDe& de,DtModelSemanticsMapperCreator*);
585 
586 
589  static DtModelSemanticsMapperCreator& instance(DtDe& de);
590 
593 
596 
598  virtual DtModelSemanticsMapper* create();
599 
600  };
601 
602 }
Id
Definition: DtModelSemanticsMapper.h:171
std::unordered_map< std::string, unsigned short > myDamageFunctionNameToNumMap
Definition: DtModelSemanticsMapper.h:571
Virtual base class. Allows for RTTI and proper virtual destruction. Used by Creators, Factories, Providers, Assemblers and User Interfaces.
Definition: DtVirtualBaseClass.h:19
std::map< std::string, States::Id > StateNameToIdMap
Definition: DtModelSemanticsMapper.h:559
std::map< Parts::Id, std::string > PartIdToNameMap
Definition: DtModelSemanticsMapper.h:563
Default mapper creator, registered by the DtDe.
Definition: DtModelSemanticsMapper.h:579
std::unordered_map< unsigned short, std::string > myDamageFunctionNumToNameMap
Definition: DtModelSemanticsMapper.h:572
PartIdToNameMap myPartIdsToNames
Definition: DtModelSemanticsMapper.h:569
std::map< States::Id, std::string > StateIdToNameMap
Definition: DtModelSemanticsMapper.h:560
The DtBaseConnection is an abstract class.
Definition: DtBaseConnection.h:35
PartNameToIdMap myPartNamesToIds
Definition: DtModelSemanticsMapper.h:568
std::string myDamageSystemMappingsFileName
Definition: DtModelSemanticsMapper.h:574
Contains makVrv::DtVirtualBaseClass class.
This struct is used like a namespace. To use an enumeration value simple type: DtModelSemanticsMapper...
Definition: DtModelSemanticsMapper.h:36
#define DT_DLL_VRVCORE
Definition: vrvCore.h:20
StateNameToIdMap myStateNamesToIds
Definition: DtModelSemanticsMapper.h:565
This struct is used like a namespace. To use an enumeration value simple type: DtModelSemanticsMapper...
Definition: DtModelSemanticsMapper.h:169
The DtDe is the core component of any VR-Vantage application. It owns a DtRenderer, DtDeCommunicator, as well as a DtDisplay and other things.
Definition: DtDe.h:76
StateIdToNameMap myStateIdsToNames
Definition: DtModelSemanticsMapper.h:566
Id
Definition: DtModelSemanticsMapper.h:40
std::map< std::string, Parts::Id > PartNameToIdMap
Definition: DtModelSemanticsMapper.h:562
The DtModelSemanticsMapper object is responsible for mapping Names of model semantics declarations (f...
Definition: DtModelSemanticsMapper.h:27
Contains DLL export macros.

Document ID: Generated on Thu Oct 15 21:27:02 EDT 2026 from SVN revision 296421
Copyright © 2005-2026 MAK Technologies. All Rights Reserved (www.mak.com)