diff options
Diffstat (limited to 'ue4/mycpu/cdat.h')
| -rw-r--r-- | ue4/mycpu/cdat.h | 109 |
1 files changed, 51 insertions, 58 deletions
diff --git a/ue4/mycpu/cdat.h b/ue4/mycpu/cdat.h index a533fae..ca9d745 100644 --- a/ue4/mycpu/cdat.h +++ b/ue4/mycpu/cdat.h | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | * @module cdat | 2 | * @module cdat |
| 3 | * @author Guenther Neuwirth (0626638), Manuel Mausz (0728348) | 3 | * @author Guenther Neuwirth (0626638), Manuel Mausz (0728348) |
| 4 | * @brief Datatype template and datatype definition for CCPU and CMem | 4 | * @brief Datatype template and datatype definition for CCPU and CMem |
| 5 | * @date 10.05.2009 | 5 | * @date 26.05.2009 |
| 6 | */ | 6 | */ |
| 7 | 7 | ||
| 8 | #ifndef CDAT_H | 8 | #ifndef CDAT_H |
| @@ -12,17 +12,17 @@ | |||
| 12 | #include <iostream> | 12 | #include <iostream> |
| 13 | 13 | ||
| 14 | /** | 14 | /** |
| 15 | * @class CDatT | 15 | * @class CDat |
| 16 | * | 16 | * |
| 17 | * Datatype template for CCPU and CMem. | 17 | * Datatype template for CCPU and CMem. |
| 18 | */ | 18 | */ |
| 19 | template <class T> | 19 | template <class T> |
| 20 | class CDatT | 20 | class CDat |
| 21 | : boost::operators<CDatT<T> > | 21 | : boost::operators<CDat<T> > |
| 22 | { | 22 | { |
| 23 | public: | 23 | public: |
| 24 | /** | 24 | /** |
| 25 | * @method CDatT | 25 | * @method CDat |
| 26 | * @brief Default ctor | 26 | * @brief Default ctor |
| 27 | * @param - | 27 | * @param - |
| 28 | * @return - | 28 | * @return - |
| @@ -30,11 +30,11 @@ class CDatT | |||
| 30 | * @exception bad_alloc | 30 | * @exception bad_alloc |
| 31 | * @conditions none | 31 | * @conditions none |
| 32 | */ | 32 | */ |
| 33 | CDatT() | 33 | CDat() |
| 34 | {} | 34 | {} |
| 35 | 35 | ||
| 36 | /** | 36 | /** |
| 37 | * @method ~CDatT | 37 | * @method ~CDat |
| 38 | * @brief Default dtor | 38 | * @brief Default dtor |
| 39 | * @param - | 39 | * @param - |
| 40 | * @return - | 40 | * @return - |
| @@ -42,40 +42,40 @@ class CDatT | |||
| 42 | * @exception none | 42 | * @exception none |
| 43 | * @conditions none | 43 | * @conditions none |
| 44 | */ | 44 | */ |
| 45 | ~CDatT() | 45 | ~CDat() |
| 46 | {} | 46 | {} |
| 47 | 47 | ||
| 48 | /** | 48 | /** |
| 49 | * @method CDatT | 49 | * @method CDat |
| 50 | * @brief Copy constructor for CDatT | 50 | * @brief Copy constructor for CDat |
| 51 | * @param other reference to CDatT which will be copied | 51 | * @param other reference to CDat which will be copied |
| 52 | * @return - | 52 | * @return - |
| 53 | * @globalvars none | 53 | * @globalvars none |
| 54 | * @exception none | 54 | * @exception none |
| 55 | * @conditions none | 55 | * @conditions none |
| 56 | */ | 56 | */ |
| 57 | CDatT(const CDatT& other) | 57 | CDat(const CDat& other) |
| 58 | : m_value(other.m_value) | 58 | : m_value(other.m_value) |
| 59 | {} | 59 | {} |
| 60 | 60 | ||
| 61 | /** | 61 | /** |
| 62 | * @method CDatT | 62 | * @method CDat |
| 63 | * @brief Copy constructor for int | 63 | * @brief Copy constructor for int |
| 64 | * @param newval new value for CDatT | 64 | * @param newval new value for CDat |
| 65 | * @return - | 65 | * @return - |
| 66 | * @globalvars none | 66 | * @globalvars none |
| 67 | * @exception none | 67 | * @exception none |
| 68 | * @conditions none | 68 | * @conditions none |
| 69 | */ | 69 | */ |
| 70 | CDatT(T newval) | 70 | CDat(T newval) |
| 71 | : m_value(newval) | 71 | : m_value(newval) |
| 72 | {} | 72 | {} |
| 73 | 73 | ||
| 74 | /** | 74 | /** |
| 75 | * @method getValue | 75 | * @method getValue |
| 76 | * @brief returns value of CDatT | 76 | * @brief returns value of CDat |
| 77 | * @param - | 77 | * @param - |
| 78 | * @return value of CDatT | 78 | * @return value of CDat |
| 79 | * @globalvars none | 79 | * @globalvars none |
| 80 | * @exception none | 80 | * @exception none |
| 81 | * @conditions none | 81 | * @conditions none |
| @@ -102,13 +102,13 @@ class CDatT | |||
| 102 | /** | 102 | /** |
| 103 | * @method operator< | 103 | * @method operator< |
| 104 | * @brief implementation of operator < | 104 | * @brief implementation of operator < |
| 105 | * @param x reference to CDatT | 105 | * @param x reference to CDat |
| 106 | * @return true if cdat is less than object x | 106 | * @return true if cdat is less than object x |
| 107 | * @globalvars none | 107 | * @globalvars none |
| 108 | * @exception none | 108 | * @exception none |
| 109 | * @conditions none | 109 | * @conditions none |
| 110 | */ | 110 | */ |
| 111 | bool operator<(const CDatT& x) const | 111 | bool operator<(const CDat& x) const |
| 112 | { | 112 | { |
| 113 | return m_value < x.m_value; | 113 | return m_value < x.m_value; |
| 114 | } | 114 | } |
| @@ -116,13 +116,13 @@ class CDatT | |||
| 116 | /** | 116 | /** |
| 117 | * @method operator== | 117 | * @method operator== |
| 118 | * @brief implementation of operator == | 118 | * @brief implementation of operator == |
| 119 | * @param x reference to CDatT | 119 | * @param x reference to CDat |
| 120 | * @return true if cdat equals object x | 120 | * @return true if cdat equals object x |
| 121 | * @globalvars none | 121 | * @globalvars none |
| 122 | * @exception none | 122 | * @exception none |
| 123 | * @conditions none | 123 | * @conditions none |
| 124 | */ | 124 | */ |
| 125 | bool operator==(const CDatT& x) const | 125 | bool operator==(const CDat& x) const |
| 126 | { | 126 | { |
| 127 | return m_value == x.m_value; | 127 | return m_value == x.m_value; |
| 128 | } | 128 | } |
| @@ -130,13 +130,13 @@ class CDatT | |||
| 130 | /** | 130 | /** |
| 131 | * @method operator+= | 131 | * @method operator+= |
| 132 | * @brief implementation of operator += | 132 | * @brief implementation of operator += |
| 133 | * @param x reference to CDatT | 133 | * @param x reference to CDat |
| 134 | * @return refecence to CDatT | 134 | * @return refecence to CDat |
| 135 | * @globalvars none | 135 | * @globalvars none |
| 136 | * @exception none | 136 | * @exception none |
| 137 | * @conditions none | 137 | * @conditions none |
| 138 | */ | 138 | */ |
| 139 | CDatT& operator+=(const CDatT& x) | 139 | CDat& operator+=(const CDat& x) |
| 140 | { | 140 | { |
| 141 | m_value += x.m_value; | 141 | m_value += x.m_value; |
| 142 | return *this; | 142 | return *this; |
| @@ -145,13 +145,13 @@ class CDatT | |||
| 145 | /** | 145 | /** |
| 146 | * @method operator-= | 146 | * @method operator-= |
| 147 | * @brief implementation of operator -= | 147 | * @brief implementation of operator -= |
| 148 | * @param x reference to CDatT | 148 | * @param x reference to CDat |
| 149 | * @return refecence to CDatT | 149 | * @return refecence to CDat |
| 150 | * @globalvars none | 150 | * @globalvars none |
| 151 | * @exception none | 151 | * @exception none |
| 152 | * @conditions none | 152 | * @conditions none |
| 153 | */ | 153 | */ |
| 154 | CDatT& operator-=(const CDatT& x) | 154 | CDat& operator-=(const CDat& x) |
| 155 | { | 155 | { |
| 156 | m_value -= x.m_value; | 156 | m_value -= x.m_value; |
| 157 | return *this; | 157 | return *this; |
| @@ -160,13 +160,13 @@ class CDatT | |||
| 160 | /** | 160 | /** |
| 161 | * @method operator*= | 161 | * @method operator*= |
| 162 | * @brief implementation of operator *= | 162 | * @brief implementation of operator *= |
| 163 | * @param x reference to CDatT | 163 | * @param x reference to CDat |
| 164 | * @return refecence to CDatT | 164 | * @return refecence to CDat |
| 165 | * @globalvars none | 165 | * @globalvars none |
| 166 | * @exception none | 166 | * @exception none |
| 167 | * @conditions none | 167 | * @conditions none |
| 168 | */ | 168 | */ |
| 169 | CDatT& operator*=(const CDatT& x) | 169 | CDat& operator*=(const CDat& x) |
| 170 | { | 170 | { |
| 171 | m_value *= x.m_value; | 171 | m_value *= x.m_value; |
| 172 | return *this; | 172 | return *this; |
| @@ -175,13 +175,13 @@ class CDatT | |||
| 175 | /** | 175 | /** |
| 176 | * @method operator/= | 176 | * @method operator/= |
| 177 | * @brief implementation of operator /= | 177 | * @brief implementation of operator /= |
| 178 | * @param x reference to CDatT | 178 | * @param x reference to CDat |
| 179 | * @return refecence to CDatT | 179 | * @return refecence to CDat |
| 180 | * @globalvars none | 180 | * @globalvars none |
| 181 | * @exception none | 181 | * @exception none |
| 182 | * @conditions none | 182 | * @conditions none |
| 183 | */ | 183 | */ |
| 184 | CDatT& operator/=(const CDatT& x) | 184 | CDat& operator/=(const CDat& x) |
| 185 | { | 185 | { |
| 186 | m_value /= x.m_value; | 186 | m_value /= x.m_value; |
| 187 | return *this; | 187 | return *this; |
| @@ -190,13 +190,13 @@ class CDatT | |||
| 190 | /** | 190 | /** |
| 191 | * @method operator%= | 191 | * @method operator%= |
| 192 | * @brief implementation of operator %= | 192 | * @brief implementation of operator %= |
| 193 | * @param x reference to CDatT | 193 | * @param x reference to CDat |
| 194 | * @return refecence to CDatT | 194 | * @return refecence to CDat |
| 195 | * @globalvars none | 195 | * @globalvars none |
| 196 | * @exception none | 196 | * @exception none |
| 197 | * @conditions none | 197 | * @conditions none |
| 198 | */ | 198 | */ |
| 199 | CDatT& operator%=(const CDatT& x) | 199 | CDat& operator%=(const CDat& x) |
| 200 | { | 200 | { |
| 201 | m_value %= x.m_value; | 201 | m_value %= x.m_value; |
| 202 | return *this; | 202 | return *this; |
| @@ -205,13 +205,13 @@ class CDatT | |||
| 205 | /** | 205 | /** |
| 206 | * @method operator|= | 206 | * @method operator|= |
| 207 | * @brief implementation of operator |= | 207 | * @brief implementation of operator |= |
| 208 | * @param x reference to CDatT | 208 | * @param x reference to CDat |
| 209 | * @return refecence to CDatT | 209 | * @return refecence to CDat |
| 210 | * @globalvars none | 210 | * @globalvars none |
| 211 | * @exception none | 211 | * @exception none |
| 212 | * @conditions none | 212 | * @conditions none |
| 213 | */ | 213 | */ |
| 214 | CDatT& operator|=(const CDatT& x) | 214 | CDat& operator|=(const CDat& x) |
| 215 | { | 215 | { |
| 216 | m_value |= x.m_value; | 216 | m_value |= x.m_value; |
| 217 | return *this; | 217 | return *this; |
| @@ -220,13 +220,13 @@ class CDatT | |||
| 220 | /** | 220 | /** |
| 221 | * @method operator&= | 221 | * @method operator&= |
| 222 | * @brief implementation of operator &= | 222 | * @brief implementation of operator &= |
| 223 | * @param x reference to CDatT | 223 | * @param x reference to CDat |
| 224 | * @return refecence to CDatT | 224 | * @return refecence to CDat |
| 225 | * @globalvars none | 225 | * @globalvars none |
| 226 | * @exception none | 226 | * @exception none |
| 227 | * @conditions none | 227 | * @conditions none |
| 228 | */ | 228 | */ |
| 229 | CDatT& operator&=(const CDatT& x) | 229 | CDat& operator&=(const CDat& x) |
| 230 | { | 230 | { |
| 231 | m_value &= x.m_value; | 231 | m_value &= x.m_value; |
| 232 | return *this; | 232 | return *this; |
| @@ -235,13 +235,13 @@ class CDatT | |||
| 235 | /** | 235 | /** |
| 236 | * @method operator^= | 236 | * @method operator^= |
| 237 | * @brief implementation of operator ^= | 237 | * @brief implementation of operator ^= |
| 238 | * @param x reference to CDatT | 238 | * @param x reference to CDat |
| 239 | * @return refecence to CDatT | 239 | * @return refecence to CDat |
| 240 | * @globalvars none | 240 | * @globalvars none |
| 241 | * @exception none | 241 | * @exception none |
| 242 | * @conditions none | 242 | * @conditions none |
| 243 | */ | 243 | */ |
| 244 | CDatT& operator^=(const CDatT& x) | 244 | CDat& operator^=(const CDat& x) |
| 245 | { | 245 | { |
| 246 | m_value ^= x.m_value; | 246 | m_value ^= x.m_value; |
| 247 | return *this; | 247 | return *this; |
| @@ -251,12 +251,12 @@ class CDatT | |||
| 251 | * @method operator++ | 251 | * @method operator++ |
| 252 | * @brief implementation of operator ++ | 252 | * @brief implementation of operator ++ |
| 253 | * @param - | 253 | * @param - |
| 254 | * @return refecence to CDatT | 254 | * @return refecence to CDat |
| 255 | * @globalvars none | 255 | * @globalvars none |
| 256 | * @exception none | 256 | * @exception none |
| 257 | * @conditions none | 257 | * @conditions none |
| 258 | */ | 258 | */ |
| 259 | CDatT& operator++() | 259 | CDat& operator++() |
| 260 | { | 260 | { |
| 261 | m_value++; | 261 | m_value++; |
| 262 | return *this; | 262 | return *this; |
| @@ -266,12 +266,12 @@ class CDatT | |||
| 266 | * @method operator-- | 266 | * @method operator-- |
| 267 | * @brief implementation of operator -- | 267 | * @brief implementation of operator -- |
| 268 | * @param - | 268 | * @param - |
| 269 | * @return refecence to CDatT | 269 | * @return refecence to CDat |
| 270 | * @globalvars none | 270 | * @globalvars none |
| 271 | * @exception none | 271 | * @exception none |
| 272 | * @conditions none | 272 | * @conditions none |
| 273 | */ | 273 | */ |
| 274 | CDatT& operator--() | 274 | CDat& operator--() |
| 275 | { | 275 | { |
| 276 | m_value--; | 276 | m_value--; |
| 277 | return *this; | 277 | return *this; |
| @@ -287,7 +287,7 @@ class CDatT | |||
| 287 | * @exception none | 287 | * @exception none |
| 288 | * @conditions none | 288 | * @conditions none |
| 289 | */ | 289 | */ |
| 290 | friend std::ostream& operator<<(std::ostream& stream, CDatT cdat) | 290 | friend std::ostream& operator<<(std::ostream& stream, CDat cdat) |
| 291 | { | 291 | { |
| 292 | stream << cdat.m_value; | 292 | stream << cdat.m_value; |
| 293 | return stream; | 293 | return stream; |
| @@ -303,7 +303,7 @@ class CDatT | |||
| 303 | * @exception none | 303 | * @exception none |
| 304 | * @conditions none | 304 | * @conditions none |
| 305 | */ | 305 | */ |
| 306 | friend std::istream& operator>>(std::istream & stream, CDatT& cdat) | 306 | friend std::istream& operator>>(std::istream & stream, CDat& cdat) |
| 307 | { | 307 | { |
| 308 | stream >> cdat.m_value; | 308 | stream >> cdat.m_value; |
| 309 | return stream; | 309 | return stream; |
| @@ -314,13 +314,6 @@ class CDatT | |||
| 314 | T m_value; | 314 | T m_value; |
| 315 | }; | 315 | }; |
| 316 | 316 | ||
| 317 | /** | ||
| 318 | * @class CDat | ||
| 319 | * | ||
| 320 | * Datatype for CCPU and CMem | ||
| 321 | */ | ||
| 322 | typedef CDatT<int> CDat; | ||
| 323 | |||
| 324 | #endif | 317 | #endif |
| 325 | 318 | ||
| 326 | /* vim: set et sw=2 ts=2: */ | 319 | /* vim: set et sw=2 ts=2: */ |
