lemon/counter.h
changeset 209 765619b7cbb2
parent 168 8ceb318224b1
child 463 88ed40ad0d4f
     1.1 --- a/lemon/counter.h	Sun Jul 13 16:46:56 2008 +0100
     1.2 +++ b/lemon/counter.h	Sun Jul 13 19:51:02 2008 +0100
     1.3 @@ -1,6 +1,6 @@
     1.4 -/* -*- C++ -*-
     1.5 +/* -*- mode: C++; indent-tabs-mode: nil; -*-
     1.6   *
     1.7 - * This file is a part of LEMON, a generic C++ optimization library
     1.8 + * This file is a part of LEMON, a generic C++ optimization library.
     1.9   *
    1.10   * Copyright (C) 2003-2008
    1.11   * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
    1.12 @@ -26,13 +26,13 @@
    1.13  ///\file
    1.14  ///\brief Tools for counting steps and events
    1.15  
    1.16 -namespace lemon 
    1.17 +namespace lemon
    1.18  {
    1.19  
    1.20    template<class P> class _NoSubCounter;
    1.21  
    1.22    template<class P>
    1.23 -  class _SubCounter 
    1.24 +  class _SubCounter
    1.25    {
    1.26      P &_parent;
    1.27      std::string _title;
    1.28 @@ -49,7 +49,7 @@
    1.29        : _parent(parent), _title(title), _os(os), count(0) {}
    1.30      _SubCounter(P &parent,const char *title,std::ostream &os=std::cerr)
    1.31        : _parent(parent), _title(title), _os(os), count(0) {}
    1.32 -    ~_SubCounter() { 
    1.33 +    ~_SubCounter() {
    1.34        _os << _title << count <<std::endl;
    1.35        _parent+=count;
    1.36      }
    1.37 @@ -63,17 +63,17 @@
    1.38    };
    1.39  
    1.40    template<class P>
    1.41 -  class _NoSubCounter 
    1.42 +  class _NoSubCounter
    1.43    {
    1.44      P &_parent;
    1.45    public:
    1.46      typedef _NoSubCounter<_NoSubCounter<P> > SubCounter;
    1.47      typedef _NoSubCounter<_NoSubCounter<P> > NoSubCounter;
    1.48 -  
    1.49 +
    1.50      _NoSubCounter(P &parent) :_parent(parent) {}
    1.51 -    _NoSubCounter(P &parent,std::string,std::ostream &) 
    1.52 +    _NoSubCounter(P &parent,std::string,std::ostream &)
    1.53        :_parent(parent) {}
    1.54 -    _NoSubCounter(P &parent,std::string) 
    1.55 +    _NoSubCounter(P &parent,std::string)
    1.56        :_parent(parent) {}
    1.57      _NoSubCounter(P &parent,const char *,std::ostream &)
    1.58        :_parent(parent) {}
    1.59 @@ -102,7 +102,7 @@
    1.60    /// define subcounters for the different phases of the algorithm or
    1.61    /// for different types of operations.
    1.62    /// A report containing the given title and the value of the counter
    1.63 -  /// is automatically printed on destruction. 
    1.64 +  /// is automatically printed on destruction.
    1.65    ///
    1.66    /// The following example shows the usage of counters and subcounters.
    1.67    /// \code
    1.68 @@ -133,7 +133,7 @@
    1.69    /// \endcode
    1.70    ///
    1.71    /// \sa NoCounter
    1.72 -  class Counter 
    1.73 +  class Counter
    1.74    {
    1.75      std::string _title;
    1.76      std::ostream &_os;
    1.77 @@ -141,13 +141,13 @@
    1.78    public:
    1.79  
    1.80      /// SubCounter class
    1.81 -    
    1.82 +
    1.83      /// This class can be used to setup subcounters for a \ref Counter
    1.84      /// to have finer reports. A subcounter provides exactly the same
    1.85      /// operations as the main \ref Counter, but it also increments and
    1.86      /// decrements the value of its parent.
    1.87      /// Subcounters can also have subcounters.
    1.88 -    /// 
    1.89 +    ///
    1.90      /// The parent counter must be given as the first parameter of the
    1.91      /// constructor. Apart from that a title and an \c ostream object
    1.92      /// can also be given just like for the main \ref Counter.
    1.93 @@ -156,19 +156,19 @@
    1.94      /// subcounter is automatically printed on destruction. If you
    1.95      /// would like to turn off this report, use \ref NoSubCounter
    1.96      /// instead.
    1.97 -    /// 
    1.98 +    ///
    1.99      /// \sa NoSubCounter
   1.100      typedef _SubCounter<Counter> SubCounter;
   1.101  
   1.102 -    /// SubCounter class without printing report on destruction 
   1.103 -    
   1.104 +    /// SubCounter class without printing report on destruction
   1.105 +
   1.106      /// This class can be used to setup subcounters for a \ref Counter.
   1.107      /// It is the same as \ref SubCounter but it does not print report
   1.108      /// on destruction. (It modifies the value of its parent, so 'No'
   1.109      /// only means 'do not print'.)
   1.110      ///
   1.111      /// Replacing \ref SubCounter "SubCounter"s with \ref NoSubCounter
   1.112 -    /// "NoSubCounter"s makes it possible to turn off reporting 
   1.113 +    /// "NoSubCounter"s makes it possible to turn off reporting
   1.114      /// subcounter values without actually removing the definitions
   1.115      /// and the increment or decrement operators.
   1.116      ///
   1.117 @@ -178,7 +178,7 @@
   1.118      /// Constructor.
   1.119      Counter() : _title(), _os(std::cerr), count(0) {}
   1.120      /// Constructor.
   1.121 -    Counter(std::string title,std::ostream &os=std::cerr) 
   1.122 +    Counter(std::string title,std::ostream &os=std::cerr)
   1.123        : _title(title), _os(os), count(0) {}
   1.124      /// Constructor.
   1.125      Counter(const char *title,std::ostream &os=std::cerr)
   1.126 @@ -204,7 +204,7 @@
   1.127      /// Resets the counter to the given value.
   1.128      /// \note This function does not reset the values of
   1.129      /// \ref SubCounter "SubCounter"s but it resets \ref NoSubCounter
   1.130 -    /// "NoSubCounter"s along with the main counter. 
   1.131 +    /// "NoSubCounter"s along with the main counter.
   1.132      void reset(int c=0) {count=c;}
   1.133      /// Returns the value of the counter.
   1.134      operator int() {return count;}