Wiselib
|
00001 /*************************************************************************** 00002 ** This file is part of the generic algorithm library Wiselib. ** 00003 ** Copyright (C) 2008,2009 by the Wisebed (www.wisebed.eu) project. ** 00004 ** ** 00005 ** The Wiselib is free software: you can redistribute it and/or modify ** 00006 ** it under the terms of the GNU Lesser General Public License as ** 00007 ** published by the Free Software Foundation, either version 3 of the ** 00008 ** License, or (at your option) any later version. ** 00009 ** ** 00010 ** The Wiselib 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 Lesser General Public License for more details. ** 00014 ** ** 00015 ** You should have received a copy of the GNU Lesser General Public ** 00016 ** License along with the Wiselib. ** 00017 ** If not, see <http://www.gnu.org/licenses/>. ** 00018 ***************************************************************************/ 00019 #ifndef CONNECTOR_ISENSE_EXTENDED_TIME_H 00020 #define CONNECTOR_ISENSE_EXTENDED_TIME_H 00021 00022 #include <isense/time.h> 00023 00024 namespace wiselib 00025 { 00031 template<typename OsModel_P> 00032 class iSenseExtendedTime 00033 : public isense::Time 00034 { 00035 public: 00036 typedef OsModel_P OsModel; 00037 // -------------------------------------------------------------------- 00038 iSenseExtendedTime() 00039 : isense::Time() 00040 {} 00041 // -------------------------------------------------------------------- 00042 iSenseExtendedTime( isense::Time time ) 00043 : isense::Time( time ) 00044 {} 00045 // -------------------------------------------------------------------- 00046 iSenseExtendedTime operator+(const iSenseExtendedTime& exttime) 00047 { 00048 return isense::Time(*this) + isense::Time(exttime); 00049 } 00050 // -------------------------------------------------------------------- 00051 iSenseExtendedTime operator+=(const iSenseExtendedTime& exttime) 00052 { 00053 *this = *this + exttime; 00054 return *this; 00055 } 00056 // -------------------------------------------------------------------- 00057 iSenseExtendedTime operator-(const iSenseExtendedTime& exttime) 00058 { 00059 return isense::Time(*this) - isense::Time(exttime); 00060 } 00061 // -------------------------------------------------------------------- 00062 iSenseExtendedTime operator-=(const iSenseExtendedTime& exttime) 00063 { 00064 *this = *this - exttime; 00065 return *this; 00066 } 00067 // -------------------------------------------------------------------- 00068 iSenseExtendedTime operator+(int value) 00069 { 00070 return (*this + isense::Time(value)); 00071 } 00072 // -------------------------------------------------------------------- 00073 iSenseExtendedTime operator+=(int value) 00074 { 00075 *this = *this + value; 00076 return *this; 00077 } 00078 // -------------------------------------------------------------------- 00079 iSenseExtendedTime operator-(int value) 00080 { 00081 return (*this - isense::Time(value)); 00082 } 00083 // -------------------------------------------------------------------- 00084 iSenseExtendedTime operator-=(int value) 00085 { 00086 *this = *this - value; 00087 return *this; 00088 } 00089 // -------------------------------------------------------------------- 00090 iSenseExtendedTime operator*(int value) 00091 { 00092 isense::Time temp( this->sec() * value, 00093 this->ms() * value ); 00094 return temp; 00095 } 00096 // -------------------------------------------------------------------- 00097 iSenseExtendedTime operator*=(int value) 00098 { 00099 *this = *this * value; 00100 return *this; 00101 } 00102 // -------------------------------------------------------------------- 00103 iSenseExtendedTime operator/(int value) 00104 { 00105 isense::Time temp( this->sec() / value, 00106 this->ms() / value ); 00107 return temp; 00108 } 00109 // -------------------------------------------------------------------- 00110 iSenseExtendedTime operator/=(int value) 00111 { 00112 *this = *this / value; 00113 return *this; 00114 } 00115 00116 }; 00117 } 00118 00119 #endif