realroot_doc 0.1.1
|
00001 /******************************************************************* 00002 * This file is part of the source code of the realroot kernel. 00003 * Author(s): B. Mourrain, GALAAD, INRIA 00004 * $Id: $ 00005 ********************************************************************/ 00006 #ifndef realroot_variables_hpp 00007 #define realroot_variables_hpp 00008 //=================================================================== 00009 #include <string> 00010 #include <sstream> 00011 #include <map> 00062 //====================================================================== 00063 namespace mmx { 00064 //====================================================================== 00065 struct variables { 00066 00067 int _nbvar; 00068 std::map<std::string,int> _index_of_var; 00069 std::map<int,std::string> _var_of_index; 00070 00071 variables():_nbvar(0) {} 00072 00074 variables(const char* s) {*this=s;} 00076 std::string& let(int i, const std::string& s); 00078 std::string operator[](int i); 00080 std::string operator[](int i) const; 00082 int operator[](const std::string& s); 00084 variables& operator=(const char* s); 00085 00086 int nbvar() const {return _nbvar;} 00087 int size () const {return _nbvar;} 00088 00089 static variables default_; 00090 00091 }; 00092 00093 template<class C> 00094 struct printer { 00095 template<class OSTREAM> static OSTREAM& 00096 print( OSTREAM& os, const C& c, const variables& Var) 00097 { 00098 os<<c; 00099 } 00100 }; 00101 00102 //====================================================================== 00103 } // namespace mmx 00104 //====================================================================== 00105 #endif // realroot_variables_hpp