cvc4-1.4
statistics.h
Go to the documentation of this file.
1 /********************* */
18 #include "cvc4_public.h"
19 
20 #ifndef __CVC4__STATISTICS_H
21 #define __CVC4__STATISTICS_H
22 
23 #include "util/sexpr.h"
24 
25 #include <string>
26 #include <ostream>
27 #include <set>
28 #include <iterator>
29 #include <utility>
30 
31 namespace CVC4 {
32 
33 class Stat;
34 
36 protected:
37 
38  static std::string s_regDelim;
39 
41  struct StatCmp {
42  bool operator()(const Stat* s1, const Stat* s2) const;
43  };/* struct StatisticsRegistry::StatCmp */
44 
46  typedef std::set< Stat*, StatCmp > StatSet;
47 
48  std::string d_prefix;
49 
51  StatSet d_stats;
52 
54  StatisticsBase(const StatisticsBase& stats);
55  StatisticsBase& operator=(const StatisticsBase& stats);
56 
57 public:
58 
59  virtual ~StatisticsBase() { }
60 
61  class CVC4_PUBLIC iterator : public std::iterator< std::input_iterator_tag, std::pair<std::string, SExpr> > {
62  StatSet::iterator d_it;
63 
64  iterator(StatSet::iterator it) : d_it(it) { }
65 
66  friend class StatisticsBase;
67 
68  public:
69  iterator() : d_it() { }
70  iterator(const iterator& it) : d_it(it.d_it) { }
71  value_type operator*() const;
72  iterator& operator++() { ++d_it; return *this; }
73  iterator operator++(int) { iterator old = *this; ++d_it; return old; }
74  bool operator==(const iterator& i) const { return d_it == i.d_it; }
75  bool operator!=(const iterator& i) const { return d_it != i.d_it; }
76  };/* class StatisticsBase::iterator */
77 
80 
82  virtual void setPrefix(const std::string& prefix);
83 
85  void flushInformation(std::ostream& out) const;
86 
88  SExpr getStatistic(std::string name) const;
89 
94  const_iterator begin() const;
95 
99  const_iterator end() const;
100 
101 };/* class StatisticsBase */
102 
104  void clear();
105  void copyFrom(const StatisticsBase&);
106 
107 public:
108 
113  Statistics(const StatisticsBase& stats);
114  Statistics(const Statistics& stats);
115 
116  ~Statistics();
117 
122  Statistics& operator=(const StatisticsBase& stats);
123  Statistics& operator=(const Statistics& stats);
124 
125 };/* class Statistics */
126 
127 }/* CVC4 namespace */
128 
129 #endif /* __CVC4__STATISTICS_H */
A helper class for comparing two statistics.
Definition: statistics.h:41
Definition: options.h:60
iterator(const iterator &it)
Definition: statistics.h:70
Simple representation of S-expressions.
std::set< Stat *, StatCmp > StatSet
A type for a set of statistics.
Definition: statistics.h:46
bool operator!=(const iterator &i) const
Definition: statistics.h:75
#define CVC4_PUBLIC
Definition: cvc4_public.h:30
bool operator==(const iterator &i) const
Definition: statistics.h:74
Macros that should be defined everywhere during the building of the libraries and driver binary...
StatSet d_stats
The set of statistics in this object.
Definition: statistics.h:51
std::string d_prefix
Definition: statistics.h:48
iterator const_iterator
An iterator type over a set of statistics.
Definition: statistics.h:79
struct CVC4::options::out__option_t out
CVC4::Statistics Statistics
Definition: cvc3_compat.h:462
A simple S-expression.
Definition: sexpr.h:51
static std::string s_regDelim
Definition: statistics.h:38
virtual ~StatisticsBase()
Definition: statistics.h:59