STIR  6.2.0
TimedBlock.h
Go to the documentation of this file.
1 // @(#)Timer.h 1.6: 00/03/23
2 /*
3  Copyright (C) 2000 PARAPET partners
4  Copyright (C) 2000- 2009, Hammersmith Imanet Ltd
5  This file is part of STIR.
6 
7  SPDX-License-Identifier: Apache-2.0 AND License-ref-PARAPET-license
8 
9  See STIR/LICENSE.txt for details
10 */
11 
22 #ifndef _stir_TimedBlock_H_
23 #define _stir_TimedBlock_H_
24 namespace stir
25 {
26 
27 class Timer;
28 
62 template <class TimerT>
63 class TimedBlock<TimerT = Timer>
64 {
65 public:
67  inline TimedBlock(TimerT& Timer);
69  inline virtual ~TimedBlock(void);
70 
71 protected:
72 private:
73  TimedBlock(const TimedBlock&); // Not defined
74  TimedBlock& operator=(const TimedBlock&); // Not defined
75 
76  TimerT& m_Timer;
77 };
78 
79 template <class TimerT>
80 TimedBlock<TimerT>::TimedBlock(TimerT& timer)
81  : m_Timer(timer)
82 {
83  m_Timer.start();
84 }
85 
86 template <class TimerT>
87 TimedBlock<TimerT>::~TimedBlock(void)
88 {
89  m_Timer.stop();
90 }
91 } // namespace stir
92 
93 #endif
Namespace for the STIR library (and some/most of its applications)
Definition: General_Reconstruction.cxx:6
A general base class for timers. Interface is like a stop watch.
Definition: Timer.h:53