xc
Variable.h
1 // -*-c++-*-
2 //----------------------------------------------------------------------------
3 // xc utils library; general purpose classes and functions.
4 //
5 // Copyright (C) Luis C. Pérez Tato
6 //
7 // XC utils is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by
9 // the Free Software Foundation, either version 3 of the License, or
10 // (at your option) any later version.
11 //
12 // This software is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with this program.
19 // If not, see <http://www.gnu.org/licenses/>.
20 //----------------------------------------------------------------------------
21 //Variable.h
22 
23 #ifndef VARIABLE_H
24 #define VARIABLE_H
25 
26 #include "NamedOperand.h"
27 
28 
29 class ExprAlgebra;
30 
31 class Variable : public NamedOperand
32  {
33  bool asignada;
34  public:
35  Variable(void) : NamedOperand(), asignada(false) {}
36  Variable(const std::string &nmb): NamedOperand(nmb), asignada(false) {}
37  Variable(const Variable &other): NamedOperand(other), asignada(other.asignada) {}
38  Variable &operator=(const Variable &other)
39  {
40  NamedOperand::operator =(other);
41  asignada= other.asignada;
42  return *this;
43  }
44  inline virtual bool Evaluable(void) const
45  { return asignada; }
46  inline virtual void Asigna(const double &d)
47  {
48  asignada= true;
49  valor= d;
50  }
51  inline virtual void AsignaExpr(const double &d) {}
52  inline void DesAsigna(void)
53  { asignada= false; }
54  virtual const Operando &Opera(const Operando *, const Operando *) const;
55  virtual Rama Diferencia(const Variable &v,const Rama &) const;
56  virtual void GetVariables(ConjVariables &cv) const;
57  };
58 
59 #endif
Definition: NamedOperand.h:28
Definition: Variable.h:31
Definition: ConjVariables.h:30
Operando.
Definition: Operando.h:42
Definition: Rama.h:33
Expresión algebraica.
Definition: ExprAlgebra.h:32