VR-Forces 4.5 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
makVrv::DtSharedSimulationSettingsManager Class Reference

The shared settings manager handles low level access to the settings. More...

Inheritance diagram for makVrv::DtSharedSimulationSettingsManager:
Inheritance graph
[legend]

Public Member Functions

virtual ~DtSharedSimulationSettingsManager ()
 DTOR.
void connectInputSignals ()
 Connects to signals indicating the settings need updating.
void loadDefaultMappings (DtEntityTypeMapper &mapper, bool useFactory)
 Saving and loading is NOT thread save, these functions must be called in the main thread (because they use DtDe).
void saveDefaultMappings ()
 Save the default settings, this will internally acquire a read lock (released at end).
void saveDefaultMappings (const DtEntityTypeMapper &mapper)
 Save a default mapper.
void loadMapFile (const std::string &filePath, DtEntityTypeMapper &mapper)
 Load an entity type mapper from a file.
void mergeMapFile (const std::string &filePath, DtEntityTypeMapper &mapper)
 Merge an entity type mapper from a file.
void saveMapFile (const std::string &filePath, const DtEntityTypeMapper &mapper)
 Save an entity type mapper to a file.
void saveSelectedMapFile (const std::string &filePath, std::vector< std::string > &keys, const DtEntityTypeMapper &mapper)
 Save an entity type mapper to a file.
bool shouldLoadDefaultMappings (const DtDeSettings *setting)
 For this simulation object mapping, should we load by default? ex.
bool shouldMergeMappings (const DtDeSettings *setting)
 For this simulation object mapping, should we merge in settings (if we have them) after loading defaults? ex.
const std::vector< std::string > getFilesToMerge (const DtDeSettings *setting)
bool hasTypeMapSuffix (DtDeSettings *settings)
void setAutoSave (bool b)
 Sets whether the manager should save settings as they change.
bool autoSave () const
 Gets whether the manager saves settings as they change.
- Public Member Functions inherited from makVrv::DtVirtualBaseClass
 DtVirtualBaseClass ()
 Do nothing constructor.
virtual ~DtVirtualBaseClass ()
 Virtual do nothing destructor.

Static Public Member Functions

static
DtSharedSimulationSettingsManager
instance (DtDe &de)
 Static instance method.

Protected Member Functions

virtual void mapperChanged (const DtEntityTypeMapper &)
 Called when a mapper has changed, saves if autosave is true.
virtual void backupMapper (DtEntityTypeMapper &)
 Called when a mapper wants to be backed up.
virtual void entityTypeMappingsRestored (const DtSettingsBackup *)
 Called when a mapping is restored, save out if auto save is true.
virtual bool mergeTypeMappings (const std::string &dir)
 Read additional type files in a directory (*.metx, etc.) and merge their records Return true if all files were able to be processed Note: skips files that have errors.
virtual bool mergeTypeMappingFile (const std::string &fileName)
 Read a type mapping file (*.metx, etc.) and merge the records Return true if file exists and was read.
virtual bool mergeTypeMappingsFromPath (makArchives::DtEntityTypeMappingRecord &record, DtDeSettings *settings, const std::string &fileOrDir)
 Read mapping from a directory with extension specified by the settings.
std::string generateDefaultDir (DtDeSettings *settings)
 Generate the path to the default type mapping directory return "" if path cannot be generated from settings (path may or may not exist on disk)
void generateDefaultDirAndFiles (DtDeSettings *settings, std::string &defaultDir, std::vector< std::string > &defaultDirFiles)
 Generate default directory and list any files there.
std::string generateFactoryDir (DtDeSettings *settings)
 Generate the path to the factory type mapping directory return "" if path cannot be generated from settings (path may or may not exist on disk)
void generateFactoryDirAndFiles (DtDeSettings *settings, std::string &factoryDir, std::vector< std::string > &factoryDirFiles)
 Generate factory directory and list any files there.
 DtSharedSimulationSettingsManager (DtDe &de)
 CTOR.

Private Member Functions

void initializeMappings ()
 Initializes the cockpit mappings from the settings file.
void initDefaultMappings (bool useFactory)
 Load the default settings, this will acquire a write lock (released at end).

Private Attributes

DtSignalConnectionManager myConnections
bool myAutoSave
std::string myTypeMapSuffix
DtDemyDe

Detailed Description

The shared settings manager handles low level access to the settings.

  This object is not thread safe. It will auto save changes though. To
  access or change settings use the following thread-safe methods:

  @code 

DtWriteSettingsLock<DtSharedSimulationSettings> settings(DtSharedSettingsManager::instance(myAgentManager.de())); or:

DtReadSettingsLock<DtSharedSimulationSettings>

Constructor & Destructor Documentation

virtual makVrv::DtSharedSimulationSettingsManager::~DtSharedSimulationSettingsManager ( )
virtual

DTOR.

makVrv::DtSharedSimulationSettingsManager::DtSharedSimulationSettingsManager ( DtDe de)
protected

CTOR.

Member Function Documentation

static DtSharedSimulationSettingsManager& makVrv::DtSharedSimulationSettingsManager::instance ( DtDe de)
static

Static instance method.

void makVrv::DtSharedSimulationSettingsManager::connectInputSignals ( )

Connects to signals indicating the settings need updating.

Connects to the signal indicating a mapping has changed, and connects to the signal indicating the settings backup has been restored.

void makVrv::DtSharedSimulationSettingsManager::loadDefaultMappings ( DtEntityTypeMapper mapper,
bool  useFactory 
)

Saving and loading is NOT thread save, these functions must be called in the main thread (because they use DtDe).

Warning
This function needs a write lock in place to be safe.
void makVrv::DtSharedSimulationSettingsManager::saveDefaultMappings ( )

Save the default settings, this will internally acquire a read lock (released at end).

void makVrv::DtSharedSimulationSettingsManager::saveDefaultMappings ( const DtEntityTypeMapper mapper)

Save a default mapper.

Warning
This function needs a read lock in place to be safe.
void makVrv::DtSharedSimulationSettingsManager::loadMapFile ( const std::string &  filePath,
DtEntityTypeMapper mapper 
)

Load an entity type mapper from a file.

Warning
This function needs a write lock in place to be safe.
void makVrv::DtSharedSimulationSettingsManager::mergeMapFile ( const std::string &  filePath,
DtEntityTypeMapper mapper 
)

Merge an entity type mapper from a file.

Warning
This function needs a write lock in place to be safe.
void makVrv::DtSharedSimulationSettingsManager::saveMapFile ( const std::string &  filePath,
const DtEntityTypeMapper mapper 
)

Save an entity type mapper to a file.

Warning
This function needs a read lock in place to be safe.
void makVrv::DtSharedSimulationSettingsManager::saveSelectedMapFile ( const std::string &  filePath,
std::vector< std::string > &  keys,
const DtEntityTypeMapper mapper 
)

Save an entity type mapper to a file.

Warning
This function needs a read lock in place to be safe.
bool makVrv::DtSharedSimulationSettingsManager::shouldLoadDefaultMappings ( const DtDeSettings setting)

For this simulation object mapping, should we load by default? ex.

false if –noAppData{Entity,Aggregate,TacticalGraphics}TypeMap

bool makVrv::DtSharedSimulationSettingsManager::shouldMergeMappings ( const DtDeSettings setting)

For this simulation object mapping, should we merge in settings (if we have them) after loading defaults? ex.

true if –merge{Entity,Aggregate,TacticalGraphics}TypeMap

const std::vector<std::string> makVrv::DtSharedSimulationSettingsManager::getFilesToMerge ( const DtDeSettings setting)
bool makVrv::DtSharedSimulationSettingsManager::hasTypeMapSuffix ( DtDeSettings settings)
void makVrv::DtSharedSimulationSettingsManager::setAutoSave ( bool  b)

Sets whether the manager should save settings as they change.

bool makVrv::DtSharedSimulationSettingsManager::autoSave ( ) const

Gets whether the manager saves settings as they change.

virtual void makVrv::DtSharedSimulationSettingsManager::mapperChanged ( const DtEntityTypeMapper )
protectedvirtual

Called when a mapper has changed, saves if autosave is true.

virtual void makVrv::DtSharedSimulationSettingsManager::backupMapper ( DtEntityTypeMapper )
protectedvirtual

Called when a mapper wants to be backed up.

Get lock on appropriate objects to back-up.

virtual void makVrv::DtSharedSimulationSettingsManager::entityTypeMappingsRestored ( const DtSettingsBackup )
protectedvirtual

Called when a mapping is restored, save out if auto save is true.

virtual bool makVrv::DtSharedSimulationSettingsManager::mergeTypeMappings ( const std::string &  dir)
protectedvirtual

Read additional type files in a directory (*.metx, etc.) and merge their records Return true if all files were able to be processed Note: skips files that have errors.

virtual bool makVrv::DtSharedSimulationSettingsManager::mergeTypeMappingFile ( const std::string &  fileName)
protectedvirtual

Read a type mapping file (*.metx, etc.) and merge the records Return true if file exists and was read.

virtual bool makVrv::DtSharedSimulationSettingsManager::mergeTypeMappingsFromPath ( makArchives::DtEntityTypeMappingRecord record,
DtDeSettings settings,
const std::string &  fileOrDir 
)
protectedvirtual

Read mapping from a directory with extension specified by the settings.

std::string makVrv::DtSharedSimulationSettingsManager::generateDefaultDir ( DtDeSettings settings)
protected

Generate the path to the default type mapping directory return "" if path cannot be generated from settings (path may or may not exist on disk)

void makVrv::DtSharedSimulationSettingsManager::generateDefaultDirAndFiles ( DtDeSettings settings,
std::string &  defaultDir,
std::vector< std::string > &  defaultDirFiles 
)
protected

Generate default directory and list any files there.

std::string makVrv::DtSharedSimulationSettingsManager::generateFactoryDir ( DtDeSettings settings)
protected

Generate the path to the factory type mapping directory return "" if path cannot be generated from settings (path may or may not exist on disk)

void makVrv::DtSharedSimulationSettingsManager::generateFactoryDirAndFiles ( DtDeSettings settings,
std::string &  factoryDir,
std::vector< std::string > &  factoryDirFiles 
)
protected

Generate factory directory and list any files there.

void makVrv::DtSharedSimulationSettingsManager::initializeMappings ( )
private

Initializes the cockpit mappings from the settings file.

void makVrv::DtSharedSimulationSettingsManager::initDefaultMappings ( bool  useFactory)
private

Load the default settings, this will acquire a write lock (released at end).

This method is intentionally private as it should only be called once, and from the constructor of this class

Member Data Documentation

DtSignalConnectionManager makVrv::DtSharedSimulationSettingsManager::myConnections
private
bool makVrv::DtSharedSimulationSettingsManager::myAutoSave
private
std::string makVrv::DtSharedSimulationSettingsManager::myTypeMapSuffix
private
DtDe& makVrv::DtSharedSimulationSettingsManager::myDe
private

The documentation for this class was generated from the following file:

Document ID: Generated on Thu Mar 23 18:54:12 EDT 2017 from SVN revision 174804
Copyright © 2005-2017 VT MÄK. All Rights Reserved (www.mak.com)