![]() |
VR-Forces 4.0.4 Class Documentation
|
00001 /****************************************************************************** 00002 ** Copyright (c) 2010 MAK Technologies, Inc. 00003 ** All rights reserved. 00004 ******************************************************************************/ 00005 /****************************************************************************** 00006 ** $RCSfile: DtStringKeyConverter.h,v $ $Revision: 1.1 $ $State: Exp $ 00007 ******************************************************************************/ 00008 00012 00013 #pragma once 00014 00015 #include <vrvCore/vrvCore.h> 00016 00017 #include <map> 00018 #include <string> 00019 00020 namespace makVrv 00021 { 00022 class DtDe; 00023 00033 class DT_DLL_VRVCORE DtStringKeyConverter 00034 { 00035 public: 00036 00038 typedef std::map< std::string, int > StringKeyToIntKeyMap; 00040 typedef std::map< int, std::string > IntKeyToStringKeyMap; 00041 00043 DtStringKeyConverter(); 00044 00046 ~DtStringKeyConverter(); 00047 00048 private: 00050 DtStringKeyConverter(const DtStringKeyConverter&); 00051 00053 DtStringKeyConverter& operator=(const DtStringKeyConverter&); 00054 00055 public: 00056 00059 int registerStringKey( const std::string& stringKey ); 00060 00063 void registerStringKey( const std::string& stringKey, int intKey ); 00064 00067 int lookupIntKey( const std::string& stringKey ) const; 00068 00071 const std::string* findStringKey( int intKey ) const; 00072 00075 const StringKeyToIntKeyMap& stringKeys() const; 00076 00079 const IntKeyToStringKeyMap& intKeys() const; 00080 00082 void removeKey( int intKey ); 00083 00085 void removeKey( const std::string& stringKey ); 00086 00087 protected: 00088 00089 StringKeyToIntKeyMap myStringKeyToIntKeyMap; 00090 IntKeyToStringKeyMap myIntKeyToStringKeyMap; 00091 int myNextIntKey; 00092 }; 00093 00094 } 00095 00096