BOSS
6.6.4.p01
BESIII Offline Software System
Loading...
Searching...
No Matches
ReferenceHolder.h
Go to the documentation of this file.
1
#ifndef DCHAIN_REFERENCEHOLDER_H
2
#define DCHAIN_REFERENCEHOLDER_H
3
// -*- C++ -*-
4
//
5
// Package: DChain
6
// Module: ReferenceHolder
7
//
8
// Description: Smart pointer for classes that inherit from ReferenceCount and who should not be modified
9
//
10
// Usage:
11
// ReferenceHolder() - default constructor
12
// ~ReferenceHolder() - destructor
13
//
14
// This class wraps a pointer to a class inheriting from ReferenceCount
15
// and deals with proper handling of the reference counting used to
16
// manage the objects lifetime
17
//
18
// ReferenceHolder<Foo> pFoo = new Foo;
19
// pFoo->memberFunctionOfFoo();
20
// takeReferenceToFoo( *pFoo);
21
// takePointerToFoo( pFoo.pointer() );
22
//
23
// Author: Chris D. Jones
24
// Created: Wed May 14 08:01:51 EDT 2003
25
// $Id: ReferenceHolder.h,v 1.1.1.1 2009/03/03 06:06:56 maqm Exp $
26
//
27
// Revision history
28
//
29
// $Log: ReferenceHolder.h,v $
30
// Revision 1.1.1.1 2009/03/03 06:06:56 maqm
31
// first import of DecayChain
32
//
33
// Revision 1.1 2006/01/11 20:28:10 cdj
34
// massive class renaming, addition of [] for selection and unit tests
35
//
36
// Revision 1.1 2003/05/15 19:56:01 cdj
37
// revamped memory handling so always use a ReferenceHolder to deal with the reference counting
38
//
39
//
40
41
// system include files
42
#include <memory>
43
44
// user include files
45
#include "
DecayChain/Element/ReferenceHolderBase.h
"
46
47
// forward declarations
48
namespace
dchain
{
49
template
<
class
T>
50
class
ReferenceHolder
:
public
ReferenceHolderBase
<const T*, const T&>
51
{
52
public
:
53
// Constructors and destructor
54
ReferenceHolder
() {}
55
ReferenceHolder
(
const
T* iRef) :
ReferenceHolderBase
<const T*, const T&>(iRef) {}
56
template
<
class
THolder>
57
explicit
ReferenceHolder
(THolder iHolder):
58
ReferenceHolderBase
<const T*, const T&>( &(*iHolder)) {}
59
60
explicit
ReferenceHolder
(std::auto_ptr<T> iHolder):
61
ReferenceHolderBase
<const T*, const T&>(iHolder.
release
()) {}
62
63
};
64
}
65
#endif
// DCHAIN_REFERENCEHOLDER_H
release
struct sembuf release
Definition:
BesClient.cxx:122
ReferenceHolderBase.h
dchain::ReferenceHolderBase
Definition:
ReferenceHolderBase.h:41
dchain::ReferenceHolder
Definition:
ReferenceHolder.h:51
dchain::ReferenceHolder::ReferenceHolder
ReferenceHolder(const T *iRef)
Definition:
ReferenceHolder.h:55
dchain::ReferenceHolder::ReferenceHolder
ReferenceHolder(THolder iHolder)
Definition:
ReferenceHolder.h:57
dchain::ReferenceHolder::ReferenceHolder
ReferenceHolder(std::auto_ptr< T > iHolder)
Definition:
ReferenceHolder.h:60
dchain::ReferenceHolder::ReferenceHolder
ReferenceHolder()
Definition:
ReferenceHolder.h:54
dchain
Definition:
children.h:16
source
Event
DecayChain
DecayChain-00-00-03
DecayChain
Element
ReferenceHolder.h
Generated by
1.9.6