diff options
Diffstat (limited to 'src/base/statistics.cc')
-rw-r--r-- | src/base/statistics.cc | 78 |
1 files changed, 39 insertions, 39 deletions
diff --git a/src/base/statistics.cc b/src/base/statistics.cc index 032cbf689..c77816f23 100644 --- a/src/base/statistics.cc +++ b/src/base/statistics.cc @@ -158,7 +158,7 @@ Info::less(Info *stat1, Info *stat2) bool Info::baseCheck() const { - if (!(flags & init)) { + if (!(flags & Stats::init)) { #ifdef DEBUG cprintf("this is stat number %d\n", id); #endif @@ -175,21 +175,52 @@ Info::baseCheck() const } +Formula::Formula() +{ + setInit(); +} + +Formula::Formula(Temp r) +{ + root = r; + assert(size()); +} + +const Formula & +Formula::operator=(Temp r) +{ + assert(!root && "Can't change formulas"); + root = r; + assert(size()); + return *this; +} + +const Formula & +Formula::operator+=(Temp r) +{ + if (root) + root = NodePtr(new BinaryNode<std::plus<Result> >(root, r)); + else + root = r; + assert(size()); + return *this; +} + void -FormulaBase::result(VResult &vec) const +Formula::result(VResult &vec) const { if (root) vec = root->result(); } Result -FormulaBase::total() const +Formula::total() const { return root ? root->total() : 0.0; } size_type -FormulaBase::size() const +Formula::size() const { if (!root) return 0; @@ -198,12 +229,12 @@ FormulaBase::size() const } void -FormulaBase::reset() +Formula::reset() { } bool -FormulaBase::zero() const +Formula::zero() const { VResult vec; result(vec); @@ -214,47 +245,16 @@ FormulaBase::zero() const } void -FormulaBase::update(Info *) +Formula::update() { } string -FormulaBase::str() const +Formula::str() const { return root ? root->str() : ""; } -Formula::Formula() -{ - setInit(); -} - -Formula::Formula(Temp r) -{ - root = r; - assert(size()); -} - -const Formula & -Formula::operator=(Temp r) -{ - assert(!root && "Can't change formulas"); - root = r; - assert(size()); - return *this; -} - -const Formula & -Formula::operator+=(Temp r) -{ - if (root) - root = NodePtr(new BinaryNode<std::plus<Result> >(root, r)); - else - root = r; - assert(size()); - return *this; -} - void check() { |