| 
            Last change
 on this file since 0e5675 was             9ebc9d, checked in by Frederik Heber <heber@…>, 15 years ago           | 
        
        
          | 
             
DOCUFIX: Removed old singleton stuff on cstor/dstor messages. 
 
           | 
        
        
          
            
              - 
Property                 mode
 set to                 
100644
               
             
           | 
        
        
          | 
            File size:
            1.4 KB
           | 
        
      
      
| Line |   | 
|---|
| 1 | /*
 | 
|---|
| 2 |  * Project: MoleCuilder
 | 
|---|
| 3 |  * Description: creates and alters molecular systems
 | 
|---|
| 4 |  * Copyright (C)  2010 University of Bonn. All rights reserved.
 | 
|---|
| 5 |  * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
 | 
|---|
| 6 |  */
 | 
|---|
| 7 | 
 | 
|---|
| 8 | /*
 | 
|---|
| 9 |  * Info.cpp
 | 
|---|
| 10 |  *
 | 
|---|
| 11 |  *  Created on: Nov 25, 2009
 | 
|---|
| 12 |  *      Author: heber
 | 
|---|
| 13 |  */
 | 
|---|
| 14 | 
 | 
|---|
| 15 | // include config.h
 | 
|---|
| 16 | #ifdef HAVE_CONFIG_H
 | 
|---|
| 17 | #include <config.h>
 | 
|---|
| 18 | #endif
 | 
|---|
| 19 | 
 | 
|---|
| 20 | #include "MemDebug.hpp"
 | 
|---|
| 21 | 
 | 
|---|
| 22 | #include "Chronos.hpp"
 | 
|---|
| 23 | #include "Info.hpp"
 | 
|---|
| 24 | #include "Log.hpp"
 | 
|---|
| 25 | #include "Verbose.hpp"
 | 
|---|
| 26 | 
 | 
|---|
| 27 | int Info::verbosity = 0;
 | 
|---|
| 28 | Chronos * Info::timekeeper = NULL;
 | 
|---|
| 29 | bool Info::ChronosBlocker = false;
 | 
|---|
| 30 | size_t Info::NumberInfos = 0;
 | 
|---|
| 31 | 
 | 
|---|
| 32 | /**
 | 
|---|
| 33 |  * Constructor.
 | 
|---|
| 34 |  *
 | 
|---|
| 35 |  * \return Info instance
 | 
|---|
| 36 |  */
 | 
|---|
| 37 | Info::Info(const char *msg) :
 | 
|---|
| 38 |   FunctionName(msg)
 | 
|---|
| 39 | {
 | 
|---|
| 40 |   verbosity++;
 | 
|---|
| 41 |   LOG(0, "INFO: Begin of "+FunctionName);
 | 
|---|
| 42 | 
 | 
|---|
| 43 |   // one more info object
 | 
|---|
| 44 |   ++NumberInfos;
 | 
|---|
| 45 | 
 | 
|---|
| 46 |   // have pointer ready
 | 
|---|
| 47 |   if (timekeeper == NULL) {
 | 
|---|
| 48 |     timekeeper = Chronos::getPointer();
 | 
|---|
| 49 |   }
 | 
|---|
| 50 | 
 | 
|---|
| 51 |   // start time keeping
 | 
|---|
| 52 |   timekeeper->startTiming(FunctionName);
 | 
|---|
| 53 | }
 | 
|---|
| 54 | 
 | 
|---|
| 55 | /**
 | 
|---|
| 56 |  * Destructor.
 | 
|---|
| 57 |  */
 | 
|---|
| 58 | Info::~Info()
 | 
|---|
| 59 | {
 | 
|---|
| 60 |   // end time keeping
 | 
|---|
| 61 |   timekeeper->endTiming(FunctionName);
 | 
|---|
| 62 | 
 | 
|---|
| 63 |   // verbosity stuff
 | 
|---|
| 64 |   LOG(0, "INFO: End of "+FunctionName);
 | 
|---|
| 65 |   verbosity--;
 | 
|---|
| 66 | 
 | 
|---|
| 67 |   // one info object less
 | 
|---|
| 68 |   --NumberInfos;
 | 
|---|
| 69 | 
 | 
|---|
| 70 |   // we are last one?
 | 
|---|
| 71 |   if (!NumberInfos) {
 | 
|---|
| 72 |     timekeeper = NULL;
 | 
|---|
| 73 |   }
 | 
|---|
| 74 | }
 | 
|---|
| 75 | 
 | 
|---|
| 76 | /**
 | 
|---|
| 77 |  * Sets the verbosity.
 | 
|---|
| 78 |  *
 | 
|---|
| 79 |  * \param verbosityLevel verbosity
 | 
|---|
| 80 |  */
 | 
|---|
| 81 | void Info::setVerbosity(int verbosityLevel)
 | 
|---|
| 82 | {
 | 
|---|
| 83 |   verbosity = verbosityLevel;
 | 
|---|
| 84 | }
 | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.