STIR 6.4.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_
24namespace stir
25{
26
27class Timer;
28
62template <class TimerT>
63class TimedBlock<TimerT = Timer>
64{
65public:
67 inline TimedBlock(TimerT& Timer);
69 inline virtual ~TimedBlock(void);
70
71protected:
72private:
73 TimedBlock(const TimedBlock&); // Not defined
74 TimedBlock& operator=(const TimedBlock&); // Not defined
75
76 TimerT& m_Timer;
77};
78
79template <class TimerT>
80TimedBlock<TimerT>::TimedBlock(TimerT& timer)
81 : m_Timer(timer)
82{
83 m_Timer.start();
84}
85
86template <class TimerT>
87TimedBlock<TimerT>::~TimedBlock(void)
88{
89 m_Timer.stop();
90}
91} // namespace stir
92
93#endif
virtual ~TimedBlock(void)
Destroy a timed block.
TimedBlock(TimerT &Timer)
Create a timed block.
A general base class for timers. Interface is like a stop watch.
Definition Timer.h:54
Namespace for the STIR library (and some/most of its applications)
Definition General_Reconstruction.h:19