|
Hormiga 1.0
|
00001 00002 /* 00003 # Hormiga - Software de cálculo programable. 00004 # 00005 # Copyright (C) 2008, 2009 Leonardo Román, Hugo J. Curti, Norma Ercoli, 00006 # Universidad Nacional del Centro de la Provincia de Buenos Aires 00007 # (UNCPBA) 00008 # 00009 # Este programa es parte de Hormiga. 00010 # 00011 # Hormiga es software libre. Puede redistribuirlo y/o modificarlo 00012 # bajo los términos de la Licencia Pública General de GNU según es 00013 # publicada por la Free Software Foundation, versión 2. Vea el archivo 00014 # COPIA (español, no oficial) o COPYING (inglés, oficial) en directorio 00015 # raíz. 00016 # 00017 # Hormiga se distribuye con la esperanza de que sea útil, pero SIN 00018 # NINGUNA GARANTÍA, incluso sin la garantía MERCANTIL implícita o sin 00019 # garantizar la CONVENIENCIA PARA UN PROPÓSITO PARTICULAR. Véase la 00020 # Licencia Pública General de GNU para más detalles. 00021 # 00022 # Debería haber recibido una copia de la Licencia Pública General junto 00023 # con Hormiga. Si no ha sido así, escriba a la Free Software 00024 # Foundation, Inc., en 675 Mass Ave, Cambridge, MA 02139, EEUU. 00025 # Añada también información sobre cómo contactar con usted mediante 00026 # correo electrónico y postal. 00027 # 00028 # This file is part of Hormiga. 00029 # 00030 # Hormiga is free software; you can redistribute it and/or modify 00031 # it under the terms of the GNU General Public License version 2 00032 # as published by the Free Software Foundation; see the file COPYING 00033 # in the top directory for details. 00034 # 00035 # Hormiga is distributed in the hope that it will be useful, 00036 # but WITHOUT ANY WARRANTY; without even the implied warranty of 00037 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00038 # GNU General Public License for more details. 00039 # 00040 # You should have received a copy of the GNU General Public License 00041 # along with Hormiga; if not, write to the Free Software 00042 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 00043 # USA 00044 */ 00045 00046 #ifndef OPERAND_INTERFACE_H 00047 #define OPERAND_INTERFACE_H 00048 00049 #include "defines.h" 00050 #include "types/type.h" 00051 00056 class Typeable 00057 { 00058 public: 00059 Typeable ( Type *type = NULL ) ; 00060 Type* getType () const ; 00061 protected: 00062 Type* type ; 00063 }; 00064 00065 class Shareable 00066 // por ahora solo lo usa Operand; si se mantiene asi, poner este 00067 // metodo en esa clase, asi evitamos una herencia :) 00068 { 00069 public: 00077 virtual bool isShareable () { return ( false ) ; } 00078 }; 00079 00080 class Operand : public Shareable 00081 { 00082 public: 00083 virtual T_MAGNITUDE getValue () const = 0 ; 00084 virtual T_STRING toString () const = 0 ; 00085 00090 virtual T_STRING getSymbol () const = 0 ; 00091 00095 virtual bool isSequence () { return ( false ) ; } 00096 00101 virtual bool isConstantExpresion () const = 0 ; 00102 }; 00103 00104 00105 class Seteable 00106 { 00107 public: 00108 virtual T_MAGNITUDE setValue ( T_MAGNITUDE v ) = 0 ; 00109 //virtual T_STRING toString () const = 0 ; 00110 }; 00111 00112 class UnaryOperator : public Operand 00113 { 00114 public: 00115 virtual T_STRING getSymbol () const = 0 ; 00116 virtual T_STRING toString () const ; 00117 virtual bool isConstantExpresion () const ; 00118 UnaryOperator ( Operand *op ) ; 00119 virtual ~UnaryOperator () ; 00120 protected: 00121 Operand *op1 ; 00122 }; 00123 00124 class BinaryOperator : public Operand 00125 { 00126 public: 00127 virtual T_STRING getSymbol () const = 0 ; 00128 virtual T_STRING toString () const ; 00129 virtual bool isConstantExpresion () const ; 00130 BinaryOperator ( Operand *op1 , Operand *op2 ) ; 00131 virtual ~BinaryOperator () ; 00132 protected: 00133 Operand *op1 ; 00134 Operand *op2 ; 00135 }; 00136 00137 #endif // OPERAND_INTERFACE_H