|
OpenADFortTk (basic)
|
00001 // -*-Mode: C++;-*- 00002 // $Header: /m_home/m_utkej/Argonne/cvs2svn/cvs/OpenADFortTk/src/lib/support/XAIFSymToSymbolMap.h,v 1.1 2007-10-08 18:28:33 utke Exp $ 00003 00004 #ifndef XAIFSymToSymbolMap_H 00005 #define XAIFSymToSymbolMap_H 00006 00007 #include <map> 00008 #include <string> 00009 #include <iostream> 00010 00011 #include "WhirlIDMaps.h" 00012 00013 namespace fortTkSupport { 00014 00015 class Symbol; 00016 00017 class XAIFSymToSymbolMap { 00018 00019 public: 00020 // Constructor allocates an empty data structure 00021 XAIFSymToSymbolMap(); 00022 virtual ~XAIFSymToSymbolMap(); 00023 00024 // Find: Returns NULL if not found 00025 Symbol* Find(const char* scopeid, const char* symid) const; 00026 00027 // Insert: insert <'scopeid'+'symid', ST*> pair in the map and 00028 // return true; if the key already exists, the operation fails and 00029 // returns false. 00030 bool Insert(const char* scopeid, const char* symid, const Symbol* sym); 00031 00032 // Return number of entries 00033 unsigned int GetSize() const { return strToSymMap.size(); } 00034 00035 static std::string MakeKey(const char* scopeid, const char* symid); 00036 00037 private: 00038 typedef std::map<std::string, Symbol*> StringToSymMap; 00039 typedef StringToSymMap::iterator StringToSymMapIt; 00040 typedef StringToSymMap::const_iterator StringToSymMapItC; 00041 typedef StringToSymMap::value_type StringToSymMapVal; 00042 00043 private: 00044 StringToSymMap strToSymMap; 00045 }; 00046 00047 } 00048 00049 #endif