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: casconvert.h,v 1.9 2006/12/31 00:50:35 rafi Exp $ 00021 // 00022 00033 #ifndef _CASCONVERT_H 00034 #define _CASCONVERT_H 00035 00036 #ifdef HAVE_CONFIG_H 00037 #include "config.h" 00038 #endif 00039 00040 #include <vector> 00041 00042 #include "casobject.h" 00043 #include "castype.h" 00044 #include "longint.h" 00045 #include "product.h" 00046 #include "sum.h" 00047 #include "fraction.h" 00048 #include "variable.h" 00049 00074 class CASConvert { 00075 private: 00087 CASObject *casobject; 00088 00099 std::vector<CASObject*> vector; 00100 00101 protected: 00105 template<class T> T* vector2type() const throw ( EDoesNotApply ); 00106 00110 template<class T> T* casobject2type() const throw ( EDoesNotApply ); 00111 00115 virtual Variable* vector2variable() const throw ( EDoesNotApply ); 00119 virtual Variable* casobject2variable() const throw ( EDoesNotApply ); 00123 virtual LongInt* vector2longint() const throw ( EDoesNotApply ); 00127 virtual LongInt* casobject2longint() const throw ( EDoesNotApply ); 00131 virtual Fraction* vector2fraction() const throw ( EDoesNotApply ); 00135 virtual Fraction* casobject2fraction() const throw ( EDoesNotApply ); 00136 00137 00138 public: 00142 CASConvert ( const CASObject* o ); 00146 CASConvert ( const std::vector<const CASObject*>& v ); 00150 virtual ~CASConvert(); 00154 CASConvert ( const CASConvert &o ); 00155 00159 virtual Sum *ToSum() const throw ( EDoesNotApply ); 00163 virtual Product *ToProduct() const throw ( EDoesNotApply ); 00167 virtual Variable *ToVariable() const throw ( EDoesNotApply ); 00171 virtual LongInt* ToLongInt() const throw ( EDoesNotApply ); 00175 virtual Fraction *ToFraction() const throw ( EDoesNotApply ); 00176 00180 CASConvert &operator= ( const CASConvert &o ); 00181 00182 }; 00183 00184 #endif /* _CASCONVERT_H */
1.4.7