Hormiga 1.0

/var/www/hormigaproject.com.ar/files/src/step/capture.cpp

Go to the documentation of this file.
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 #include "capture.h"
00047 
00048 CaptureTXT::CaptureTXT( T_STRING label , VarValue* store , Operand* condition )
00049         : Capture( label )
00050 {
00051     this->store = store ;
00052     this->condition = condition ;
00053 }
00054 
00055 CaptureTXT::~CaptureTXT()
00056 {
00057     //if ( this->store != NULL ) delete this->store ;/*Symbol table will do it*/
00058     if ( this->condition != NULL ) delete this->condition ;
00059 }
00060 
00061 bool CaptureTXT::setValue ( T_MAGNITUDE v )
00062 {
00063     T_MAGNITUDE oldValue = this->store->getValue() ;
00064     this->store->setValue( v ) ;
00065     if ( this->condition->getValue() == FALSE )
00066     {
00067         this->store->setValue( oldValue ) ;
00068         return ( false ) ;
00069     }
00070     return ( true ) ;
00071 }
00072 
00073 
00074 CaptureGUI::CaptureGUI( T_STRING label , VarValue* store , Sequence* range )
00075         : Capture( label )
00076 {
00077     this->store = store ;
00078     this->range = range ;
00079 }
00080 
00081 CaptureGUI::~CaptureGUI()
00082 {
00083     //if ( this->store != NULL ) delete this->store ;/*Symbol table will do it*/
00084     if ( this->range != NULL ) delete this->range ;
00085 }
00086 
00087 bool CaptureGUI::setValue ( T_MAGNITUDE v )
00088 {
00089     // Here we trust on the GUI restrictions... always returns true.
00090     this->store->setValue( v ) ;
00091     return ( true ) ;
00092 }
00093