xc
Segnal.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 //Segnal.h
22 
23 #ifndef SEGNAL_H
24 #define SEGNAL_H
25 
26 #include <string>
27 
38 enum Clase { fin_exp,
39  parent_izdo, parent_dcho,
40  operando,
41  op_unitario, op_binario};
42 
43 class Variable;
44 class Lexico;
45 
46 
60 class Segnal
61  {
62  public:
63  inline Segnal(void) {}
64  inline virtual ~Segnal(void) {}
65  virtual const std::string &getName(void) const= 0;
66  virtual Clase GetClase(void) const= 0;
67  virtual const double &GetValor(const double &v1= 0.0, const double &v2= 0.0) const= 0;
68  inline virtual int GetPrioridad(void) const
69  { return -1; }
70  const std::string &StrClase(void) const;
71  virtual std::ostream &Imprime(std::ostream &os) const;
72  inline virtual bool EqualTo(const double &) const
73  { return false; }
74  friend int operator<(const Segnal &s1,const Segnal &s2)
75  { return (s1.getName() < s2.getName()); }
76  friend int operator==(const Segnal &s,const double &d)
77  { return s.EqualTo(d); }
78  friend int operator==(const double &d,const Segnal &s)
79  { return (s == d); }
80  };
81 
82 std::ostream &operator<<(std::ostream &, const Segnal &);
83 
84 
85 #endif
86 
87 
Definition: Variable.h:31
Componente elemental de una expresión.
Definition: Segnal.h:60
Definition: Lexico.h:42