casnumeric.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: casnumeric.h,v 1.11 2006/12/28 19:01:24 rafi Exp $
00021 //
00022 
00032 #ifndef _CASNUMERIC_H
00033 #define _CASNUMERIC_H
00034 
00035 #ifdef HAVE_CONFIG_H
00036 #include "config.h"
00037 #endif
00038 
00039 #include "casobject.h"
00040 #include "castype.h"
00041 
00057 enum signedness {Positive = 0, Negative = 1};
00058 
00065 class CASNumeric : public CASObject {
00066     private:
00072         bool negative;
00078         unsigned long radix;
00079 
00087         unsigned long div_depth;
00088 
00089     public:
00096         inline CASNumeric() : negative ( false ), radix ( 10 ), div_depth ( 10 ) {
00097         meta.SetPureNumerical();
00098         meta.SetSingleValue();
00099     };
00109         inline CASNumeric ( bool n ) : negative ( n ), radix ( 10 ), div_depth ( 10 ) {
00110         meta.SetPureNumerical();
00111         meta.SetSingleValue();
00112     };
00123         inline CASNumeric ( bool n, unsigned long r ) : negative ( n ), radix ( r ), div_depth ( 10 ) {
00124         meta.SetPureNumerical();
00125         meta.SetSingleValue();
00126     };
00135         inline CASNumeric ( unsigned long r ) : negative ( false ), radix ( r ), div_depth ( 10 ) {
00136         meta.SetPureNumerical();
00137         meta.SetSingleValue();
00138     };
00147         inline bool IsNegative() const { return negative; }
00156         inline bool IsPositive() const { return !negative; }
00164         inline void SetNegative() { negative = true; }
00172         inline void SetPositive() { negative = false; }
00176         void SetSign ( signedness s );
00180         signedness GetSign() const;
00181 
00191         inline void SetDivDepth ( unsigned long d ) { div_depth = d; }
00200         inline unsigned long GetDivDepth() const { return div_depth; }
00210         inline void SetRadix ( unsigned long r ) { radix = r; }
00219         inline unsigned long GetRadix() const { return radix; }
00220 
00228         inline void AbsoluteIP() { negative = false; }
00236         inline void InvertIP() { negative = !negative; };
00237 
00243         inline virtual ~CASNumeric() {};
00244 
00245 };
00246 
00251 #endif /* _CASNUMERIC_H */

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