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