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

Maintains a list of enumerations read in from files. The dictionary supports two different types of enumerations:

All enumerations have an identifying uid. This is used to differentiate one list of enumerations from another. Entity type enumerations do not need to have uids provided, as they can be identified by their higher level applicability.

Public Types

typedef std::map< int, DtEnumInfoEnumMap
 
typedef std::map< DtEntityType,
DtString
EntityTypeDescriptionMap
 
typedef std::map< DtEnumUid,
DtString
UidToNameMap
 

Public Member Functions

 DtEnumDictionary ()
 
virtual ~DtEnumDictionary ()
 
virtual void print (std::ostream &strm) const
 
const UidToNameMapuidToNameMap () const
 
Entity Type Enumerations

Functions for adding and looking up entity type enumerations.

virtual EnumMap entityTypeEnumValues (DtEntityTypeField fieldLevel, const DtEntityType &higherLevelFields=DtEntityType::defaultType()) const
 
virtual int entityTypeValueFromName (DtEntityTypeField fieldLevel, const DtString &name, const DtEntityType &higherLevelFields=DtEntityType::defaultType()) const
 
virtual DtString entityTypeNameFromValue (DtEntityTypeField fieldLevel, const DtEntityType &entityType) const
 
virtual DtString displayName (const DtEntityType &, bool includeKind=true, int stopAt=DtSubcategoryField, bool *isDeprecated=0) const
 
virtual void findEntriesContaining (const DtString &text, EntityTypeDescriptionMap &results, int maxResults)
 
virtual bool isDeprecatedEntityTypeValue (DtEntityTypeField fieldLevel, const DtEntityType &entityType) const
 
virtual void addEntityTypeEnum (DtEntityTypeField fieldLevel, const EnumMap &enums, const DtEntityTypeRange &applic=DtEntityTypeRange::AllEntityTypes())
 
virtual void addEntityTypeEnumWithUid (DtEnumUid uid, DtEntityTypeField fieldLevel, const EnumMap &enums, const DtEntityTypeRange &applic=DtEntityTypeRange::AllEntityTypes())
 
General Enumerations

Functions for adding and looking up general enumerations.

virtual void addEnum (DtEnumUid uid, const EnumMap &list, const DtString &name)
 
virtual void merge (const DtEnumDictionary &)
 
virtual const EnumMapenumValues (DtEnumUid uid) const
 
virtual int nextId (DtEnumUid uid) const
 
virtual DtString enumName (DtEnumUid uid) const
 
virtual std::vector< DtEnumUidenumUid (const DtString &name) const
 
virtual int enumValueFromName (DtEnumUid uid, const DtString &n) const
 
virtual DtString enumNameFromValue (DtEnumUid uid, int v) const
 
virtual bool hasNameFromValue (DtEnumUid uid, int val) const
 
virtual bool removeValue (DtEnumUid uid, int val)
 
virtual bool isDeprecatedValue (DtEnumUid uid, int val) const
 

Static Public Attributes

static const unsigned theMakUidRangeStart = 1000000
 
static const unsigned theMakUidRangeEnd = 2000000
 
static const unsigned theVrfUidRangeStart = 2000000
 
static const unsigned theVrfUidRangeEnd = 3000000
 
static const unsigned theAssignedUidRangeStart = 10000000
 

Protected Types

typedef std::multimap
< DtString, DtEnumUid
NameToUidMap
 
typedef std::map< DtEnumUid,
EnumMap
UidEnumMap
 
typedef std::vector< EnumMapUidEnumList
 
typedef std::map
< DtEntityTypeRange, DtEnumUid
TypeRangeUidMap
 
typedef std::vector
< TypeRangeUidMap
EntityTypeUidList
 
typedef std::multimap
< DtString, std::pair
< DtEntityType, DtString > > 
DescriptionEntityTypeMap
 

Protected Member Functions

virtual void mergeEnumMap (EnumMap &dest, const EnumMap &src) const
 
virtual DtEnumUid getAssignedUid ()
 
virtual void printMap (const EnumMap &enumMap, std::ostream &strm, unsigned indentLvl) const
 
virtual void printMap (const TypeRangeUidMap &enumMap, std::ostream &strm, unsigned indentLvl) const
 

Static Protected Member Functions

static void setEntityTypeField (DtEntityType &entityType, DtEntityTypeField field, int val)
 
static int getEntityTypeField (const DtEntityType &entityType, DtEntityTypeField field)
 

Protected Attributes

DtEnumUid myNextAssignedUid
 
Entity Type Enumeration Storage
UidEnumMap myEntityTypeEnums
 
EntityTypeUidList myEntityTypeApplicabilityList
 
DescriptionEntityTypeMap myEntityTypeDescriptions
 
UidEnumMap myEnums
 
NameToUidMap myNameToUidMap
 
UidToNameMap myUidToNameMap
 

Static Protected Attributes

static const EnumMap theEmptyMap
 

Member Typedef Documentation

typedef std::map<DtEntityType, DtString> DtEnumDictionary::EntityTypeDescriptionMap
typedef std::multimap<DtString, DtEnumUid> DtEnumDictionary::NameToUidMap
protected

Needs to be a multimap because there is no guarantee text is unique.

typedef std::map<DtEnumUid, EnumMap> DtEnumDictionary::UidEnumMap
protected
typedef std::vector<EnumMap> DtEnumDictionary::UidEnumList
protected
typedef std::vector<TypeRangeUidMap> DtEnumDictionary::EntityTypeUidList
protected
typedef std::multimap<DtString, std::pair<DtEntityType, DtString> > DtEnumDictionary::DescriptionEntityTypeMap
protected

Needs to be a multimap because items on different entity type branches may have matching names.

Constructor & Destructor Documentation

DtEnumDictionary::DtEnumDictionary ( )

Constructor - constructs an empty dictionary.

virtual DtEnumDictionary::~DtEnumDictionary ( )
virtual

Destructor.

Member Function Documentation

virtual EnumMap DtEnumDictionary::entityTypeEnumValues ( DtEntityTypeField  fieldLevel,
const DtEntityType &  higherLevelFields = DtEntityType::defaultType() 
) const
virtual

Returns the map of enumerated values that are defined at the given field level. If higherLevelFields are specified, then it finds the values at that level that are applicable to the higher level fields of the given entity type. Example:

EnumMap enumeration = dict.entityTypeEnumValues(DtCategoryField, DtEntityType(1, 2, 255, -1, -1, -1, -1));
virtual int DtEnumDictionary::entityTypeValueFromName ( DtEntityTypeField  fieldLevel,
const DtString name,
const DtEntityType &  higherLevelFields = DtEntityType::defaultType() 
) const
virtual

Returns the specific entity type field enumerated value that matches the specified name. Will use the specified higher level entity type fields to determine which of the enumerations at the specified field level will be searched.

virtual DtString DtEnumDictionary::entityTypeNameFromValue ( DtEntityTypeField  fieldLevel,
const DtEntityType &  entityType 
) const
virtual

Returns the specific entity type field enumerated value name that matches the specified entity type.

virtual DtString DtEnumDictionary::displayName ( const DtEntityType &  ,
bool  includeKind = true,
int  stopAt = DtSubcategoryField,
bool isDeprecated = 0 
) const
virtual

Given the entity type, return a name that best represents the type. The last non-wildcarded item will be used as the name.

virtual void DtEnumDictionary::findEntriesContaining ( const DtString text,
EntityTypeDescriptionMap results,
int  maxResults 
)
virtual

Finds entity type descriptions containing the specified text.

virtual bool DtEnumDictionary::isDeprecatedEntityTypeValue ( DtEntityTypeField  fieldLevel,
const DtEntityType &  entityType 
) const
virtual

Returns true if the the specified entity type has been deprecated at the given field level.

virtual void DtEnumDictionary::addEntityTypeEnum ( DtEntityTypeField  fieldLevel,
const EnumMap enums,
const DtEntityTypeRange applic = DtEntityTypeRange::AllEntityTypes() 
)
virtual

Adds an enumeration at the given field level, with an optional applicability. If no applicability is specified then it is assumed it is relevant to all higher level entity types (e.g. -1:-1:-1:-1:-1:-1:-1).

virtual void DtEnumDictionary::addEntityTypeEnumWithUid ( DtEnumUid  uid,
DtEntityTypeField  fieldLevel,
const EnumMap enums,
const DtEntityTypeRange applic = DtEntityTypeRange::AllEntityTypes() 
)
virtual

Adds an enumeration with a specified uid at the given field level, with an optional applicability. If no applicability is specified then it is assumed it is relevant to all higher level entity types (e.g. -1:-1:-1:-1:-1:-1:-1).

virtual void DtEnumDictionary::addEnum ( DtEnumUid  uid,
const EnumMap list,
const DtString name 
)
virtual

Adds a new enum and list of values to the dictionary. If already present, merges the new list with the existing, preferring the existing where they conflict.

virtual void DtEnumDictionary::merge ( const DtEnumDictionary )
virtual

Merges the contents of the supplied dictionary into this dictionary.

virtual const EnumMap& DtEnumDictionary::enumValues ( DtEnumUid  uid) const
virtual

Returns the enumerated values and descriptions for the enumeration with the given uid.

virtual int DtEnumDictionary::nextId ( DtEnumUid  uid) const
virtual

Given the enum id, with the map, return the next highest key, assuming an ordered EnumMap Returns the name of the enumeration with the given uid.

virtual DtString DtEnumDictionary::enumName ( DtEnumUid  uid) const
virtual

Adds a new enum and list of values to the dictionary. If already present, merges the new list with the existing, preferring the existing where they conflict.

virtual std::vector<DtEnumUid> DtEnumDictionary::enumUid ( const DtString name) const
virtual

Returns the uids of any enumerations with the given name. Usually there is only one, but there is no guarantee of unique names.

virtual int DtEnumDictionary::enumValueFromName ( DtEnumUid  uid,
const DtString n 
) const
virtual

Maps the name of enumerated value of a given enumeration to its value.

virtual DtString DtEnumDictionary::enumNameFromValue ( DtEnumUid  uid,
int  v 
) const
virtual

Maps an enumerated value of a given enumeration to its name.

virtual bool DtEnumDictionary::hasNameFromValue ( DtEnumUid  uid,
int  val 
) const
virtual

Returns true if the name and value exist.

virtual bool DtEnumDictionary::removeValue ( DtEnumUid  uid,
int  val 
)
virtual

Removes the value from the enum. Returns true if remove successful.

virtual bool DtEnumDictionary::isDeprecatedValue ( DtEnumUid  uid,
int  val 
) const
virtual

Returns true if this enumerated value has been deprecated.

virtual void DtEnumDictionary::print ( std::ostream &  strm) const
virtual

Prints the lists of enumerations within this dictionary to the given stream.

const UidToNameMap& DtEnumDictionary::uidToNameMap ( ) const
inline
virtual void DtEnumDictionary::mergeEnumMap ( EnumMap dest,
const EnumMap src 
) const
protectedvirtual

Merges the src map into the dest map, keeping values in the dest when they conflict.

virtual DtEnumUid DtEnumDictionary::getAssignedUid ( )
protectedvirtual

For enumerations without configured uids, assign one from the pool of values starting with theAssignedUidRangeStart.

virtual void DtEnumDictionary::printMap ( const EnumMap enumMap,
std::ostream &  strm,
unsigned  indentLvl 
) const
protectedvirtual

Prints the enum map to the specified stream with indentation.

virtual void DtEnumDictionary::printMap ( const TypeRangeUidMap enumMap,
std::ostream &  strm,
unsigned  indentLvl 
) const
protectedvirtual

Prints the enum map to the specified stream with indentation.

static void DtEnumDictionary::setEntityTypeField ( DtEntityType &  entityType,
DtEntityTypeField  field,
int  val 
)
staticprotected

Sets the specified field in the entity type with the given value.

static int DtEnumDictionary::getEntityTypeField ( const DtEntityType &  entityType,
DtEntityTypeField  field 
)
staticprotected

Returns the value of the specified field in the entity type.

Member Data Documentation

const unsigned DtEnumDictionary::theMakUidRangeStart = 1000000
static

The start of the general MAK uid range.

const unsigned DtEnumDictionary::theMakUidRangeEnd = 2000000
static

The end of the general MAK uid range.

const unsigned DtEnumDictionary::theVrfUidRangeStart = 2000000
static

The start of the VRF uid range.

const unsigned DtEnumDictionary::theVrfUidRangeEnd = 3000000
static

The end of the VRF uid range.

const unsigned DtEnumDictionary::theAssignedUidRangeStart = 10000000
static

Some entity enumerations are not defined with a uid, but the dictionary will assign one from a pool of ids starting with this value.

UidEnumMap DtEnumDictionary::myEntityTypeEnums
protected

All of the defined entity type enumerations, mapped by uid, where uids are assigned when not defined by the calling application.

EntityTypeUidList DtEnumDictionary::myEntityTypeApplicabilityList
protected

A map to provide lookups from entity type applicability in higher level fields to the uid of the available enumerated values. This, for example, provides a lookup to find the uid of the category enumeration for all military, ground, US entities.

DescriptionEntityTypeMap DtEnumDictionary::myEntityTypeDescriptions
protected

Map of entity type descriptions to their enumerated types.

UidEnumMap DtEnumDictionary::myEnums
protected

All of the defined general enumerations mapped by uid. uid must be defined when added to this dictionary.

NameToUidMap DtEnumDictionary::myNameToUidMap
protected

Map of descriptive enumeration names to their uids.

UidToNameMap DtEnumDictionary::myUidToNameMap
protected

Map of uids to their descriptive enumeration names.

DtEnumUid DtEnumDictionary::myNextAssignedUid
protected

The next uid that can be assigned to an entity type enumeration without a uid defined.

const EnumMap DtEnumDictionary::theEmptyMap
staticprotected

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

Document ID: Generated on Tue Sep 24 19:28:17 EDT 2024 from SVN revision 269799
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)