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

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 {
00054   template<class T, class C> class TypedCollection: public DataObject 
00055     {
00056       
00057     public:
00058       
00059       //.............
00060       // Constructors
00061       
00062       TypedCollection(C* collection): DataObject(),m_collection(collection){}
00063       TypedCollection(): DataObject(),m_collection(0){}  //needed by Gaudi
00064       virtual ~TypedCollection() {}
00065 
00066       virtual const CLID& clID() const{return TypedCollection<T, C>::classID();}
00067       static const CLID& classID() {
00068         static CLID clid = C::classID()+CLID_ATLFAST_TypedCollection;
00069         return clid;
00070       }
00071       operator C*() const {return m_collection;}
00072       
00073     private:
00074       // Copy constructor
00075       TypedCollection(const TypedCollection<T, C>&): DataObject(){};
00076       C* m_collection;
00077      
00078      
00079     };
00080 
00081   template<class T, class C> class TypedCollectionFactory{
00082   public:
00083     TypedCollection<T, C>*  make(C* collection){ 
00084       TypedCollection<T, C>* tcptr =new TypedCollection<T, C>(collection);
00085       return tcptr;
00086     }
00087   };
00088 } // end of namespace bracket
00089 #endif
00090 
00091 
00092 
00093 
00094 
00095 
00096 
00097 
00098 
00099 
00100 

Generated on Wed May 1 14:35:47 2002 for AtlfastEvent by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001