npstat
is hosted by
Hepforge
,
IPPP Durham
Home
Subversion
Tracker
Wiki
NPStat
5.10.0
nm
PtrBufferHandle.hh
1
#ifndef NPSTAT_PTRBUFFERHANDLE_HH_
2
#define NPSTAT_PTRBUFFERHANDLE_HH_
3
4
//======================================================================
5
// PtrBufferHandle.hh
6
//
7
// This is an internal header which is subject to change without notice.
8
// Application code should never use the classes declared/defined in
9
// this header directly.
10
//
11
// Author: I. Volobouev
12
//
13
// June 2015
14
//======================================================================
15
16
#include <cassert>
17
18
namespace
npstat
{
19
namespace
Private {
20
template
<
class
T>
21
class
PtrBufferHandle
22
{
23
public
:
24
inline
PtrBufferHandle
(T** buf,
const
unsigned
len)
25
: buf_(buf), len_(len) {
if
(len_) assert(buf_);}
26
27
inline
~
PtrBufferHandle
()
28
{
29
for
(
unsigned
i=0; i<len_; ++i)
30
delete
buf_[i];
31
}
32
33
inline
T** release()
34
{
35
T** b = buf_;
36
buf_ = 0;
37
len_ = 0U;
38
return
b;
39
}
40
41
private
:
42
PtrBufferHandle
();
43
PtrBufferHandle
(
const
PtrBufferHandle
&);
44
PtrBufferHandle
& operator=(
const
PtrBufferHandle
&);
45
46
T** buf_;
47
unsigned
len_;
48
};
49
}
50
}
51
52
#endif
// NPSTAT_PTRBUFFERHANDLE_HH_
npstat::Private::PtrBufferHandle
Definition:
PtrBufferHandle.hh:22
npstat
Definition:
AbsArrayProjector.hh:14
Generated by
1.9.1