00001 /* 00002 ot_lib - Object Type Library 00003 Copyright (C) 2002 Alessandro Bonfanti 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License as published by the Free Software Foundation; either 00008 version 2 of the License, or (at your option) any later version. 00009 00010 This library 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 GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public 00016 License along with this library; if not, write to the Free 00017 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00018 00019 Alessandro Bonfanti 00020 xjbon@tin.it 00021 */ 00022 00023 00024 #ifndef OT_UINT_H 00025 #define OT_UINT_H 00026 00027 // ----------------------------------------------------------------------------------- 00029 00030 // ----------------------------------------------------------------------------------- 00031 00032 class ot_uint : public ot_num<unsigned int> 00033 { 00034 00035 private: 00036 00037 00038 public: 00039 00040 00041 // ######################################### 00042 // CONSTRUCTOR & DESTRUCTOR 00043 // ######################################### 00044 00047 ot_uint(int val=0) : ot_num<unsigned int>(OT_UINT,val) {} 00048 00050 ot_uint(const ot_uint &c) : ot_num<unsigned int>(OT_UINT,c.m_value) {} 00051 00052 00053 // ######################################### 00054 // IMPLEMENTATIONS OF THE VIRTUAL FUNCTIONS 00055 // ######################################### 00056 00057 ot_obj *dup(void) const 00058 { 00059 return(new ot_uint(*this)); 00060 } 00061 00062 00063 // ######################################### 00064 // PROPIETARY FUNCTIONS 00065 // ######################################### 00066 00067 00068 // ######################################### 00069 // MATH OPERATOR 00070 // ######################################### 00071 00073 ot_uint operator = (const ot_uint &c) 00074 { 00075 m_value = c.m_value; 00076 00077 return(*this); 00078 } 00079 00081 bool operator == (const ot_uint &c) const 00082 { 00083 if (m_value==c.m_value) return(true); 00084 else return(false); 00085 } 00086 00088 bool operator != (const ot_uint &c) 00089 { 00090 return(! (*this==c)); 00091 } 00092 00094 ot_uint operator+ (const ot_uint &c) const {return(ot_uint(m_value + c.m_value));} 00095 00097 ot_uint operator- (const ot_uint &c) const {return(ot_uint(m_value - c.m_value));} 00098 00100 ot_uint operator* (const ot_uint &c) const {return(ot_uint(m_value * c.m_value));} 00101 00103 ot_uint operator/ (const ot_uint &c) const {return(ot_uint(m_value / c.m_value));} 00104 00106 void operator+= (const ot_uint &c) {m_value += c.m_value;} 00107 00109 void operator-= (const ot_uint &c) {m_value -= c.m_value;} 00110 00112 void operator*= (const ot_uint &c) {m_value *= c.m_value;} 00113 00115 void operator/= (const ot_uint &c) {m_value /= c.m_value;} 00116 00118 void operator++ (void) {m_value ++;} 00119 00121 void operator-- (void) {m_value --;} 00122 00124 operator unsigned int (void) const {return(m_value);} 00125 }; 00126 00127 #endif 00128