VR-Forces 4.0.4 Class Documentation
Public Types | Public Member Functions | Protected Attributes | Private Member Functions
makVrv::DtStringKeyConverter Class Reference

DtStringKeyConverter is used to convert string-based keys, used in files for things like model sets and observer settings. More...

List of all members.

Public Types

typedef std::map< std::string,
int > 
StringKeyToIntKeyMap
 Type of map of string keys to integer keys.
typedef std::map< int,
std::string > 
IntKeyToStringKeyMap
 Type of map of integer keys to sting keys.

Public Member Functions

 DtStringKeyConverter ()
 CTOR.
 ~DtStringKeyConverter ()
 DTOR.
int registerStringKey (const std::string &stringKey)
 Register a new string key.
void registerStringKey (const std::string &stringKey, int intKey)
 Register a new string key, specifying the integer key to use.
int lookupIntKey (const std::string &stringKey) const
 Look up the integer key for this string key.
const std::string * findStringKey (int intKey) const
 Look up the string key for this integr key.
const StringKeyToIntKeyMapstringKeys () const
 Get the map of string keys to integer keys.
const IntKeyToStringKeyMapintKeys () const
 Get the map of integer keys to string keys.
void removeKey (int intKey)
 Remove a key from the system, based on it's int value.
void removeKey (const std::string &stringKey)
 Remove a key from the system, based on it's string value.

Protected Attributes

StringKeyToIntKeyMap myStringKeyToIntKeyMap
IntKeyToStringKeyMap myIntKeyToStringKeyMap
int myNextIntKey

Private Member Functions

 DtStringKeyConverter (const DtStringKeyConverter &)
 Copy Constructor (unimplemented)
DtStringKeyConverteroperator= (const DtStringKeyConverter &)
 Assignment Operator (unimplemented)

Detailed Description

DtStringKeyConverter is used to convert string-based keys, used in files for things like model sets and observer settings.

The string-based keys make it easier to ensure uniqueness when we may have random plugins creating new keys, but allows us to convert those keys to integers for runtime use. When we need to save, we can convert the integers back to the original string keys. The string key converter provides an integer key on the create key call. DtStringKeyConverters are typically owned and used by managers that read and write settings files.


Member Typedef Documentation

typedef std::map< std::string, int > makVrv::DtStringKeyConverter::StringKeyToIntKeyMap

Type of map of string keys to integer keys.

typedef std::map< int, std::string > makVrv::DtStringKeyConverter::IntKeyToStringKeyMap

Type of map of integer keys to sting keys.


Constructor & Destructor Documentation

CTOR.

DTOR.

Copy Constructor (unimplemented)


Member Function Documentation

DtStringKeyConverter& makVrv::DtStringKeyConverter::operator= ( const DtStringKeyConverter ) [private]

Assignment Operator (unimplemented)

int makVrv::DtStringKeyConverter::registerStringKey ( const std::string &  stringKey)

Register a new string key.

The created integer is returned. Returns -1 if the key already exists.

void makVrv::DtStringKeyConverter::registerStringKey ( const std::string &  stringKey,
int  intKey 
)

Register a new string key, specifying the integer key to use.

Only use this if you know your keyspace!

int makVrv::DtStringKeyConverter::lookupIntKey ( const std::string &  stringKey) const

Look up the integer key for this string key.

Returns -1 if the string key doesn't exist

const std::string* makVrv::DtStringKeyConverter::findStringKey ( int  intKey) const

Look up the string key for this integr key.

Returns "" if the integer key doesn't exist

Get the map of string keys to integer keys.

Useful for iterating over

Get the map of integer keys to string keys.

Useful for iterating over

Remove a key from the system, based on it's int value.

void makVrv::DtStringKeyConverter::removeKey ( const std::string &  stringKey)

Remove a key from the system, based on it's string value.


Member Data Documentation


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)