xc
NamedOperand.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 //NamedOperand.h
22 
23 #ifndef NAMEDOPERAND_H
24 #define NAMEDOPERAND_H
25 
26 #include "Operando.h"
27 
28 class NamedOperand : public Operando
29  {
30  protected:
31  std::string name;
32  public:
33  NamedOperand(void) : Operando(), name() {}
34  NamedOperand(const std::string &nmb,const double &d=0.0): Operando(d), name(nmb) {}
35  NamedOperand(const NamedOperand &otro): Operando(otro), name(otro.name) {}
36  NamedOperand &operator=(const NamedOperand &otro)
37  {
38  Operando::operator =(otro);
39  name= otro.name;
40  return *this;
41  }
42  void Put(const std::string &nmb, const double &v)
43  {
44  Operando::Put(v);
45  name= nmb;
46  }
47  inline virtual const std::string &getName(void) const
48  { return name; }
49  inline virtual const std::string &GetFullString(void) const
50  { return name; }
51  friend std::istream &operator >>(std::istream &is, NamedOperand &s);
52  virtual int GetPrioridad(void) const
53  { return 8; }
54  virtual ~NamedOperand(void)
55  {}
56  };
57 
58 
59 #endif
Definition: NamedOperand.h:28
Operando.
Definition: Operando.h:42
virtual const std::string & getName(void) const
Return the operand name.
Definition: NamedOperand.h:47
virtual const std::string & GetFullString(void) const
Devuelve la cadena de caracteres correspondiente al valor con toda la precisión posible.
Definition: NamedOperand.h:49