/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Event/DecayChain/DecayChain-00-00-03-slc6tag/DecayChain/Element/ReferenceHolder.h

Go to the documentation of this file.
00001 #ifndef DCHAIN_REFERENCEHOLDER_H
00002 #define DCHAIN_REFERENCEHOLDER_H
00003 // -*- C++ -*-
00004 //
00005 // Package:     DChain
00006 // Module:      ReferenceHolder
00007 // 
00008 // Description: Smart pointer for classes that inherit from ReferenceCount and who should not be modified
00009 //
00010 // Usage:
00011 //   ReferenceHolder()  - default constructor
00012 //   ~ReferenceHolder() - destructor
00013 //
00014 //   This class wraps a pointer to a class inheriting from ReferenceCount
00015 //     and deals with proper handling of the reference counting used to
00016 //     manage the objects lifetime
00017 //
00018 //   ReferenceHolder<Foo> pFoo = new Foo;
00019 //   pFoo->memberFunctionOfFoo();
00020 //   takeReferenceToFoo( *pFoo);
00021 //   takePointerToFoo( pFoo.pointer() );
00022 //
00023 // Author:      Chris D. Jones
00024 // Created:     Wed May 14 08:01:51 EDT 2003
00025 // $Id: ReferenceHolder.h,v 1.1.1.1 2009/03/03 06:06:56 maqm Exp $
00026 //
00027 // Revision history
00028 //
00029 // $Log: ReferenceHolder.h,v $
00030 // Revision 1.1.1.1  2009/03/03 06:06:56  maqm
00031 // first import of DecayChain
00032 //
00033 // Revision 1.1  2006/01/11 20:28:10  cdj
00034 // massive class renaming, addition of [] for selection and unit tests
00035 //
00036 // Revision 1.1  2003/05/15 19:56:01  cdj
00037 // revamped memory handling so always use a ReferenceHolder to deal with the reference counting
00038 //
00039 //
00040 
00041 // system include files
00042 #include <memory>
00043 
00044 // user include files
00045 #include "DecayChain/Element/ReferenceHolderBase.h"
00046 
00047 // forward declarations
00048 namespace dchain {
00049 template< class T>
00050 class ReferenceHolder : public ReferenceHolderBase<const T*, const T&>
00051 {
00052    public:
00053       // Constructors and destructor
00054       ReferenceHolder() {}
00055       ReferenceHolder(const T* iRef) : ReferenceHolderBase<const T*, const T&>(iRef) {}
00056       template<class THolder>
00057       explicit ReferenceHolder(THolder iHolder):
00058          ReferenceHolderBase<const T*, const T&>( &(*iHolder)) {}
00059 
00060       explicit ReferenceHolder(std::auto_ptr<T> iHolder):
00061          ReferenceHolderBase<const T*, const T&>(iHolder.release()) {}
00062 
00063 };
00064 }
00065 #endif // DCHAIN_REFERENCEHOLDER_H

Generated on Tue Nov 29 22:58:22 2016 for BOSS_7.0.2 by  doxygen 1.4.7