VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Private Member Functions
DtVrfParameterDb Class Reference

Instances of DtVrfParameterDb are the database of DtVrfObjectParameters objects used in the construction of DtSimObjects. The database is a collection of DtVrfObjectParameters objects, keyed on DtEntityType. When a new DtLocalObject is created through the DtLocalObjectManager, it looks up the appropriate DtVrfObjectParameters entry in the database, and uses the information contained in the entry to direct its construction.
The database can be used to get parametric data about a given type of entity (for example, to make behavior decisions) by using the lookup function in the DB. Access to the DB is generally obtained via:

simulationServices()->parameterDatabase();
Inheritance diagram for DtVrfParameterDb:
Inheritance graph
[legend]

Public Member Functions

 DtVrfParameterDb ()
 
virtual ~DtVrfParameterDb ()
 
virtual bool init ()
 
virtual DtVrfParameterDbEntryadd (const DtEntityType &objectType, DtVrfObjectParameters *parameters)
 
virtual DtVrfObjectParameterslookup (const DtEntityType &objectType, DtEntityType *matchingType=NULL, DtString *source=NULL) const
 
virtual std::list< const
DtVrfObjectParameters * > 
lookupByEquipmentName (const DtString &equipmentName) const
 
std::set< DtEntityType > lookupByObjectTypePattern (const DtEntityType &objectTypePattern) const
 
virtual DtString equipmentName (const DtEntityType &objectType, int &count) const
 
virtual void remove (const DtEntityType &objectType)
 
virtual void removeAll ()
 
virtual const DtList & parameterList () const
 
virtual bool load (const DtFilename &filename, bool preloadParameters=false)
 
virtual bool save (const DtFilename &filename)
 
virtual void addParameters (const DtEntityType &objectType, DtVrfObjectParameters *newParameters)
 
virtual DtVrfObjectParameterslookupParameters (const DtEntityType &objectType, DtEntityType *matchingType) const
 
virtual void removeParameters (const DtEntityType &objectType)
 
virtual void removeAndDeleteAll ()
 
virtual DtVrfParameterDbEntrylookupParameterDbEntry (const DtEntityType &objectType, DtEntityType *matchingType) const
 
virtual int numParameterEntries () const
 
virtual std::list< DtString > * getSysDefExtensionList ()
 
virtual void addExtension (DtString)
 

Static Public Member Functions

static DtVrfParameterDbcreate ()
 

Public Attributes

boost::signals2::signal< void(DtVrfObjectParameters *)> signal_parameterLoaded
 

Protected Member Functions

virtual void addParameterDbEntry (DtVrfParameterDbEntry *newParameterEntry)
 
virtual DtListItem * lookupParameters (const DtEntityType &objectType) const
 
void emptyList ()
 
virtual DtVrfParameterDbEntrycreateParameterEntry () const
 

Protected Attributes

DtList myParameterList
 
std::map< DtString, std::list
< const DtVrfObjectParameters * > > 
myEquipmentToParamsMap
 
tbb::spin_rw_mutex myEquipmentToParamsMapMutex
 
std::map< DtString, std::set
< DtEntityType > > 
myObjTypePatternToParamsMap
 
tbb::spin_rw_mutex myObjTypePatternToTypesMapMutex
 

Private Member Functions

 DtVrfParameterDb (const DtVrfParameterDb &orig)
 
DtVrfParameterDboperator= (const DtVrfParameterDb &orig)
 

Constructor & Destructor Documentation

DtVrfParameterDb::DtVrfParameterDb ( )

default constructor

virtual DtVrfParameterDb::~DtVrfParameterDb ( )
virtual

destructor

DtVrfParameterDb::DtVrfParameterDb ( const DtVrfParameterDb orig)
private

copy constructor - not implemented

Member Function Documentation

virtual bool DtVrfParameterDb::init ( )
virtual

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

Reimplemented in DtMtlParameterDb.

virtual DtVrfParameterDbEntry* DtVrfParameterDb::add ( const DtEntityType &  objectType,
DtVrfObjectParameters parameters 
)
virtual

Add a new parameter entry to database. It will replace the current entry for the given object type, if one exists. This class assumes responsibility for deleting memory associated with parameters added through addParameters.

virtual DtVrfObjectParameters* DtVrfParameterDb::lookup ( const DtEntityType &  objectType,
DtEntityType *  matchingType = NULL,
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). If source is specified, it will be set to a string indicating the source data for the parameters which is appropriate for displaying on the console.

Reimplemented in DtMtlParameterDb.

virtual std::list<const DtVrfObjectParameters*> DtVrfParameterDb::lookupByEquipmentName ( const DtString equipmentName) const
virtual

Some entity types, in particular in the AggregateLevel SMS, may have a Parameter Property defined called Primary-Equipment. This is a name (along with a count) that is like the type description from the DIS enumeration document for the equivalent EntityLevel entity. This function takes an equipment name and provides a list of parameter entries for types that have this as Primary Equipment. The object parameters entries are found by searching through all of the entries in the database; however, a map is created to cache the results found. This map stays in effect until the database is cleared (when a new SMS is loaded).

std::set<DtEntityType> DtVrfParameterDb::lookupByObjectTypePattern ( const DtEntityType &  objectTypePattern) const

This function takes an object type and treats it as a pattern utilizing wildcards, indicated as -1 and provides a set of parameter entries for types that match the pattern. The object parameters entries are found by searching through all of the entries in the database; however, a map is created to cache the results found. This map stays in effect until the database is cleared (when a new SMS is loaded).

virtual DtString DtVrfParameterDb::equipmentName ( const DtEntityType &  objectType,
int count 
) const
virtual

This function provides a shortcut to get the primary equipment parameter property for the given object type. Count is the number of this equipment in the object type (i.e., the Count field of the Primary-Equipment structure). Returns the null string if the given type does not have an exact match or if it does not have this parameter property.

virtual void DtVrfParameterDb::remove ( const DtEntityType &  objectType)
virtual

Remove the entry for the given object type from the database. Deletes the memory associated with the entry.

virtual void DtVrfParameterDb::removeAll ( )
virtual

Remove all entries in the parameter database. Deletes memory associated with entries in the database.

Reimplemented in DtMtlParameterDb.

virtual const DtList& DtVrfParameterDb::parameterList ( ) const
virtual

List of all DtVrfParameterDbEntry* items in the database.

virtual bool DtVrfParameterDb::load ( const DtFilename &  filename,
bool  preloadParameters = false 
)
inlinevirtual

Load the contents of a file into the parameter database. If the preloadParameters value is true will load all the parameters found in the database from disk (versus waiting until it is needed)

Reimplemented in DtMtlParameterDb.

virtual bool DtVrfParameterDb::save ( const DtFilename &  filename)
inlinevirtual

Save current contents of the parameter database to file.

Reimplemented in DtMtlParameterDb.

virtual void DtVrfParameterDb::addParameters ( const DtEntityType &  objectType,
DtVrfObjectParameters newParameters 
)
virtual
Deprecated:
To be removed after VR-Forces version 3.11 Call add() instead.
virtual DtVrfObjectParameters* DtVrfParameterDb::lookupParameters ( const DtEntityType &  objectType,
DtEntityType *  matchingType 
) const
virtual
Deprecated:
To be removed after VR-Forces version 3.11 Call lookup() instead.
virtual void DtVrfParameterDb::removeParameters ( const DtEntityType &  objectType)
virtual
Deprecated:
To be removed after VR-Forces version 3.11 Call remove() instead.
virtual void DtVrfParameterDb::removeAndDeleteAll ( )
virtual
Deprecated:
To be removed after VR-Forces version 3.11 Call removeAll() instead.
virtual DtVrfParameterDbEntry* DtVrfParameterDb::lookupParameterDbEntry ( const DtEntityType &  objectType,
DtEntityType *  matchingType 
) const
virtual

Returns entry most closely matching given object type. Returns object type of the entry that was found (which may be less specific than given object type).

virtual int DtVrfParameterDb::numParameterEntries ( ) const
virtual

Returns the number of parameter entries.

virtual std::list<DtString>* DtVrfParameterDb::getSysDefExtensionList ( )
virtual

Get the list of sysdef extensions currently accepted. This can be modified so you may add, remove, or reorder the extensions. Extensions are used to load alternate sysdefs. For example, if you add an extension of "myextension", your human-myextension.sysdef file will load if it exists, instead of human.sysdef.

virtual void DtVrfParameterDb::addExtension ( DtString  )
virtual

Add a new extension to the back of the line. The extensions added last are considered more important than the extensions added first.

static DtVrfParameterDb* DtVrfParameterDb::create ( )
static

Returns a new instance of this class.

virtual void DtVrfParameterDb::addParameterDbEntry ( DtVrfParameterDbEntry newParameterEntry)
protectedvirtual

Add news item to database. If entry with an exactly matching DtEntityType already exists, removes and deletes the existing entry before adding the new one. Inserts new entry into list of entries in the order of most general DtEntityType (e.g. -1 -1 -1 -1 -1 -1 -1 -1) to most specific (e.g. 1 1 225 3 1 3 1 1), where -1 is a wildcard, and fields are ordered from left to right as most general to most specific.

virtual DtListItem* DtVrfParameterDb::lookupParameters ( const DtEntityType &  objectType) const
protectedvirtual

Returns DtListItem (containing DtVrfParameterDbEntry*) for given object type.

void DtVrfParameterDb::emptyList ( )
protected

Empties contents of database, deleting memory associated with each entry. Not virtual because its called by the destructor.

virtual DtVrfParameterDbEntry* DtVrfParameterDb::createParameterEntry ( ) const
protectedvirtual

Creates a new type of parameter entry. Override to create your own derived type.

Reimplemented in DtMtlParameterDb.

DtVrfParameterDb& DtVrfParameterDb::operator= ( const DtVrfParameterDb orig)
private

assignment operator - not implemented

Member Data Documentation

boost::signals2::signal<void (DtVrfObjectParameters*)> DtVrfParameterDb::signal_parameterLoaded

Signal sent out when a parameter is loaded.

DtList DtVrfParameterDb::myParameterList
protected

List of DtVrfParameterDbEntry* objects.

std::map< DtString, std::list<const DtVrfObjectParameters*> > DtVrfParameterDb::myEquipmentToParamsMap
mutableprotected

A cache of equipment name to db entry list mappings. This is filled in as queries are made with lookupByEquipmentName calls are made. If queries are made that return empty lists, those are entered in the map as well.

tbb::spin_rw_mutex DtVrfParameterDb::myEquipmentToParamsMapMutex
mutableprotected
std::map< DtString, std::set<DtEntityType> > DtVrfParameterDb::myObjTypePatternToParamsMap
mutableprotected

A cache of generic object type pattern to specific object type mappings. This is filled in as queries are made with lookupByObjectTypePattern calls are made. If queries are made that return empty sets, those are entered in the map as well.

tbb::spin_rw_mutex DtVrfParameterDb::myObjTypePatternToTypesMapMutex
mutableprotected

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

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)