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 VARIABLEPOOL_H 00024 #define VARIABLEPOOL_H 00025 00026 #include "SymbolDB.h" 00027 00028 namespace GiNaCRA 00029 { 00037 class VariableListPool 00038 { 00039 public: 00040 VariableListPool(); 00041 00046 static unsigned addVariable() 00047 { 00048 return GlobalVariables->addSymbol(); 00049 } 00050 00051 static unsigned addVariable( symbol s ) 00052 { 00053 return GlobalVariables->addSymbol( s ); 00054 } 00055 00060 static unsigned addParameter() 00061 { 00062 return GlobalParameters->addSymbol(); 00063 } 00064 00070 inline static GiNaC::symbol getVariableSymbol( unsigned index ) 00071 { 00072 return (*GlobalVariables)[index]; 00073 } 00074 00080 inline static GiNaC::symbol getParameterSymbol( unsigned index ) 00081 { 00082 return (*GlobalParameters)[index]; 00083 } 00084 00089 inline static std::list<symbol> getVariableList() 00090 { 00091 return GlobalVariables->getSymbolList(); 00092 } 00093 00098 inline static std::vector<symbol> getVariables() 00099 { 00100 return GlobalVariables->getSymbolVector(); 00101 } 00102 00103 inline static void ensureNrVariables( unsigned nrOfVars ) 00104 { 00105 for( unsigned i = GlobalVariables->size(); i <= nrOfVars; ++i ) 00106 { 00107 GlobalVariables->addSymbol(); 00108 } 00109 } 00110 00115 static bool Initialize(); 00116 00117 protected: 00118 00119 static SymbolDB* GlobalVariables; 00120 static SymbolDB* GlobalParameters; 00121 static map<symbol, symbol> Matching; 00122 static bool mInitialized; 00123 00124 }; 00125 00126 } 00127 00128 #endif