![]() |
VR-Forces Developer's Guide
|
The DtModelSemanticsMapper object is responsible for mapping Names of model semantics declarations (for example states, articulated parts etc) To integers.

Classes | |
| struct | Parts |
| struct | States |
Public Member Functions | |
| virtual DtModelSemanticsMapper * | clone () |
| virtual | ~DtModelSemanticsMapper () |
| const std::string * | findStateName (States::Id id) const |
| const States::Id * | findStateId (const std::string &name) const |
| const std::string * | findPartName (Parts::Id id) const |
| const Parts::Id * | findPartId (const std::string &name) const |
| void | addState (const std::string &name, States::Id id) |
| void | removeState (const std::string &name) |
| States::Id | findFreeUserStateId () const |
| void | addPart (const std::string &name, Parts::Id id) |
| void | removePart (const std::string &name) |
Public Member Functions inherited from makVrv::DtVirtualBaseClass | |
| DtVirtualBaseClass () | |
| virtual | ~DtVirtualBaseClass () |
Static Public Member Functions | |
| static DtModelSemanticsMapper & | instance (DtDe &) |
| static void | copyInstance (DtBaseConnection &con, DtDe &de) |
| static DtModelSemanticsMapper & | instance (DtBaseConnection &con) |
Protected Types | |
| typedef std::map< std::string, States::Id > | StateNameToIdMap |
| typedef std::map< States::Id, std::string > | StateIdToNameMap |
| typedef std::map< std::string, Parts::Id > | PartNameToIdMap |
| typedef std::map< Parts::Id, std::string > | PartIdToNameMap |
Protected Member Functions | |
| virtual std::string | cleanUpName (const std::string &) const |
| virtual bool | partNameIsNumber (const std::string &partName) const |
| DtModelSemanticsMapper () | |
| virtual void | initialize (DtDe &de) |
| void | loadSubsystemDamageMappingsFromCsv (std::string csvFilePath) |
Protected Attributes | |
| StateNameToIdMap | myStateNamesToIds |
| StateIdToNameMap | myStateIdsToNames |
| PartNameToIdMap | myPartNamesToIds |
| PartIdToNameMap | myPartIdsToNames |
| std::unordered_map < std::string, unsigned short > | myDamageFunctionNameToNumMap |
| std::unordered_map< unsigned short, std::string > | myDamageFunctionNumToNameMap |
| std::string | myDamageSystemMappingsFileName |
Friends | |
| class | DtModelSemanticsMapperCreator |
| static int | calculateDamageSystemZoneId (const unsigned short functionNum, const unsigned short zoneNum) |
| std::string | damageSystemZoneName (const unsigned short functionNum, const unsigned short zoneNum) const |
| const States::Id * | findDamageSystemZoneId (const std::string &functionName, const std::string &zoneName) const |
| const States::Id * | findDamageSystemZoneId (const std::string &functionZoneName) const |
| void | addDamageSystemFunction (const std::string &functionName, const unsigned short functionNum) |
| void | removeDamageSystemFunction (const std::string &functionName) |
| std::string | damageSystemFunctionName (const unsigned short functionNum) const |
| const unsigned short | findDamageSystemFunctionNum (const std::string &functionName) const |
| bool | getDamageZoneIdInts (States::Id zoneId, unsigned short &outFunctionNum, unsigned short &outZoneNum) const |
|
protected |
|
protected |
|
protected |
|
protected |
|
virtual |
|
protected |
|
static |
|
virtual |
Clone function so derived classes can be used with copyInstance.
|
static |
Copy the instance from DtDe to DtVrlinkBaseConnection.
|
static |
get the instance from the DtVrlinkBaseConnection
| const std::string* makVrv::DtModelSemanticsMapper::findStateName | ( | States::Id | id | ) | const |
Search for a state name for the id.
| NULL | if no name was found. |
| const States::Id* makVrv::DtModelSemanticsMapper::findStateId | ( | const std::string & | name | ) | const |
Search for a state name for the id. Note if id is actually an integer encoded as a string, the string is converted to an integer and cast to a StateId, it will then also attempt to search for the proper id pointer in the map.
| NULL | if no id was found. |
| const std::string* makVrv::DtModelSemanticsMapper::findPartName | ( | Parts::Id | id | ) | const |
Search for a part name for the id.
| NULL | if no name was found. |
| const Parts::Id* makVrv::DtModelSemanticsMapper::findPartId | ( | const std::string & | name | ) | const |
Search for a part name for the id. Note if id is actually an integer encoded as a string, the string is converted to an integer and cast to a Parts::Ids, it will then also attempt to search for the proper id pointer in the map.
| NULL | if no id was found. |
| void makVrv::DtModelSemanticsMapper::addState | ( | const std::string & | name, |
| States::Id | id | ||
| ) |
Add a particular state.
| void makVrv::DtModelSemanticsMapper::removeState | ( | const std::string & | name | ) |
Remove a state.
| States::Id makVrv::DtModelSemanticsMapper::findFreeUserStateId | ( | ) | const |
Find the first unused state id in the user-defined range [States::user_start, States::user_end] by searching myStateIdsToNames.
| States::invalidId | if no free id is available in the range. |
| void makVrv::DtModelSemanticsMapper::addPart | ( | const std::string & | name, |
| Parts::Id | id | ||
| ) |
Add a part.
| void makVrv::DtModelSemanticsMapper::removePart | ( | const std::string & | name | ) |
Remove a part.
|
static |
Subsystem Damage switch hit_zone 1:1 switch hit_zone weapon : switch hit_zone weapon : primary_weapon_system_1.
Calculate the unique damage system zone id from function number and zone number.
| std::string makVrv::DtModelSemanticsMapper::damageSystemZoneName | ( | const unsigned short | functionNum, |
| const unsigned short | zoneNum | ||
| ) | const |
Subsystem Damage switch hit_zone 1:1 switch hit_zone weapon : switch hit_zone weapon : primary_weapon_system_1.
Calculate the unique damage system zone id from function number and zone number.
| const States::Id* makVrv::DtModelSemanticsMapper::findDamageSystemZoneId | ( | const std::string & | functionName, |
| const std::string & | zoneName | ||
| ) | const |
Subsystem Damage switch hit_zone 1:1 switch hit_zone weapon : switch hit_zone weapon : primary_weapon_system_1.
Calculate the unique damage system zone id from function number and zone number.
| const States::Id* makVrv::DtModelSemanticsMapper::findDamageSystemZoneId | ( | const std::string & | functionZoneName | ) | const |
Subsystem Damage switch hit_zone 1:1 switch hit_zone weapon : switch hit_zone weapon : primary_weapon_system_1.
Calculate the unique damage system zone id from function number and zone number.
| void makVrv::DtModelSemanticsMapper::addDamageSystemFunction | ( | const std::string & | functionName, |
| const unsigned short | functionNum | ||
| ) |
Subsystem Damage switch hit_zone 1:1 switch hit_zone weapon : switch hit_zone weapon : primary_weapon_system_1.
Calculate the unique damage system zone id from function number and zone number.
| void makVrv::DtModelSemanticsMapper::removeDamageSystemFunction | ( | const std::string & | functionName | ) |
Subsystem Damage switch hit_zone 1:1 switch hit_zone weapon : switch hit_zone weapon : primary_weapon_system_1.
Calculate the unique damage system zone id from function number and zone number.
| std::string makVrv::DtModelSemanticsMapper::damageSystemFunctionName | ( | const unsigned short | functionNum | ) | const |
Subsystem Damage switch hit_zone 1:1 switch hit_zone weapon : switch hit_zone weapon : primary_weapon_system_1.
Calculate the unique damage system zone id from function number and zone number.
| const unsigned short makVrv::DtModelSemanticsMapper::findDamageSystemFunctionNum | ( | const std::string & | functionName | ) | const |
Subsystem Damage switch hit_zone 1:1 switch hit_zone weapon : switch hit_zone weapon : primary_weapon_system_1.
Calculate the unique damage system zone id from function number and zone number.
| bool makVrv::DtModelSemanticsMapper::getDamageZoneIdInts | ( | States::Id | zoneId, |
| unsigned short & | outFunctionNum, | ||
| unsigned short & | outZoneNum | ||
| ) | const |
Given a damage zone id, extract the function number and zone number. Returns false if not found or out of range.
|
protectedvirtual |
Function for transforming an input name into a valid search name. This removes any space padding, transforms the alpha characters to lower case and all internal spaces to underscores.
|
protectedvirtual |
Function for determining if a articulated part name is all digits.
|
protectedvirtual |
Called by instance function on creation of only Mapper instance.
|
protected |
Load subsystem damage mappings from CSV file. If the file cannot be opened or parsed, this silently returns and allows the hardcoded fallback in initialize() to be used.
|
friend |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |