VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtSharedSimulationSettings.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * Copyright (c) 2023 MAK Technologies, Inc.
3  * All rights reserved.
4  *****************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvVrl/vrvVrl.h>
13 
15 
16 #include <vrvUtil/signalslib.h>
17 #include <vrvUtil/DtUnicode.h>
18 
19 #include <unordered_map>
20 #include <vector>
21 
22 class DtEntityType;
23 
24 namespace makVrv
25 {
26 
27  class DtEntityTypeMapper;
28  class DtSharedSimulationSettings;
29 
33  {
34  public:
35 
36  // X Macro for entity mapper types.
37  // http://www.drdobbs.com/blogs/cpp/228700289
38 #define SIMSETTINGSMAPPERS \
39  X(FireTypeMap) \
40  X(EntityTypeMap) \
41  X(UnitTypeMap) \
42  X(DetonationTypeMap) \
43  X(TacticalGraphicsTypeMap) \
44  X(RadioCommunicationsTypeMap) \
45  X(IffReplyTypeMap) \
46  X(RadioTransmissionsTypeMap) \
47  X(SmokeTypeMap) \
48  X(NumSimSettingsMappers)
49 
50  // X macro definition and enum declaration.
51 #define X(a) Sim##a,
53 #undef X
54 
55  public:
56 
58  virtual ~DtSharedSimulationSettings();
59 
61  virtual void setMapper( MapperType mapperType,
62  const DtEntityTypeMapper& mapper );
63 
66 
68  void setMapping( MapperType mapperType, const DtEntityType& type, const DtUnicode& definition );
69 
71  void setEntityModelMapping( const DtEntityType& type, const DtUnicode& definition );
72 
74  void setAggregateModelMapping( const DtEntityType& type, const DtUnicode& definition );
75 
77  void setTacticalGraphicsMapping( const DtEntityType& type, const DtUnicode& definition );
78 
80  void setFireModelMapping( const DtEntityType& type, const DtUnicode& definition );
81 
83  void setDetonationModelMapping( const DtEntityType& type, const DtUnicode& definition );
84 
86  void setRadioCommunicationsMapping( const DtEntityType& type, const DtUnicode& definition );
87 
89  void setRadioTransmissionsMapping( const DtEntityType& type, const DtUnicode& definition );
90 
92  void setTacticalSmokeMapping( const DtEntityType& type, const DtUnicode& definition );
93 
95 
98 
101  const std::vector<DtUnicode>& mapDefinition( MapperType mapperType, const DtEntityType& type ) const;
102 
105  const std::vector<DtUnicode>& mapEntityDefinition( const DtEntityType& type ) const;
106 
109  const std::vector<DtUnicode>& mapAggregateDefinition( const DtEntityType& type ) const;
110 
113  const std::vector<DtUnicode>& mapFireTypeDefinition( const DtEntityType& type ) const;
114 
117  const std::vector<DtUnicode>& mapDetonationDefinition( const DtEntityType& type ) const;
118 
121  const std::vector<DtUnicode>& mapTacticalGraphicsDefinition( const DtEntityType& type ) const;
122 
125  const std::vector<DtUnicode>& mapRadioCommunicationDefinition( const DtEntityType& type ) const;
126 
129  const std::vector<DtUnicode>& mapRadioTransmissionDefinition( const DtEntityType& type ) const;
130 
133  const std::vector<DtUnicode>& mapIffReplyDefinition( const DtEntityType& type ) const;
134 
137  const std::vector<DtUnicode>& mapTacticalSmokeDefinition( const DtEntityType& type ) const;
138 
140 
143 
145  DtEntityTypeMapper* findMapperByName( const std::string& name );
146 
148  const DtEntityTypeMapper* findMapperByName( const std::string& name ) const;
149 
151  virtual void mapperNames(std::vector<std::string>& names) const;
152 
154 
157 
160  DtEntityTypeMapper& typeMapper( MapperType type );
161 
164  const DtEntityTypeMapper& typeMapper( MapperType type ) const;
165 
168  DtEntityTypeMapper& entityTypeMapper();
169 
172  const DtEntityTypeMapper& entityTypeMapper() const;
173 
176  DtEntityTypeMapper& aggregateTypeMapper();
177 
180  const DtEntityTypeMapper& aggregateTypeMapper() const;
181 
184  DtEntityTypeMapper& weaponFireMapper();
185 
188  const DtEntityTypeMapper& weaponFireMapper() const;
189 
192  DtEntityTypeMapper& detonationTypeMapper();
193 
196  const DtEntityTypeMapper& detonationTypeMapper() const;
197 
200  DtEntityTypeMapper& tacticalGraphicsMapper();
201 
204  const DtEntityTypeMapper& tacticalGraphicsMapper() const;
205 
208  DtEntityTypeMapper& radioCommunicationMapper();
209 
212  const DtEntityTypeMapper& radioCommunicationMapper() const;
213 
216  DtEntityTypeMapper& radioTransmissionMapper();
217 
220  const DtEntityTypeMapper& radioTransmissionMapper() const;
221 
224  DtEntityTypeMapper& iffReplyMapper();
225 
228  const DtEntityTypeMapper& iffReplyMapper() const;
229 
232  DtEntityTypeMapper& tacticalSmokeMapper();
233 
236  const DtEntityTypeMapper& tacticalSmokeMapper() const;
237 
239 
241  static DtUnicode chooseElementDefinition(const std::vector<DtUnicode>& definitions);
242 
244  static const std::string& className();
245 
246  protected:
247 
252 
255 
259  virtual void connectMapper( DtEntityTypeMapper& mapper );
260 
262  virtual void disconnectMapper( DtEntityTypeMapper& mapper );
263 
266  virtual void mapperChanged( const DtEntityType& type,
267  const DtUnicode& value, DtEntityTypeMapper& mapper );
268 
269  private:
270 
273  void initializeMapper( MapperType mapperType,
274  const std::string& backupName );
275 
276  protected:
277 
279  std::vector<DtUnicode> myEmptyMappings;
280 
281  static const char* theMapperNames[];
282 
283  typedef std::unordered_map<MapperType,DtEntityTypeMapper*> MappersMap;
284 
286 
287  makVrv::vrvSignalsLib::connection myMappingAddedConnection;
288  makVrv::vrvSignalsLib::connection myMappingRemovedConnection;
289 
290  };
291 
292 }
a read settings lock on a setting object. The object can only get read access aka const functions...
Definition: DtReadSettingsLock.h:48
#define DT_DLL_VRVVRL
Definition: vrvVrl.h:19
A unicode string. DtUnicode stores a UTF-16 encoded unicode string. Code Point, a Unicode character...
Definition: DtUnicode.h:33
MappersMap myMappers
Definition: DtSharedSimulationSettings.h:285
An EntityType to Definition mapper.
Definition: DtEntityTypeMapper.h:34
MapperType
Definition: DtSharedSimulationSettings.h:52
The shared settings manager, is the global object responsible for managing any shared settings object...
Definition: DtSharedSettingsManager.h:42
makVrv::vrvSignalsLib::connection myMappingAddedConnection
Definition: DtSharedSimulationSettings.h:287
The base class for all shared settings. Actual settings class should have the following members/decla...
Definition: DtSharedSettings.h:45
std::vector< DtUnicode > myEmptyMappings
Empty vector, for returning the reference which will always be empty.
Definition: DtSharedSimulationSettings.h:279
Contains the DtSharedSettings class declaration.
The shared simulation settings.
Definition: DtSharedSimulationSettings.h:32
a write settings lock on a setting object. The object can be read and modified, but no other threads ...
Definition: DtWriteSettingsLock.h:47
std::unordered_map< MapperType, DtEntityTypeMapper * > MappersMap
Definition: DtSharedSimulationSettings.h:283
makVrv::vrvSignalsLib::connection myMappingRemovedConnection
Definition: DtSharedSimulationSettings.h:288
#define SIMSETTINGSMAPPERS
Definition: DtSharedSimulationSettings.h:38
Contains DLL export macros.

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)