lemon/counter.h
changeset 208 4317d277ba21
parent 160 b1bd0c2a7f57
child 209 765619b7cbb2
equal deleted inserted replaced
2:9fc31d1543b2 3:6dfd509bede3
    57     int operator++(int) { return count++; }
    57     int operator++(int) { return count++; }
    58     _SubCounter &operator--() { count--; return *this;}
    58     _SubCounter &operator--() { count--; return *this;}
    59     int operator--(int) { return count--; }
    59     int operator--(int) { return count--; }
    60     _SubCounter &operator+=(int c) { count+=c; return *this;}
    60     _SubCounter &operator+=(int c) { count+=c; return *this;}
    61     _SubCounter &operator-=(int c) { count-=c; return *this;}
    61     _SubCounter &operator-=(int c) { count-=c; return *this;}
    62     void reset(int c=0) {count=c;}
       
    63     operator int() {return count;}
    62     operator int() {return count;}
    64   };
    63   };
    65 
    64 
    66   template<class P>
    65   template<class P>
    67   class _NoSubCounter 
    66   class _NoSubCounter 
    85     int operator++(int) { _parent++; return 0;}
    84     int operator++(int) { _parent++; return 0;}
    86     _NoSubCounter &operator--() { --_parent; return *this;}
    85     _NoSubCounter &operator--() { --_parent; return *this;}
    87     int operator--(int) { _parent--; return 0;}
    86     int operator--(int) { _parent--; return 0;}
    88     _NoSubCounter &operator+=(int c) { _parent+=c; return *this;}
    87     _NoSubCounter &operator+=(int c) { _parent+=c; return *this;}
    89     _NoSubCounter &operator-=(int c) { _parent-=c; return *this;}
    88     _NoSubCounter &operator-=(int c) { _parent-=c; return *this;}
    90     void reset(int) {}
       
    91     void reset() {}
       
    92     operator int() {return 0;}
    89     operator int() {return 0;}
    93   };
    90   };
    94 
    91 
    95 
    92 
    96   /// \addtogroup timecount
    93   /// \addtogroup timecount
   201     ///\e
   198     ///\e
   202     Counter &operator+=(int c) { count+=c; return *this;}
   199     Counter &operator+=(int c) { count+=c; return *this;}
   203     ///\e
   200     ///\e
   204     Counter &operator-=(int c) { count-=c; return *this;}
   201     Counter &operator-=(int c) { count-=c; return *this;}
   205     /// Resets the counter to the given value.
   202     /// Resets the counter to the given value.
       
   203 
       
   204     /// Resets the counter to the given value.
       
   205     /// \note This function does not reset the values of
       
   206     /// \ref SubCounter "SubCounter"s but it resets \ref NoSubCounter
       
   207     /// "NoSubCounter"s along with the main counter. 
   206     void reset(int c=0) {count=c;}
   208     void reset(int c=0) {count=c;}
   207     /// Returns the value of the counter.
   209     /// Returns the value of the counter.
   208     operator int() {return count;}
   210     operator int() {return count;}
   209   };
   211   };
   210 
   212