statistics.hh (6026:45c8a91d1174) | statistics.hh (6128:fdfbd4c6e449) |
---|---|
1/* 2 * Copyright (c) 2003-2005 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 147 unchanged lines hidden (view full) --- 156 * This function breaks names up at periods and considers each subname 157 * separately. 158 * @param stat1 The first stat. 159 * @param stat2 The second stat. 160 * @return stat1's name is alphabetically before stat2's 161 */ 162 static bool less(Info *stat1, Info *stat2); 163}; | 1/* 2 * Copyright (c) 2003-2005 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 147 unchanged lines hidden (view full) --- 156 * This function breaks names up at periods and considers each subname 157 * separately. 158 * @param stat1 The first stat. 159 * @param stat2 The second stat. 160 * @return stat1's name is alphabetically before stat2's 161 */ 162 static bool less(Info *stat1, Info *stat2); 163}; |
164struct StorageParams; |
|
164 165template <class Stat, class Base> | 165 166template <class Stat, class Base> |
166class InfoWrap : public Base | 167class InfoProxy : public Base |
167{ 168 protected: 169 Stat &s; 170 171 public: | 168{ 169 protected: 170 Stat &s; 171 172 public: |
172 InfoWrap(Stat &stat) : s(stat) {} | 173 InfoProxy(Stat &stat) : s(stat) {} |
173 174 bool check() const { return s.check(); } 175 void prepare() { s.prepare(); } 176 void reset() { s.reset(); } 177 void 178 visit(Visit &visitor) 179 { 180 visitor.visit(*static_cast<Base *>(this)); 181 } 182 bool zero() const { return s.zero(); } 183}; 184 | 174 175 bool check() const { return s.check(); } 176 void prepare() { s.prepare(); } 177 void reset() { s.reset(); } 178 void 179 visit(Visit &visitor) 180 { 181 visitor.visit(*static_cast<Base *>(this)); 182 } 183 bool zero() const { return s.zero(); } 184}; 185 |
185class ScalarInfoBase : public Info | 186class ScalarInfo : public Info |
186{ 187 public: 188 virtual Counter value() const = 0; 189 virtual Result result() const = 0; 190 virtual Result total() const = 0; 191}; 192 193template <class Stat> | 187{ 188 public: 189 virtual Counter value() const = 0; 190 virtual Result result() const = 0; 191 virtual Result total() const = 0; 192}; 193 194template <class Stat> |
194class ScalarInfo : public InfoWrap<Stat, ScalarInfoBase> | 195class ScalarInfoProxy : public InfoProxy<Stat, ScalarInfo> |
195{ 196 public: | 196{ 197 public: |
197 ScalarInfo(Stat &stat) : InfoWrap<Stat, ScalarInfoBase>(stat) {} | 198 ScalarInfoProxy(Stat &stat) : InfoProxy<Stat, ScalarInfo>(stat) {} |
198 199 Counter value() const { return this->s.value(); } 200 Result result() const { return this->s.result(); } 201 Result total() const { return this->s.total(); } 202}; 203 | 199 200 Counter value() const { return this->s.value(); } 201 Result result() const { return this->s.result(); } 202 Result total() const { return this->s.total(); } 203}; 204 |
204class VectorInfoBase : public Info | 205class VectorInfo : public Info |
205{ 206 public: 207 /** Names and descriptions of subfields. */ 208 std::vector<std::string> subnames; 209 std::vector<std::string> subdescs; 210 211 public: 212 void enable(); 213 214 public: 215 virtual size_type size() const = 0; 216 virtual const VCounter &value() const = 0; 217 virtual const VResult &result() const = 0; 218 virtual Result total() const = 0; 219}; 220 221template <class Stat> | 206{ 207 public: 208 /** Names and descriptions of subfields. */ 209 std::vector<std::string> subnames; 210 std::vector<std::string> subdescs; 211 212 public: 213 void enable(); 214 215 public: 216 virtual size_type size() const = 0; 217 virtual const VCounter &value() const = 0; 218 virtual const VResult &result() const = 0; 219 virtual Result total() const = 0; 220}; 221 222template <class Stat> |
222class VectorInfo : public InfoWrap<Stat, VectorInfoBase> | 223class VectorInfoProxy : public InfoProxy<Stat, VectorInfo> |
223{ 224 protected: 225 mutable VCounter cvec; 226 mutable VResult rvec; 227 228 public: | 224{ 225 protected: 226 mutable VCounter cvec; 227 mutable VResult rvec; 228 229 public: |
229 VectorInfo(Stat &stat) : InfoWrap<Stat, VectorInfoBase>(stat) {} | 230 VectorInfoProxy(Stat &stat) : InfoProxy<Stat, VectorInfo>(stat) {} |
230 231 size_type size() const { return this->s.size(); } 232 233 VCounter & 234 value() const 235 { 236 this->s.value(cvec); 237 return cvec; --- 16 unchanged lines hidden (view full) --- 254 Counter underflow; 255 Counter overflow; 256 VCounter cvec; 257 Counter sum; 258 Counter squares; 259 Counter samples; 260}; 261 | 231 232 size_type size() const { return this->s.size(); } 233 234 VCounter & 235 value() const 236 { 237 this->s.value(cvec); 238 return cvec; --- 16 unchanged lines hidden (view full) --- 255 Counter underflow; 256 Counter overflow; 257 VCounter cvec; 258 Counter sum; 259 Counter squares; 260 Counter samples; 261}; 262 |
262class DistInfoBase : public Info | 263class DistInfo : public Info |
263{ 264 public: 265 /** Local storage for the entry values, used for printing. */ 266 DistData data; 267}; 268 269template <class Stat> | 264{ 265 public: 266 /** Local storage for the entry values, used for printing. */ 267 DistData data; 268}; 269 270template <class Stat> |
270class DistInfo : public InfoWrap<Stat, DistInfoBase> | 271class DistInfoProxy : public InfoProxy<Stat, DistInfo> |
271{ 272 public: | 272{ 273 public: |
273 DistInfo(Stat &stat) : InfoWrap<Stat, DistInfoBase>(stat) {} | 274 DistInfoProxy(Stat &stat) : InfoProxy<Stat, DistInfo>(stat) {} |
274}; 275 | 275}; 276 |
276class VectorDistInfoBase : public Info | 277class VectorDistInfo : public Info |
277{ 278 public: 279 std::vector<DistData> data; 280 281 /** Names and descriptions of subfields. */ 282 std::vector<std::string> subnames; 283 std::vector<std::string> subdescs; 284 void enable(); 285 286 protected: 287 /** Local storage for the entry values, used for printing. */ 288 mutable VResult rvec; 289 290 public: 291 virtual size_type size() const = 0; 292}; 293 294template <class Stat> | 278{ 279 public: 280 std::vector<DistData> data; 281 282 /** Names and descriptions of subfields. */ 283 std::vector<std::string> subnames; 284 std::vector<std::string> subdescs; 285 void enable(); 286 287 protected: 288 /** Local storage for the entry values, used for printing. */ 289 mutable VResult rvec; 290 291 public: 292 virtual size_type size() const = 0; 293}; 294 295template <class Stat> |
295class VectorDistInfo : public InfoWrap<Stat, VectorDistInfoBase> | 296class VectorDistInfoProxy : public InfoProxy<Stat, VectorDistInfo> |
296{ 297 public: | 297{ 298 public: |
298 VectorDistInfo(Stat &stat) : InfoWrap<Stat, VectorDistInfoBase>(stat) {} | 299 VectorDistInfoProxy(Stat &stat) : InfoProxy<Stat, VectorDistInfo>(stat) {} |
299 300 size_type size() const { return this->s.size(); } 301}; 302 | 300 301 size_type size() const { return this->s.size(); } 302}; 303 |
303class Vector2dInfoBase : public Info | 304class Vector2dInfo : public Info |
304{ 305 public: 306 /** Names and descriptions of subfields. */ 307 std::vector<std::string> subnames; 308 std::vector<std::string> subdescs; 309 std::vector<std::string> y_subnames; 310 311 size_type x; 312 size_type y; 313 314 /** Local storage for the entry values, used for printing. */ 315 mutable VCounter cvec; 316 317 void enable(); 318}; 319 320template <class Stat> | 305{ 306 public: 307 /** Names and descriptions of subfields. */ 308 std::vector<std::string> subnames; 309 std::vector<std::string> subdescs; 310 std::vector<std::string> y_subnames; 311 312 size_type x; 313 size_type y; 314 315 /** Local storage for the entry values, used for printing. */ 316 mutable VCounter cvec; 317 318 void enable(); 319}; 320 321template <class Stat> |
321class Vector2dInfo : public InfoWrap<Stat, Vector2dInfoBase> | 322class Vector2dInfoProxy : public InfoProxy<Stat, Vector2dInfo> |
322{ 323 public: | 323{ 324 public: |
324 Vector2dInfo(Stat &stat) : InfoWrap<Stat, Vector2dInfoBase>(stat) {} | 325 Vector2dInfoProxy(Stat &stat) : InfoProxy<Stat, Vector2dInfo>(stat) {} |
325}; 326 327class InfoAccess 328{ 329 protected: 330 /** Set up an info class for this statistic */ 331 void setInfo(Info *info); 332 /** Save Storage class parameters if any */ --- 21 unchanged lines hidden (view full) --- 354 /** 355 * Check that this stat has been set up properly and is ready for 356 * use 357 * @return true for success 358 */ 359 bool check() const { return true; } 360}; 361 | 326}; 327 328class InfoAccess 329{ 330 protected: 331 /** Set up an info class for this statistic */ 332 void setInfo(Info *info); 333 /** Save Storage class parameters if any */ --- 21 unchanged lines hidden (view full) --- 355 /** 356 * Check that this stat has been set up properly and is ready for 357 * use 358 * @return true for success 359 */ 360 bool check() const { return true; } 361}; 362 |
362template | 363template <class Derived, template <class> class InfoProxyType> |
363class DataWrap : public InfoAccess 364{ 365 public: | 364class DataWrap : public InfoAccess 365{ 366 public: |
366 typedef InfoType | 367 typedef InfoProxyType<Derived> Info; |
367 368 protected: 369 Derived &self() { return *static_cast<Derived *>(this); } 370 371 protected: 372 Info * 373 info() 374 { --- 86 unchanged lines hidden (view full) --- 461 Derived & 462 prereq(const Stat &prereq) 463 { 464 this->info()->prereq = prereq.info(); 465 return this->self(); 466 } 467}; 468 | 368 369 protected: 370 Derived &self() { return *static_cast<Derived *>(this); } 371 372 protected: 373 Info * 374 info() 375 { --- 86 unchanged lines hidden (view full) --- 462 Derived & 463 prereq(const Stat &prereq) 464 { 465 this->info()->prereq = prereq.info(); 466 return this->self(); 467 } 468}; 469 |
469template 470class DataWrapVec : public DataWrap | 470template <class Derived, template <class> class InfoProxyType> 471class DataWrapVec : public DataWrap<Derived, InfoProxyType> |
471{ 472 public: | 472{ 473 public: |
473 typedef InfoType | 474 typedef InfoProxyType<Derived> Info; |
474 475 // The following functions are specific to vectors. If you use them 476 // in a non vector context, you will get a nice compiler error! 477 478 /** 479 * Set the subfield name for the given index, and marks this stat to print 480 * at the end of simulation. 481 * @param index The subfield index. --- 55 unchanged lines hidden (view full) --- 537 Info *info = this->info(); 538 539 size_t size = self.size(); 540 for (off_type i = 0; i < size; ++i) 541 self.data(i)->reset(info); 542 } 543}; 544 | 475 476 // The following functions are specific to vectors. If you use them 477 // in a non vector context, you will get a nice compiler error! 478 479 /** 480 * Set the subfield name for the given index, and marks this stat to print 481 * at the end of simulation. 482 * @param index The subfield index. --- 55 unchanged lines hidden (view full) --- 538 Info *info = this->info(); 539 540 size_t size = self.size(); 541 for (off_type i = 0; i < size; ++i) 542 self.data(i)->reset(info); 543 } 544}; 545 |
545template 546class DataWrapVec2d : public DataWrapVec | 546template <class Derived, template <class> class InfoProxyType> 547class DataWrapVec2d : public DataWrapVec<Derived, InfoProxyType> |
547{ 548 public: | 548{ 549 public: |
549 typedef InfoType | 550 typedef InfoProxyType<Derived> Info; |
550 551 /** 552 * @warning This makes the assumption that if you're gonna subnames a 2d 553 * vector, you're subnaming across all y 554 */ 555 Derived & 556 ysubnames(const char **names) 557 { --- 183 unchanged lines hidden (view full) --- 741 742}; 743 744/** 745 * Implementation of a scalar stat. The type of stat is determined by the 746 * Storage template. 747 */ 748template <class Derived, class Stor> | 551 552 /** 553 * @warning This makes the assumption that if you're gonna subnames a 2d 554 * vector, you're subnaming across all y 555 */ 556 Derived & 557 ysubnames(const char **names) 558 { --- 183 unchanged lines hidden (view full) --- 742 743}; 744 745/** 746 * Implementation of a scalar stat. The type of stat is determined by the 747 * Storage template. 748 */ 749template <class Derived, class Stor> |
749class ScalarBase : public DataWrap | 750class ScalarBase : public DataWrap<Derived, ScalarInfoProxy> |
750{ 751 public: 752 typedef Stor Storage; 753 typedef typename Stor::Params Params; 754 755 protected: 756 /** The storage of this stat. */ 757 char storage[sizeof(Storage)] __attribute__ ((aligned (8))); --- 97 unchanged lines hidden (view full) --- 855 Result total() { return result(); } 856 857 bool zero() { return result() == 0.0; } 858 859 void reset() { data()->reset(this->info()); } 860 void prepare() { data()->prepare(this->info()); } 861}; 862 | 751{ 752 public: 753 typedef Stor Storage; 754 typedef typename Stor::Params Params; 755 756 protected: 757 /** The storage of this stat. */ 758 char storage[sizeof(Storage)] __attribute__ ((aligned (8))); --- 97 unchanged lines hidden (view full) --- 856 Result total() { return result(); } 857 858 bool zero() { return result() == 0.0; } 859 860 void reset() { data()->reset(this->info()); } 861 void prepare() { data()->prepare(this->info()); } 862}; 863 |
863class ProxyInfo : public ScalarInfoBase | 864class ProxyInfo : public ScalarInfo |
864{ 865 public: 866 std::string str() const { return to_string(value()); } 867 size_type size() const { return 1; } 868 bool check() const { return true; } 869 void prepare() { } 870 void reset() { } 871 bool zero() const { return value() == 0; } --- 23 unchanged lines hidden (view full) --- 895 public: 896 FunctorProxy(T &func) : functor(&func) {} 897 Counter value() const { return (*functor)(); } 898 Result result() const { return (*functor)(); } 899 Result total() const { return (*functor)(); } 900}; 901 902template <class Derived> | 865{ 866 public: 867 std::string str() const { return to_string(value()); } 868 size_type size() const { return 1; } 869 bool check() const { return true; } 870 void prepare() { } 871 void reset() { } 872 bool zero() const { return value() == 0; } --- 23 unchanged lines hidden (view full) --- 896 public: 897 FunctorProxy(T &func) : functor(&func) {} 898 Counter value() const { return (*functor)(); } 899 Result result() const { return (*functor)(); } 900 Result total() const { return (*functor)(); } 901}; 902 903template <class Derived> |
903class ValueBase : public DataWrap | 904class ValueBase : public DataWrap<Derived, ScalarInfoProxy> |
904{ 905 private: 906 ProxyInfo *proxy; 907 908 public: 909 ValueBase() : proxy(NULL) { } 910 ~ValueBase() { if (proxy) delete proxy; } 911 --- 159 unchanged lines hidden (view full) --- 1071 } 1072}; 1073 1074/** 1075 * Implementation of a vector of stats. The type of stat is determined by the 1076 * Storage class. @sa ScalarBase 1077 */ 1078template <class Derived, class Stor> | 905{ 906 private: 907 ProxyInfo *proxy; 908 909 public: 910 ValueBase() : proxy(NULL) { } 911 ~ValueBase() { if (proxy) delete proxy; } 912 --- 159 unchanged lines hidden (view full) --- 1072 } 1073}; 1074 1075/** 1076 * Implementation of a vector of stats. The type of stat is determined by the 1077 * Storage class. @sa ScalarBase 1078 */ 1079template <class Derived, class Stor> |
1079class VectorBase : public DataWrapVec | 1080class VectorBase : public DataWrapVec<Derived, VectorInfoProxy> |
1080{ 1081 public: 1082 typedef Stor Storage; 1083 typedef typename Stor::Params Params; 1084 1085 /** Proxy type */ 1086 typedef ScalarProxy<Derived> Proxy; 1087 friend class ScalarProxy<Derived>; | 1081{ 1082 public: 1083 typedef Stor Storage; 1084 typedef typename Stor::Params Params; 1085 1086 /** Proxy type */ 1087 typedef ScalarProxy<Derived> Proxy; 1088 friend class ScalarProxy<Derived>; |
1088 friend class DataWrapVec | 1089 friend class DataWrapVec<Derived, VectorInfoProxy>; |
1089 1090 protected: 1091 /** The storage of this stat. */ 1092 Storage *storage; 1093 size_type _size; 1094 1095 protected: 1096 /** --- 193 unchanged lines hidden (view full) --- 1290 assert (index >= 0 && index < size()); 1291 return ScalarProxy<Stat>(stat, offset + index); 1292 } 1293 1294 size_type size() const { return len; } 1295}; 1296 1297template <class Derived, class Stor> | 1090 1091 protected: 1092 /** The storage of this stat. */ 1093 Storage *storage; 1094 size_type _size; 1095 1096 protected: 1097 /** --- 193 unchanged lines hidden (view full) --- 1291 assert (index >= 0 && index < size()); 1292 return ScalarProxy<Stat>(stat, offset + index); 1293 } 1294 1295 size_type size() const { return len; } 1296}; 1297 1298template <class Derived, class Stor> |
1298class Vector2dBase : public DataWrapVec2d | 1299class Vector2dBase : public DataWrapVec2d<Derived, Vector2dInfoProxy> |
1299{ 1300 public: | 1300{ 1301 public: |
1301 typedef Vector2dInfo | 1302 typedef Vector2dInfoProxy<Derived> Info; |
1302 typedef Stor Storage; 1303 typedef typename Stor::Params Params; 1304 typedef VectorProxy<Derived> Proxy; 1305 friend class ScalarProxy<Derived>; 1306 friend class VectorProxy<Derived>; | 1303 typedef Stor Storage; 1304 typedef typename Stor::Params Params; 1305 typedef VectorProxy<Derived> Proxy; 1306 friend class ScalarProxy<Derived>; 1307 friend class VectorProxy<Derived>; |
1307 friend class DataWrapVec 1308 friend class DataWrapVec2d | 1308 friend class DataWrapVec<Derived, Vector2dInfoProxy>; 1309 friend class DataWrapVec2d<Derived, Vector2dInfoProxy>; |
1309 1310 protected: 1311 size_type x; 1312 size_type y; 1313 size_type _size; 1314 Storage *storage; 1315 1316 protected: --- 411 unchanged lines hidden (view full) --- 1728 } 1729}; 1730 1731/** 1732 * Implementation of a distribution stat. The type of distribution is 1733 * determined by the Storage template. @sa ScalarBase 1734 */ 1735template <class Derived, class Stor> | 1310 1311 protected: 1312 size_type x; 1313 size_type y; 1314 size_type _size; 1315 Storage *storage; 1316 1317 protected: --- 411 unchanged lines hidden (view full) --- 1729 } 1730}; 1731 1732/** 1733 * Implementation of a distribution stat. The type of distribution is 1734 * determined by the Storage template. @sa ScalarBase 1735 */ 1736template <class Derived, class Stor> |
1736class DistBase : public DataWrap | 1737class DistBase : public DataWrap<Derived, DistInfoProxy> |
1737{ 1738 public: | 1738{ 1739 public: |
1739 typedef DistInfo | 1740 typedef DistInfoProxy<Derived> Info; |
1740 typedef Stor Storage; 1741 typedef typename Stor::Params Params; 1742 1743 protected: 1744 /** The storage for this stat. */ 1745 char storage[sizeof(Storage)] __attribute__ ((aligned (8))); 1746 1747 protected: --- 63 unchanged lines hidden (view full) --- 1811 data()->reset(this->info()); 1812 } 1813}; 1814 1815template <class Stat> 1816class DistProxy; 1817 1818template <class Derived, class Stor> | 1741 typedef Stor Storage; 1742 typedef typename Stor::Params Params; 1743 1744 protected: 1745 /** The storage for this stat. */ 1746 char storage[sizeof(Storage)] __attribute__ ((aligned (8))); 1747 1748 protected: --- 63 unchanged lines hidden (view full) --- 1812 data()->reset(this->info()); 1813 } 1814}; 1815 1816template <class Stat> 1817class DistProxy; 1818 1819template <class Derived, class Stor> |
1819class VectorDistBase : public DataWrapVec | 1820class VectorDistBase : public DataWrapVec<Derived, VectorDistInfoProxy> |
1820{ 1821 public: | 1821{ 1822 public: |
1822 typedef VectorDistInfo | 1823 typedef VectorDistInfoProxy<Derived> Info; |
1823 typedef Stor Storage; 1824 typedef typename Stor::Params Params; 1825 typedef DistProxy<Derived> Proxy; 1826 friend class DistProxy<Derived>; | 1824 typedef Stor Storage; 1825 typedef typename Stor::Params Params; 1826 typedef DistProxy<Derived> Proxy; 1827 friend class DistProxy<Derived>; |
1827 friend class DataWrapVec | 1828 friend class DataWrapVec<Derived, VectorDistInfoProxy>; |
1828 1829 protected: 1830 Storage *storage; 1831 size_type _size; 1832 1833 protected: 1834 Storage * 1835 data(off_type index) --- 186 unchanged lines hidden (view full) --- 2022}; 2023 2024/** Reference counting pointer to a function Node. */ 2025typedef RefCountingPtr<Node> NodePtr; 2026 2027class ScalarStatNode : public Node 2028{ 2029 private: | 1829 1830 protected: 1831 Storage *storage; 1832 size_type _size; 1833 1834 protected: 1835 Storage * 1836 data(off_type index) --- 186 unchanged lines hidden (view full) --- 2023}; 2024 2025/** Reference counting pointer to a function Node. */ 2026typedef RefCountingPtr<Node> NodePtr; 2027 2028class ScalarStatNode : public Node 2029{ 2030 private: |
2030 const ScalarInfoBase *data; | 2031 const ScalarInfo *data; |
2031 mutable VResult vresult; 2032 2033 public: | 2032 mutable VResult vresult; 2033 2034 public: |
2034 ScalarStatNode(const ScalarInfoBase *d) : data(d), vresult(1) {} | 2035 ScalarStatNode(const ScalarInfo *d) : data(d), vresult(1) {} |
2035 2036 const VResult & 2037 result() const 2038 { 2039 vresult[0] = data->result(); 2040 return vresult; 2041 } 2042 --- 46 unchanged lines hidden (view full) --- 2089 { 2090 return proxy.str(); 2091 } 2092}; 2093 2094class VectorStatNode : public Node 2095{ 2096 private: | 2036 2037 const VResult & 2038 result() const 2039 { 2040 vresult[0] = data->result(); 2041 return vresult; 2042 } 2043 --- 46 unchanged lines hidden (view full) --- 2090 { 2091 return proxy.str(); 2092 } 2093}; 2094 2095class VectorStatNode : public Node 2096{ 2097 private: |
2097 const VectorInfoBase *data; | 2098 const VectorInfo *data; |
2098 2099 public: | 2099 2100 public: |
2100 VectorStatNode(const VectorInfoBase *d) : data(d) { } | 2101 VectorStatNode(const VectorInfo *d) : data(d) { } |
2101 const VResult &result() const { return data->result(); } 2102 Result total() const { return data->total(); }; 2103 2104 size_type size() const { return data->size(); } 2105 2106 std::string str() const { return data->name; } 2107}; 2108 --- 440 unchanged lines hidden (view full) --- 2549 VectorAverageDeviation & 2550 init(size_type size) 2551 { 2552 this->doInit(size); 2553 return this->self(); 2554 } 2555}; 2556 | 2102 const VResult &result() const { return data->result(); } 2103 Result total() const { return data->total(); }; 2104 2105 size_type size() const { return data->size(); } 2106 2107 std::string str() const { return data->name; } 2108}; 2109 --- 440 unchanged lines hidden (view full) --- 2550 VectorAverageDeviation & 2551 init(size_type size) 2552 { 2553 this->doInit(size); 2554 return this->self(); 2555 } 2556}; 2557 |
2557class FormulaInfoBase : public VectorInfoBase | 2558class FormulaInfo : public VectorInfo |
2558{ 2559 public: 2560 virtual std::string str() const = 0; 2561}; 2562 2563template <class Stat> | 2559{ 2560 public: 2561 virtual std::string str() const = 0; 2562}; 2563 2564template <class Stat> |
2564class FormulaInfo : public InfoWrap<Stat, FormulaInfoBase> | 2565class FormulaInfoProxy : public InfoProxy<Stat, FormulaInfo> |
2565{ 2566 protected: 2567 mutable VResult vec; 2568 mutable VCounter cvec; 2569 2570 public: | 2566{ 2567 protected: 2568 mutable VResult vec; 2569 mutable VCounter cvec; 2570 2571 public: |
2571 FormulaInfo(Stat &stat) : InfoWrap<Stat, FormulaInfoBase>(stat) {} | 2572 FormulaInfoProxy(Stat &stat) : InfoProxy<Stat, FormulaInfo>(stat) {} |
2572 2573 size_type size() const { return this->s.size(); } 2574 2575 const VResult & 2576 result() const 2577 { 2578 this->s.result(vec); 2579 return vec; --- 5 unchanged lines hidden (view full) --- 2585}; 2586 2587class Temp; 2588/** 2589 * A formula for statistics that is calculated when printed. A formula is 2590 * stored as a tree of Nodes that represent the equation to calculate. 2591 * @sa Stat, ScalarStat, VectorStat, Node, Temp 2592 */ | 2573 2574 size_type size() const { return this->s.size(); } 2575 2576 const VResult & 2577 result() const 2578 { 2579 this->s.result(vec); 2580 return vec; --- 5 unchanged lines hidden (view full) --- 2586}; 2587 2588class Temp; 2589/** 2590 * A formula for statistics that is calculated when printed. A formula is 2591 * stored as a tree of Nodes that represent the equation to calculate. 2592 * @sa Stat, ScalarStat, VectorStat, Node, Temp 2593 */ |
2593class Formula : public DataWrapVec | 2594class Formula : public DataWrapVec<Formula, FormulaInfoProxy> |
2594{ 2595 protected: 2596 /** The root of the tree which represents the Formula */ 2597 NodePtr root; 2598 friend class Temp; 2599 2600 public: 2601 /** --- 339 unchanged lines hidden --- | 2595{ 2596 protected: 2597 /** The root of the tree which represents the Formula */ 2598 NodePtr root; 2599 friend class Temp; 2600 2601 public: 2602 /** --- 339 unchanged lines hidden --- |