GiNaCRA
0.6.4
|
00001 /* 00002 * GiNaCRA - GiNaC Real Algebra package 00003 * Copyright (C) 2010-2012 Ulrich Loup, Joachim Redies, Sebastian Junges 00004 * 00005 * This file is part of GiNaCRA. 00006 * 00007 * GiNaCRA is free software: you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published by 00009 * the Free Software Foundation, either version 3 of the License, or 00010 * (at your option) any later version. 00011 * 00012 * GiNaCRA is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with GiNaCRA. If not, see <http://www.gnu.org/licenses/>. 00019 * 00020 */ 00021 00022 00023 #ifndef GINACRA_SYMBOL_DB_H 00024 #define GINACRA_SYMBOL_DB_H 00025 00026 #include <ginac/ginac.h> 00027 00028 using std::vector; 00029 using std::map; 00030 using std::out_of_range; 00031 using GiNaC::symbol; 00032 using GiNaC::ex_is_less; 00033 00034 namespace GiNaCRA 00035 { 00046 class SymbolDB 00047 { 00048 public: 00049 00051 // Con- and destructors // 00053 00059 SymbolDB( std::string stdname ); 00060 00062 // Operators // 00064 00070 const symbol operator []( unsigned i ) const; 00071 00079 unsigned operator []( const symbol& v ) const; 00080 00085 unsigned addSymbol(); 00086 00092 unsigned addSymbol( std::string name ); 00093 00098 unsigned addSymbol( symbol s ); 00099 00104 std::list<symbol> getSymbolList() const 00105 { 00106 return std::list<symbol>( mVariables.begin(), mVariables.end() ); 00107 } 00108 00113 std::vector<symbol> getSymbolVector() const 00114 { 00115 return mVariables; 00116 } 00117 00118 unsigned size() 00119 { 00120 return mVariables.size(); 00121 } 00122 00123 protected: 00124 vector<symbol> mVariables; 00125 std::map<symbol, unsigned, GiNaC::ex_is_less> mSymbollist; 00126 std::string mStdName; 00127 00128 }; // class SymbolDB 00129 00130 } // namespace GiNaCRA 00131 00132 #endif