summaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorTim King <taking@cs.nyu.edu>2010-06-22 17:25:14 +0000
committerTim King <taking@cs.nyu.edu>2010-06-22 17:25:14 +0000
commit452cf36c789006db5e1202cf06fdc9dbd158f775 (patch)
treeb158c250c88cb292b4b7525de37b579ae3123226 /src/util
parent498bb02fc7d2539d41b778bc42e383ca8dbf6d9e (diff)
Made ~Stat() virtual. Added some additional statistics. And added some documentation.
Diffstat (limited to 'src/util')
-rw-r--r--src/util/stats.h15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/util/stats.h b/src/util/stats.h
index b9f0fdf61..43f84fee6 100644
--- a/src/util/stats.h
+++ b/src/util/stats.h
@@ -66,6 +66,7 @@ public:
AlwaysAssert(d_name.find(s_delim) == std::string::npos);
}
}
+ virtual ~Stat() {}
virtual void flushInformation(std::ostream& out) const = 0;
@@ -96,6 +97,11 @@ inline void StatisticsRegistry::registerStat(Stat* s) throw (AssertionException)
}
+
+/**
+ * class T must have stream insertion operation defined.
+ * std::ostream& operator<<(std::ostream&, const T&);
+ */
template<class T>
class DataStat : public Stat{
public:
@@ -111,15 +117,20 @@ public:
}
};
+/** T must have an assignment operator=(). */
template <class T>
class ReferenceStat: public DataStat<T>{
private:
const T* d_data;
public:
- ReferenceStat(const std::string& s): DataStat<T>(s), d_data(NULL){}
+ ReferenceStat(const std::string& s):
+ DataStat<T>(s), d_data(NULL)
+ {}
- ReferenceStat(const std::string& s, const T& data):ReferenceStat<T>(s){
+ ReferenceStat(const std::string& s, const T& data):
+ DataStat<T>(s),d_data(NULL)
+ {
setData(data);
}
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback