Logo ROOT  
Reference Guide
MnReferenceCounter.h
Go to the documentation of this file.
1// @(#)root/minuit2:$Id$
2// Authors: M. Winkler, F. James, L. Moneta, A. Zsenei 2003-2005
3
4/**********************************************************************
5 * *
6 * Copyright (c) 2005 LCG ROOT Math team, CERN/PH-SFT *
7 * *
8 **********************************************************************/
9
10#ifndef ROOT_Minuit2_MnReferenceCounter
11#define ROOT_Minuit2_MnReferenceCounter
12
13#include <cassert>
14
15#include "StackAllocator.h"
16
17namespace ROOT {
18
19 namespace Minuit2 {
20
21
22//extern StackAllocator gStackAllocator;
23
25
26public:
27
29
31 fReferences(other.fReferences) {}
32
35 return *this;
36 }
37
39
40 void* operator new(size_t nbytes) {
41 return StackAllocatorHolder::Get().Allocate(nbytes);
42 }
43
44 void operator delete(void* p, size_t /*nbytes */) {
46 }
47
48 unsigned int References() const {return fReferences;}
49
50 void AddReference() const {fReferences++;}
51
52 void RemoveReference() const {fReferences--;}
53
54private:
55
56 mutable unsigned int fReferences;
57};
58
59 } // namespace Minuit2
60
61} // namespace ROOT
62
63#endif // ROOT_Minuit2_MnReferenceCounter
MnReferenceCounter(const MnReferenceCounter &other)
MnReferenceCounter & operator=(const MnReferenceCounter &other)
static StackAllocator & Get()
void * Allocate(size_t nBytes)
VSD Structures.
Definition: StringConv.hxx:21