CLHEP
2.4.6.4
C++ Class Library for High Energy Physics
Loading...
Searching...
No Matches
ZMuseCount.cc
Go to the documentation of this file.
1
// ----------------------------------------------------------------------
2
//
3
// ZMuseCount.cc - utility class for use in reference-counting
4
//
5
//
6
// History:
7
// 19-Sep-1997 WEB Design stolen, and code adapted, from pp 70-73 of
8
// Koenig & Moo: "Ruminations on C++" (1996)
9
//
10
// ----------------------------------------------------------------------
11
12
13
#ifndef ZMUSECOUNT_H
14
#include "CLHEP/RefCount/ZMuseCount.h"
15
#include "CLHEP/RefCount/ZMuseCount.icc"
16
#endif
17
18
19
bool
ZMuseCount::makeonly
() {
20
21
bool
result = ( !
only
() );
22
23
if
( result ) {
24
--*p;
25
p =
new
int(1);
26
}
27
28
return
result;
29
30
}
// makeonly()
31
32
33
bool
ZMuseCount::reattach
(
const
ZMuseCount
& u ) {
34
35
++*u.p;
36
37
bool
result = ( --*p == 0 );
38
if
( result )
39
delete
p;
40
41
p = u.p;
42
return
result;
43
44
}
// reattach()
ZMuseCount
Definition:
ZMuseCount.h:17
ZMuseCount::makeonly
bool makeonly()
Definition:
ZMuseCount.cc:19
ZMuseCount::only
bool only()
ZMuseCount::reattach
bool reattach(const ZMuseCount &u)
Definition:
ZMuseCount.cc:33
CLHEP-CLHEP_2_4_6_4
RefCount
src
ZMuseCount.cc
Generated by
1.9.6