VR-Forces 4.0.4 Class Documentation
include/vrvVrl/DtSharedSimulationSettings.h
Go to the documentation of this file.
00001 /*****************************************************************************
00002  * Copyright (c) 2012 MAK Technologies, Inc.
00003  * All rights reserved.
00004  *****************************************************************************/
00005 
00009 
00010 #pragma once
00011 
00012 #include <vrvVrl/vrvVrl.h>
00013 #include <vrvCore/DtSharedSettings.h>
00014 #include <boost/unordered_map.hpp>
00015 #include <vrvUtil/DtUnicode.h>
00016 #include <vector>
00017 
00018 class DtEntityType;
00019 
00020 namespace makVrv
00021 {
00022 
00023    class DtEntityTypeMapper;
00024    class DtSharedSimulationSettings;
00025 
00028    class DT_DLL_VRVVRL DtSharedSimulationSettings : public DtSharedSettings
00029    {
00030    public:
00031 
00032       // X Macro for entity mapper types.
00033       // http://www.drdobbs.com/blogs/cpp/228700289
00034 #define SIMSETTINGSMAPPERS \
00035    X(FireTypeMap) \
00036    X(EntityTypeMap) \
00037    X(AggregateTypeMap) \
00038    X(DetonationTypeMap) \
00039    X(TacticalGraphicsMap) \
00040    X(RadioCommunicationsMap) \
00041    X(RadioTransmissionsMap) \
00042    X(NumSimSettingsMappers)
00043 
00044       // X macro definition and enum declaration.
00045 #define X(a) Sim##a,
00046       enum MapperType { SIMSETTINGSMAPPERS };
00047 #undef X
00048 
00049    public:
00050 
00052       virtual ~DtSharedSimulationSettings();
00053 
00055       virtual void setMapper( MapperType mapperType,
00056          const DtEntityTypeMapper& mapper );
00057 
00060 
00062       void setMapping( MapperType mapperType, const DtEntityType& type, const DtUnicode& definition );
00063 
00065       void setEntityModelMapping( const DtEntityType& type, const DtUnicode& definition );
00066 
00068       void setAggregateModelMapping( const DtEntityType& type, const DtUnicode& definition );
00069 
00071       void setTacticalGraphicsMapping( const DtEntityType& type, const DtUnicode& definition );
00072 
00074       void setFireModelMapping( const DtEntityType& type, const DtUnicode& definition );
00075 
00077       void setDetonationModelMapping( const DtEntityType& type, const DtUnicode& definition );
00078 
00080       void setRadioCommunicationsMapping( const DtEntityType& type, const DtUnicode& definition );
00081 
00083       void setRadioTransmissionsMapping( const DtEntityType& type, const DtUnicode& definition );
00084 
00086 
00089 
00092       const std::vector<DtUnicode>& mapDefinition( MapperType mapperType, const DtEntityType& type ) const;
00093 
00096       const std::vector<DtUnicode>& mapEntityDefinition( const DtEntityType& type ) const;
00097 
00100       const std::vector<DtUnicode>& mapAggregateDefinition( const DtEntityType& type ) const;
00101 
00104       const std::vector<DtUnicode>& mapFireTypeDefinition( const DtEntityType& type ) const;
00105 
00108       const std::vector<DtUnicode>& mapDetonationDefinition( const DtEntityType& type ) const;
00109 
00112       const std::vector<DtUnicode>& mapTacticalGraphicsDefinition( const DtEntityType& type ) const;
00113 
00116       const std::vector<DtUnicode>& mapRadioCommunicationDefinition( const DtEntityType& type ) const;
00117 
00120       const std::vector<DtUnicode>& mapRadioTransmissionDefinition( const DtEntityType& type ) const;
00121 
00123 
00126 
00128       DtEntityTypeMapper* findMapperByName( const std::string& name );
00129 
00131       const DtEntityTypeMapper* findMapperByName( const std::string& name ) const;
00132 
00134 
00137 
00140       DtEntityTypeMapper& typeMapper( MapperType type );
00141 
00144       const DtEntityTypeMapper& typeMapper( MapperType type ) const;
00145 
00148       DtEntityTypeMapper& entityTypeMapper();
00149 
00152       const DtEntityTypeMapper& entityTypeMapper() const;
00153 
00156       DtEntityTypeMapper& aggregateTypeMapper();
00157 
00160       const DtEntityTypeMapper& aggregateTypeMapper() const;
00161 
00164       DtEntityTypeMapper& weaponFireMapper();
00165 
00168       const DtEntityTypeMapper& weaponFireMapper() const;
00169 
00172       DtEntityTypeMapper& detonationTypeMapper();
00173 
00176       const DtEntityTypeMapper& detonationTypeMapper() const;
00177 
00180       DtEntityTypeMapper& tacticalGraphicsMapper();
00181 
00184       const DtEntityTypeMapper& tacticalGraphicsMapper() const;
00185 
00188       DtEntityTypeMapper& radioCommunicationMapper();
00189 
00192       const DtEntityTypeMapper& radioCommunicationMapper() const;
00193 
00196       DtEntityTypeMapper& radioTransmissionMapper();
00197 
00200       const DtEntityTypeMapper& radioTransmissionMapper() const;
00201 
00203 
00205       static std::string className();
00206 
00207    protected:
00208 
00210       friend class DtReadSettingsLock<DtSharedSimulationSettings>;
00212       friend class DtWriteSettingsLock<DtSharedSimulationSettings>;
00213 
00215       DtSharedSimulationSettings( DtSharedSettingsManager& manager );
00216 
00220       virtual void connectMapper( DtEntityTypeMapper& mapper );
00221 
00223       virtual void disconnectMapper( DtEntityTypeMapper& mapper );
00224 
00227       virtual void mapperChanged( const DtEntityType& type,
00228          const DtUnicode& value, DtEntityTypeMapper& mapper );
00229 
00230    private:
00231 
00234       void initializeMapper( MapperType mapperType,
00235          const std::string& backupName );
00236 
00237    protected:
00238 
00240       std::vector<DtUnicode> myEmptyMappings;
00241 
00242       static char* theMapperNames[];
00243 
00244       typedef boost::unordered_map<MapperType,DtEntityTypeMapper*> MappersMap;
00245 
00246       MappersMap myMappers;
00247 
00248    };
00249 
00250 }

Document ID: Generated on Fri Jun 29 16:33:32 EDT 2012 from SVN revision 116588
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)