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 FAUDES_SYMBOLTABLE_H
00025 #define FAUDES_SYMBOLTABLE_H
00026 
00027 #include "definitions.h"
00028 #include "interface.h"
00029 #include "exception.h"
00030 #include "helper.h" 
00031 #include <algorithm>
00032 #include <map>
00033 #include <set>
00034 #include <limits>
00035 #include <iostream>
00036 #include <sstream>
00037 
00038 namespace faudes {
00039 
00054 class SymbolTable : FAUDES_TYPE {
00055 public:
00056 
00058   SymbolTable(void);
00059 
00061   std::string Name(void) const;
00062     
00064   void Name(const std::string& rName);
00065 
00067   Idx Size(void);
00068 
00070   void Clear(void);
00071 
00072 
00074   Idx MaxIndex(void) const;
00075 
00084   void MaxIndex(Idx index);
00085 
00087   Idx LastIndex(void) const;
00088 
00097   std::string Symbol(Idx index) const;
00098 
00108   Idx Index(const std::string& rName) const;
00109 
00118   bool Exists(Idx index) const;
00119   
00128   bool Exists(const std::string& rName) const;
00129 
00130 
00143   static bool ValidSymbol(const std::string& rName);
00144     
00155   std::string UniqueSymbol(const std::string& rName) const;
00156     
00171   Idx InsEntry(Idx index, const std::string& rName);
00172 
00173     
00186   Idx InsEntry(const std::string& rName);
00187 
00188 
00203   void SetEntry(Idx index, const std::string& rName);
00204     
00211   void SetDefaultSymbol(Idx index);
00212 
00220   void ClrEntry(Idx index);
00221     
00229   void ClrEntry(const std::string& rName);
00230 
00234   static SymbolTable* GlobalEventSymbolTablep(void);
00235 
00236 
00237  private:
00238 
00240   std::string mMyName;
00241     
00243   std::map<std::string,Idx> mIndexMap;
00244     
00246   std::map<Idx,std::string> mNameMap;
00247 
00249   Idx mMaxIndex;
00250     
00252   Idx mNextIndex;
00253 
00255   static SymbolTable msEventSymbolTable;
00256 
00258   void DoRead(TokenReader& rTr,  const std::string& rLabel = "", const Type* pContext=0);
00259 
00261   void DoWrite(TokenWriter& rTw, const std::string& rLabel="",const Type* pContext=0) const;
00262 };
00263 
00264 
00265 } // namespace faudes
00266 
00267 #endif

Generated on Mon Nov 10 08:13:15 2008 for libFAUDES 2.11v by  doxygen 1.4.4