COIN-OR::LEMON - Graph Library

Changeset 209:765619b7cbb2 in lemon for lemon/counter.h


Ignore:
Timestamp:
07/13/08 20:51:02 (16 years ago)
Author:
Alpar Juttner <alpar@…>
Branch:
default
Phase:
public
Message:

Apply unify-sources.sh to the source tree

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lemon/counter.h

    r168 r209  
    1 /* -*- C++ -*-
    2  *
    3  * This file is a part of LEMON, a generic C++ optimization library
     1/* -*- mode: C++; indent-tabs-mode: nil; -*-
     2 *
     3 * This file is a part of LEMON, a generic C++ optimization library.
    44 *
    55 * Copyright (C) 2003-2008
     
    2727///\brief Tools for counting steps and events
    2828
    29 namespace lemon 
     29namespace lemon
    3030{
    3131
     
    3333
    3434  template<class P>
    35   class _SubCounter 
     35  class _SubCounter
    3636  {
    3737    P &_parent;
     
    5050    _SubCounter(P &parent,const char *title,std::ostream &os=std::cerr)
    5151      : _parent(parent), _title(title), _os(os), count(0) {}
    52     ~_SubCounter() { 
     52    ~_SubCounter() {
    5353      _os << _title << count <<std::endl;
    5454      _parent+=count;
     
    6464
    6565  template<class P>
    66   class _NoSubCounter 
     66  class _NoSubCounter
    6767  {
    6868    P &_parent;
     
    7070    typedef _NoSubCounter<_NoSubCounter<P> > SubCounter;
    7171    typedef _NoSubCounter<_NoSubCounter<P> > NoSubCounter;
    72  
     72
    7373    _NoSubCounter(P &parent) :_parent(parent) {}
    74     _NoSubCounter(P &parent,std::string,std::ostream &) 
    75       :_parent(parent) {}
    76     _NoSubCounter(P &parent,std::string) 
     74    _NoSubCounter(P &parent,std::string,std::ostream &)
     75      :_parent(parent) {}
     76    _NoSubCounter(P &parent,std::string)
    7777      :_parent(parent) {}
    7878    _NoSubCounter(P &parent,const char *,std::ostream &)
     
    103103  /// for different types of operations.
    104104  /// A report containing the given title and the value of the counter
    105   /// is automatically printed on destruction. 
     105  /// is automatically printed on destruction.
    106106  ///
    107107  /// The following example shows the usage of counters and subcounters.
     
    134134  ///
    135135  /// \sa NoCounter
    136   class Counter 
     136  class Counter
    137137  {
    138138    std::string _title;
     
    142142
    143143    /// SubCounter class
    144    
     144
    145145    /// This class can be used to setup subcounters for a \ref Counter
    146146    /// to have finer reports. A subcounter provides exactly the same
     
    148148    /// decrements the value of its parent.
    149149    /// Subcounters can also have subcounters.
    150     /// 
     150    ///
    151151    /// The parent counter must be given as the first parameter of the
    152152    /// constructor. Apart from that a title and an \c ostream object
     
    157157    /// would like to turn off this report, use \ref NoSubCounter
    158158    /// instead.
    159     /// 
     159    ///
    160160    /// \sa NoSubCounter
    161161    typedef _SubCounter<Counter> SubCounter;
    162162
    163     /// SubCounter class without printing report on destruction 
    164    
     163    /// SubCounter class without printing report on destruction
     164
    165165    /// This class can be used to setup subcounters for a \ref Counter.
    166166    /// It is the same as \ref SubCounter but it does not print report
     
    169169    ///
    170170    /// Replacing \ref SubCounter "SubCounter"s with \ref NoSubCounter
    171     /// "NoSubCounter"s makes it possible to turn off reporting 
     171    /// "NoSubCounter"s makes it possible to turn off reporting
    172172    /// subcounter values without actually removing the definitions
    173173    /// and the increment or decrement operators.
     
    179179    Counter() : _title(), _os(std::cerr), count(0) {}
    180180    /// Constructor.
    181     Counter(std::string title,std::ostream &os=std::cerr) 
     181    Counter(std::string title,std::ostream &os=std::cerr)
    182182      : _title(title), _os(os), count(0) {}
    183183    /// Constructor.
     
    205205    /// \note This function does not reset the values of
    206206    /// \ref SubCounter "SubCounter"s but it resets \ref NoSubCounter
    207     /// "NoSubCounter"s along with the main counter. 
     207    /// "NoSubCounter"s along with the main counter.
    208208    void reset(int c=0) {count=c;}
    209209    /// Returns the value of the counter.
Note: See TracChangeset for help on using the changeset viewer.