symboltable.h

Go to the documentation of this file.
00001 
00003 /* FAU Discrete Event Systems Library (libfaudes)
00004 
00005 Copyright (C) 2006  Bernd Opitz
00006 Copywrite (C) 2007 Thomas Moor
00007 Exclusive copyright is granted to Klaus Schmidt
00008 
00009 This library is free software; you can redistribute it and/or
00010 modify it under the terms of the GNU Lesser General Public
00011 License as published by the Free Software Foundation; either
00012 version 2.1 of the License, or (at your option) any later version.
00013 
00014 This library is distributed in the hope that it will be useful,
00015 but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017 Lesser General Public License for more details.
00018 
00019 You should have received a copy of the GNU Lesser General Public
00020 License along with this library; if not, write to the Free Software
00021 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
00022 
00023 
00024 #ifndef SYMBOLTABLE_H
00025 
00026 #include "definitions.h"
00027 #include "exception.h"
00028 #include "helper.h" 
00029 #include <algorithm>
00030 #include <map>
00031 #include <set>
00032 #include <limits>
00033 #include <iostream>
00034 #include <sstream>
00035 
00036 namespace faudes {
00037 
00052 class SymbolTable {
00053 public:
00054 
00056   SymbolTable(void);
00057 
00059   std::string Name(void) const;
00060     
00062   void Name(const std::string& rName);
00063 
00065   Idx Size(void);
00066 
00068   void Clear(void);
00069 
00070 
00072   Idx MaxIndex(void) const;
00073 
00082   void MaxIndex(Idx index);
00083 
00085   Idx LastIndex(void) const;
00086 
00095   std::string Symbol(Idx index) const;
00096 
00106   Idx Index(const std::string& rName) const;
00107 
00116   bool Exists(Idx index) const;
00117   
00126   bool Exists(const std::string& rName) const;
00127 
00128 
00141   static bool ValidSymbol(const std::string& rName);
00142     
00153   std::string UniqueSymbol(const std::string& rName) const;
00154     
00169   Idx InsEntry(Idx index, const std::string& rName);
00170 
00171     
00184   Idx InsEntry(const std::string& rName);
00185 
00186 
00199   void SetEntry(Idx index, const std::string& rName);
00200     
00207   void SetDefaultSymbol(Idx index);
00208 
00216   void ClrEntry(Idx index);
00217     
00225   void ClrEntry(const std::string& rName);
00226 
00230   static SymbolTable* GlobalEventSymbolTablep(void);
00231 
00232 
00233  private:
00234 
00236   std::string mMyName;
00237     
00239   std::map<std::string,Idx> mIndexMap;
00240     
00242   std::map<Idx,std::string> mNameMap;
00243 
00245   Idx mMaxIndex;
00246     
00248   Idx mNextIndex;
00249 
00251   static SymbolTable msEventSymbolTable;
00252 
00253 };
00254 
00255 
00256 
00257 
00258 
00259 
00260 } // namespace faudes
00261 
00262 #define SYMBOLTABLE_H
00263 #endif

Generated on Fri May 9 11:26:47 2008 for libFAUDES 2.09b by  doxygen 1.4.4