Developer documentation

variables.hpp
Go to the documentation of this file.
1 /*******************************************************************
2  * This file is part of the source code of the realroot kernel.
3  * Author(s): B. Mourrain, GALAAD, INRIA
4  * $Id: $
5  ********************************************************************/
6 #ifndef realroot_variables_hpp
7 #define realroot_variables_hpp
8 //===================================================================
9 #include <string>
10 #include <sstream>
11 #include <map>
62 //======================================================================
63 namespace mmx {
64 //======================================================================
65 struct variables {
66 
67  int _nbvar;
68  std::map<std::string,int> _index_of_var;
69  std::map<int,std::string> _var_of_index;
70 
71  variables():_nbvar(0) {}
72 
74  variables(const char* s) {*this=s;}
76  std::string& let(int i, const std::string& s);
78  std::string operator[](int i);
80  std::string operator[](int i) const;
81 
83  int operator[](const std::string& s);
85  int operator[](const std::string& s) const;
86 
88  variables& operator=(const char* s);
89 
90  int nbvar() const {return _nbvar;}
91  int size () const {return _nbvar;}
92 
93  //static variables default_;
94 
95 };
96 
97  template<class C>
98  struct printer {
99  template<class OSTREAM> static OSTREAM&
100  print( OSTREAM& os, const C& c, const variables& Var)
101  {
102  os<<c;
103  }
104  };
105 
106 //======================================================================
107 } // namespace mmx
108 //======================================================================
109 #endif // realroot_variables_hpp
std::string & let(int i, const std::string &s)
Assign the variable of index i to be s.
Definition: variables.cpp:37
std::map< int, std::string > _var_of_index
Definition: variables.hpp:69
variables(const char *s)
Construction the list of variables from a string of the form "a b c ...".
Definition: variables.hpp:74
variables & operator=(const char *s)
Assign a set of variables from a string of the form "a b c ...".
Definition: variables.cpp:45
std::string operator[](int i)
Return the variable of index i.
Definition: variables.cpp:12
int _nbvar
Definition: variables.hpp:67
std::map< std::string, int > _index_of_var
Definition: variables.hpp:68
int size() const
Definition: variables.hpp:91
int nbvar() const
Definition: variables.hpp:90
static OSTREAM & print(OSTREAM &os, const C &c, const variables &Var)
Definition: variables.hpp:100
const C & c
Definition: Interval_glue.hpp:45
variables()
Definition: variables.hpp:71
double C
Definition: solver_mv_fatarcs.cpp:16
int Var(const T &v)
Definition: sign_variation.hpp:161
Definition: array.hpp:12
Definition: variables.hpp:65
Definition: variables.hpp:98
Home