VR-Forces 4.0.4 Class Documentation
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Member Functions
DtMtlParameterDb Class Reference

Instances of DtMtlParameterDb are a database of DtVrfObjectParameters* entries that are loaded from an MTL (Mak Technologies Lisp) format file. More...

Inheritance diagram for DtMtlParameterDb:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 DtMtlParameterDb ()
 default constructor
virtual ~DtMtlParameterDb ()
 destructor
virtual bool init ()
 Initialization - must be called before any other public member functions are called.
virtual DtMtlParameterDbEntryadd (const DtObjectType &objectType, const DtFilename &filename, DtVrfObjectParameters *newParameters=NULL)
 Add a new entry to the parameter database, keyed on DtObjectType.
virtual void createRemoteConfigurationList ()
 discard existing pMyRemoteConfigurationList and recreate using myRemoteConfigListCreatorFcn This is called from init();
virtual DtVrfObjectParameterslookup (const DtObjectType &objectType, DtObjectType *matchingType, DtString *source=NULL) const
 Lookup entry in parameter database that most closely matches given objectType.
virtual bool load (const DtFilename &filename)
 Loads the contents of an MTL parameter database file (*.opd).
virtual bool loadAll (const DtFilename &filename)
 Loads MTL parameter database file and loads all .ope files it references.
DtRemoteConfigurationListremoteConfigurationList ()
const DtRemoteConfigurationListremoteConfigurationList () const
DtRemoteConfigurationList::CreatorFcn remoteConfigurationListCreatorFcn ()
void setRemoteConfigurationListCreatorFcn (DtRemoteConfigurationList::CreatorFcn fcn)
virtual bool save (const DtFilename &filename)
 Saves contents of parameter database to file.
virtual void removeAll ()
 Overridden to clear out the variable bindings.
virtual void setVersionNumber (int versionNumber)
 Version number of parameter database.
virtual int versionNumber () const
virtual void addDependentParameterFileToCopyPair (const DtFilename &fromFilename, const DtFilename &toFilename)
 Dependent parameter files (.asl, .hit, .frm, .det, .dmg) to copy upon save.
virtual void clearDependentParameterFileToCopyPairs ()
virtual const std::map
< std::string, std::string > & 
dependentParameterFileToCopyPairs () const
virtual void updateReaderWriterFilePaths (DtVrfObjectParameters &parameters)
 Updates paths to use relative-to-container convention for filenames in given parameters object.
DtMtlParameterDbReaderdbReader ()
DtMtlParameterDbWriterdbWriter ()
virtual DtFilename stripExtension (const DtFilename &filename, const DtString &extension)
 Strips the extension (the trailing portion of a filename starting with ".") from a given filename.
virtual void addVariableBindings (DtVariableBindingsSharedPtr bindings)
 Returns filename loaded.
virtual std::list
< DtVariableBindingsSharedPtr > & 
variableBindings ()
 Returns filename loaded.

Static Public Member Functions

static DtVrfParameterDbcreate ()
 Returns a new instance of this class.
static const DtStringopdFilenameExtension ()
 Default filename extension for parameter database file (.opd).
static const DtStringopeFilenameExtension ()
 Default filename extension for parameter database entry files (.ope).

Protected Member Functions

virtual DtMtlParameterDbReadercreateParamDbReader ()
 Factory method that creates parameter database reader object used in load().
virtual DtMtlParameterDbWritercreateMtlParamDbWriter ()
 Factory method that creates parameter database writer object used in save().
virtual bool copyDependentParameterDirectories (const DtFilename &oldPath, const DtFilename &newPath)
 Copies ammoselect, damage, detection, and hit subdirectories from oldPath location to newPath location.
virtual DtFilename getPath (const DtFilename &filename)
 Extracts path from a given filename.
virtual DtVrfObjectParametersgetParameters (DtMtlParameterDbEntry *entry) const
 Retrieves the parameters from a given parameter entry object.
virtual DtVrfParameterDbEntrycreateParameterEntry () const
 Override to create entry of type DtMtlParameterDbEntry.

Static Protected Member Functions

static const std::map
< DtString, DtFilename > & 
extensionToPathMap ()
 Map of filename extensions of dependent parameter files (.dmg, .hit, .asl, .frm, .det) to corrsponding directory paths (.

Protected Attributes

DtMtlParameterDbReadermyParameterDbReader
DtMtlParameterDbWritermyParameterDbWriter
int myVersionNumber
DtVariableBindingsList myVariableBindings
std::map< std::string,
std::string > 
myDependentParameterFileToCopyPairs
std::list
< DtVariableBindingsSharedPtr
myVariableBindingsList
 List of all top level variable bindings for each OPD file read in.
DtRemoteConfigurationListpMyRemoteConfigurationList
 List of DtRemoteConfigurationEntry* objects.
DtRemoteConfigurationList::CreatorFcn myRemoteConfigListCreatorFcn

Static Protected Attributes

static DtString theOpdFilenameExtension
static DtString theOpeFilenameExtension
static DtFilename theOldParameterDbDirectory
static std::map< DtString,
DtFilename > * 
theExtensionToPathMap

Private Member Functions

 DtMtlParameterDb (const DtMtlParameterDb &orig)
 copy constructor - not implemented
DtMtlParameterDboperator= (const DtMtlParameterDb &orig)
 assignment operator - not implemented

Detailed Description

Instances of DtMtlParameterDb are a database of DtVrfObjectParameters* entries that are loaded from an MTL (Mak Technologies Lisp) format file.


Constructor & Destructor Documentation

default constructor

virtual DtMtlParameterDb::~DtMtlParameterDb ( ) [virtual]

destructor

copy constructor - not implemented


Member Function Documentation

virtual bool DtMtlParameterDb::init ( ) [virtual]

Initialization - must be called before any other public member functions are called.

Reimplemented from DtVrfParameterDb.

virtual DtMtlParameterDbEntry* DtMtlParameterDb::add ( const DtObjectType objectType,
const DtFilename &  filename,
DtVrfObjectParameters newParameters = NULL 
) [virtual]

Add a new entry to the parameter database, keyed on DtObjectType.

If an entry with the exact object type already exists, then it will be removed and deleted before the new one is added. filename is the name of a object parameter entry file (*.ope), which is a MTL file containing the data representing a single DtVrfObjectParameter entry.

discard existing pMyRemoteConfigurationList and recreate using myRemoteConfigListCreatorFcn This is called from init();

virtual DtVrfObjectParameters* DtMtlParameterDb::lookup ( const DtObjectType objectType,
DtObjectType matchingType,
DtString source = NULL 
) const [virtual]

Lookup entry in parameter database that most closely matches given objectType.

If matchingType is specified, return the object type of the entry (which may be less specific than the object type being looked up). Loads the object parameter entry from given filename, if corresponding data for the entry has not yet been loaded. If source is specified, it will be set to the filename of the OPE file loaded for these parameters.

Reimplemented from DtVrfParameterDb.

virtual bool DtMtlParameterDb::load ( const DtFilename &  filename) [virtual]

Loads the contents of an MTL parameter database file (*.opd).

Reimplemented from DtVrfParameterDb.

virtual bool DtMtlParameterDb::loadAll ( const DtFilename &  filename) [virtual]

Loads MTL parameter database file and loads all .ope files it references.

virtual bool DtMtlParameterDb::save ( const DtFilename &  filename) [virtual]

Saves contents of parameter database to file.

Filename will be given .opd file extension if it does not already exist. Creates subdirectory of the same name minus the .opd extension and places individual object parameter entry files (.ope) for each entry in the database. Object parameter database file will contain list of filenames referencing individual .ope files.

Reimplemented from DtVrfParameterDb.

Reimplemented in DtExtMtlParameterDb.

virtual void DtMtlParameterDb::removeAll ( ) [virtual]

Overridden to clear out the variable bindings.

Reimplemented from DtVrfParameterDb.

virtual void DtMtlParameterDb::setVersionNumber ( int  versionNumber) [virtual]

Version number of parameter database.

Version number is stored in parameter databse file as of VR-Forces version 3.7. See CURRENT_PARAMETER_DB_FILE_FORMAT_VERSION at top of this file for latest version number.

virtual int DtMtlParameterDb::versionNumber ( ) const [virtual]
virtual void DtMtlParameterDb::addDependentParameterFileToCopyPair ( const DtFilename &  fromFilename,
const DtFilename &  toFilename 
) [virtual]

Dependent parameter files (.asl, .hit, .frm, .det, .dmg) to copy upon save.

These files are cached when a parameter database is loaded. Only the DtMtlParamDbReader and DtMtlParamDbWriter classes should need to call any of these functions.

virtual const std::map<std::string, std::string>& DtMtlParameterDb::dependentParameterFileToCopyPairs ( ) const [virtual]
virtual void DtMtlParameterDb::updateReaderWriterFilePaths ( DtVrfObjectParameters parameters) [virtual]

Updates paths to use relative-to-container convention for filenames in given parameters object.

Stores old/new parameter filenames in parameterDb, so if/when we go to write out the parameter database, it can find all of the files it need (to copy to the new path).

References myParameterDbReader.

References myParameterDbWriter.

virtual DtFilename DtMtlParameterDb::stripExtension ( const DtFilename &  filename,
const DtString extension 
) [virtual]

Strips the extension (the trailing portion of a filename starting with ".") from a given filename.

Returns filename loaded.

See also:
myVariableBindingsList

Returns filename loaded.

See also:
myVariableBindingsList

Returns a new instance of this class.

Reimplemented from DtVrfParameterDb.

Reimplemented in MyMtlParameterDb.

Default filename extension for parameter database file (.opd).

Default filename extension for parameter database entry files (.ope).

Factory method that creates parameter database reader object used in load().

Creates an instance of DtMtlParameterDbReader.

Reimplemented in DtExtMtlParameterDb, and MyMtlParameterDb.

Factory method that creates parameter database writer object used in save().

Creates an instance of DtMtlParameterDbWriter.

Reimplemented in DtExtMtlParameterDb, and MyMtlParameterDb.

virtual bool DtMtlParameterDb::copyDependentParameterDirectories ( const DtFilename &  oldPath,
const DtFilename &  newPath 
) [protected, virtual]

Copies ammoselect, damage, detection, and hit subdirectories from oldPath location to newPath location.

Reimplemented in MyMtlParameterDb.

virtual DtFilename DtMtlParameterDb::getPath ( const DtFilename &  filename) [protected, virtual]

Extracts path from a given filename.

virtual DtVrfObjectParameters* DtMtlParameterDb::getParameters ( DtMtlParameterDbEntry entry) const [protected, virtual]

Retrieves the parameters from a given parameter entry object.

If the parameters component of an entry is non-NULL, returns the parameters. If the parameters component of an entry is NULL, loads the parameters from the filename given in the entry, storing the parameters in the entry, and then returns the parameters.

virtual DtVrfParameterDbEntry* DtMtlParameterDb::createParameterEntry ( ) const [protected, virtual]

Override to create entry of type DtMtlParameterDbEntry.

Reimplemented from DtVrfParameterDb.

Reimplemented in MyMtlParameterDb, and DtExtMtlParameterDb.

static const std::map<DtString, DtFilename>& DtMtlParameterDb::extensionToPathMap ( ) [static, protected]

Map of filename extensions of dependent parameter files (.dmg, .hit, .asl, .frm, .det) to corrsponding directory paths (.

\damage, .\hit, .\ammoselect, .\formation, .\detection). Used in updating legacy format parameter database files that mapped these supporting files relative to the application path.

DtMtlParameterDb& DtMtlParameterDb::operator= ( const DtMtlParameterDb orig) [private]

assignment operator - not implemented


Member Data Documentation

Referenced by dbReader().

Referenced by dbWriter().

DtFilename DtMtlParameterDb::theOldParameterDbDirectory [static, protected]
std::map<std::string, std::string> DtMtlParameterDb::myDependentParameterFileToCopyPairs [protected]

List of all top level variable bindings for each OPD file read in.

Additional OPD files read will add their bindings to the end if the list.

List of DtRemoteConfigurationEntry* objects.

Referenced by remoteConfigurationList().

std::map<DtString, DtFilename>* DtMtlParameterDb::theExtensionToPathMap [static, protected]

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

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)