variable.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 //  Copyright (c) 2006 by Rafael Ostertag
00004 //
00005 //  This program is free software; you can redistribute it and/or modify
00006 //  it under the terms of the GNU General Public License as published by
00007 //  the Free Software Foundation; either version 2 of the License, or
00008 //  (at your option) any later version.
00009 //
00010 //  This program is distributed in the hope that it will be useful,
00011 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 //  GNU General Public License for more details.
00014 //
00015 //  You should have received a copy of the GNU General Public License
00016 //  along with this program; if not, write to the Free Software
00017 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00018 //
00019 //
00020 // $Id: variable.h,v 1.14 2006/12/28 19:01:25 rafi Exp $
00021 //
00022 
00032 #ifndef _VARIABLE_H
00033 #define _VARIABLE_H
00034 
00035 #ifdef HAVE_CONFIG_H
00036 #include "config.h"
00037 #endif
00038 
00039 #include <string>
00040 
00041 #include "cassymbolic.h"
00042 
00055 class Variable : public CASSymbolic {
00056     private:
00062         std::string name;
00063 
00064     public:
00068         Variable();
00072         Variable ( const std::string n, const CASObject* mag );
00076         Variable ( const std::string n );
00080         Variable ( const Variable &v );
00084         ~Variable();
00088         CASObject* Clone() const;
00096         inline CASType GetType() const {
00097             return CT_VARIABLE;
00098         };
00102         void Get ( std::string &s ) const;
00106         void Get ( char *s, unsigned long size ) const;
00111         void Print() const;
00115         unsigned long Length() const;
00119         bool IsZero() const;
00123         bool IsOne() const;
00127         CASObject* Absolute() const;
00131         void AbsoluteIP();
00135         CASObject* Invert() const;
00139         void InvertIP();
00143         CASObject* Add ( const CASObject* addend ) const;
00147         CASObject* Subtract ( const CASObject* subtrahend ) const;
00151         CASObject* Multiply ( const CASObject* factor ) const;
00155         CASObject* Divide ( const CASObject* divisor ) const;
00159         CASObject* Modulo ( const CASObject* divisor ) const;
00163         CASObject* Power ( const CASObject* exp ) const;
00167         CASObject* GCD ( const CASObject* o ) const;
00172         bool IsEqual ( const CASObject* o ) const;
00177         bool IsLT ( const CASObject* o ) const;
00182         bool IsGT ( const CASObject* o ) const;
00187         bool IsSimilar ( const CASObject* o ) const;
00191         CASObject* Evaluate() const;
00195         CASObject* SortWeight() const;
00199         void Sort();
00204         inline bool IsPureNumerical() const { return meta.IsPureNumerical(); }
00208         const Variable& operator= ( const Variable &v );
00209 
00210         friend class CASConvert;
00211 };
00212 
00217 #endif /* _VARIABLE_H */

Generated on Sun Dec 31 01:57:27 2006 for ECAS by  doxygen 1.4.7