Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

TypedCollection.h

Go to the documentation of this file.
00001 //
00002 // Namespace: ATLFast::
00003 //
00004 // class: TypedCollection
00005 //
00006 // Description:
00007 //
00008 // Atlfast (end 2001) stores various versions of collections
00009 // eg ObjectVector<DefaultRecontructed> particle maker in the TES, at
00010 // specified addresses (== string key)
00011 //
00012 // We now use StoreGate which allows storage of objects without keys
00013 // if no other object of the type has been stored.
00014 // This class provides a type wrapper to allow the different 
00015 // colelctions to be wrapped by an object with different types
00016 // eg TypedCollection<Muon>, TypedCollection<Electron>
00017 //
00018 // The motivation is 1) provide a little more type safety for downstream
00019 // algorithms. 2) remove the algorithm coupling via Tes locations in the
00020 // jobOptions files.
00021 //
00022 // Authors:
00023 //    P.Sherwood
00024 //
00025 // Written:
00026 //    15-Nove-2001
00027 // Revised:
00028 //
00029 //
00030 // ................................................................
00031 //
00032 #ifndef ATLFAST_TYPEDCOLLECTION_H
00033 #define ATLFAST_TYPEDCOLLECTION_H
00034 
00035 
00036 
00037 // Gaudi/Athena 
00038 #include "GaudiKernel/ObjectVector.h"
00039 
00040 // Atlfast
00041 
00042 
00043 static const CLID CLID_ATLFAST_TypedCollection=2312 ;
00044 
00045 
00046 namespace Atlfast {
00056   template<class T, class C> class TypedCollection: public DataObject 
00057     {
00058       
00059     public:
00060       
00061       //.............
00062       // Constructors
00063       
00064       TypedCollection(C* collection): DataObject(),m_collection(collection){}
00065       TypedCollection(): DataObject(),m_collection(0){}  //needed by Gaudi
00066       virtual ~TypedCollection() {}
00067 
00068       virtual const CLID& clID() const{return TypedCollection<T, C>::classID();}
00069       static const CLID& classID() {
00070         static CLID clid = C::classID()+CLID_ATLFAST_TypedCollection;
00071         return clid;
00072       }
00073       operator C*() const {return m_collection;}
00074       
00075     private:
00076       // Copy constructor
00077       TypedCollection(const TypedCollection<T, C>&): DataObject(){};
00078       C* m_collection;
00079      
00080      
00081     };
00082 
00086   template<class T, class C> class TypedCollectionFactory{
00087   public:
00088     TypedCollection<T, C>*  make(C* collection){ 
00089       TypedCollection<T, C>* tcptr =new TypedCollection<T, C>(collection);
00090       return tcptr;
00091     }
00092   };
00093 } // end of namespace bracket
00094 #endif
00095 
00096 
00097 
00098 
00099 
00100 
00101 
00102 
00103 
00104 
00105 

Generated on Fri Nov 29 12:55:12 2002 by doxygen1.3-rc1