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: casobject.h,v 1.19 2006/12/28 19:01:24 rafi Exp $ 00021 // 00022 00117 #include "casgarbage.h" 00118 00119 #ifndef _CASOBJECT_H 00120 #define _CASOBJECT_H 00121 00122 #ifdef HAVE_CONFIG_H 00123 #include "config.h" 00124 #endif 00125 00126 #ifdef DEBUG 00127 #include <cassert> 00128 #endif 00129 00130 #include <string> 00131 00132 #include "casmetainfo.h" 00133 #include "castype.h" 00134 00146 class CASObject { 00147 public: 00155 CASObject *exponent; 00156 00164 CASMetaInfo meta; 00165 00173 static class CASGarbage *Garbage; 00174 00186 virtual CASObject* Clone() const = 0; 00187 00201 virtual CASType GetType() const = 0; 00202 00215 virtual void Get ( std::string &s ) const = 0; 00216 00229 virtual void Get ( char *s, unsigned long size ) const = 0; 00230 00238 virtual void Print() const = 0; 00239 00248 virtual unsigned long Length() const = 0; 00249 00259 virtual bool IsZero() const = 0; 00260 00270 virtual bool IsOne() const = 0; 00271 00282 virtual CASObject* Absolute() const = 0; 00283 00293 virtual void AbsoluteIP() = 0; 00294 00304 virtual CASObject* Invert() const = 0; 00305 00313 virtual void InvertIP() = 0; 00314 00326 virtual CASObject* Add ( const CASObject* addend ) const = 0; 00327 00339 virtual CASObject* Subtract ( const CASObject* subtrahend ) const = 0; 00340 00352 virtual CASObject* Multiply ( const CASObject* factor ) const = 0; 00353 00365 virtual CASObject* Divide ( const CASObject* divisor ) const = 0; 00366 00379 virtual CASObject* Power ( const CASObject* exponent ) const = 0; 00380 00392 virtual CASObject* Modulo ( const CASObject* divisor ) const = 0; 00393 00404 virtual CASObject* GCD ( const CASObject* o ) const = 0; 00405 00418 virtual bool IsEqual ( const CASObject* o ) const = 0; 00419 00432 virtual bool IsLT ( const CASObject* o ) const = 0; 00433 00446 virtual bool IsGT ( const CASObject* o ) const = 0; 00447 00462 virtual bool IsPureNumerical() const = 0; 00463 00480 virtual bool IsSimilar ( const CASObject *o ) const = 0; 00481 00501 virtual CASObject* SortWeight() const = 0; 00502 00508 virtual void Sort() = 0; 00509 00525 virtual CASObject* Evaluate() const = 0; 00526 00532 inline CASObject() { exponent = 0; } 00533 00539 inline virtual ~CASObject() {}; 00540 00541 friend class CASAbsoluteObjectIP; 00542 friend class CASInvertObjectIP; 00543 }; 00544 00545 #endif /* _CASOBJECT_H */
1.4.7