| # Gaudi Framework, version v21r6 |

Home |  | Generated: 11 Nov 2009

# EventCollectionSelector.h

Go to the documentation of this file.

    00001 //====================================================================
    00002 //      EventCollectionSelector.h
    00003 //--------------------------------------------------------------------
    00004 //
    00005 //      Package    : EventCollectionSelector  (LHCb Event Selector Package)
    00006 //
    00007 //      Author     : M.Frank
    00008 //  Created    : 4/10/00
    00009 //
    00010 //====================================================================
    00011 #ifndef GAUDISVC_EventCollectionSelector_EventCollectionSelector_H
    00012 #define GAUDISVC_EventCollectionSelector_EventCollectionSelector_H 1
    00013
    00014 // Include files
    00015 #include "GaudiKernel/Service.h"
    00016 #include "GaudiKernel/GenericAddress.h"
    00017 #include "GaudiKernel/IEvtSelector.h"
    00018 #include "GaudiKernel/NTuple.h"
    00019
    00020 // Forward declarations
    00021 class INTuple;
    00022 class INTupleSvc;
    00023 class IAddressCreator;
    00024 class EventSelectorDataStream;
    00025 template <class TYPE> class EventIterator;
    00026
    00041 class EventCollectionSelector : public extends1<Service, IEvtSelector> {
    00042 public:
    00043   class MyContextType : public IEvtSelector::Context {
    00044   public:
    00045     std::string                    criteria;
    00046     NTuple::Tuple*                 tuple;
    00047     NTuple::Item<IOpaqueAddress*>* item;
    00048     IOpaqueAddress*                addressBuffer;
    00049     MyContextType(NTuple::Tuple* t, NTuple::Item<IOpaqueAddress*>* i)    {
    00050       addressBuffer = new GenericAddress();
    00051       addressBuffer->addRef();
    00052       tuple = t;
    00053       item = i;
    00054     }
    00055     MyContextType(MyContextType* ctxt=0)  {
    00056       addressBuffer = new GenericAddress();
    00057       addressBuffer->addRef();
    00058       tuple = (ctxt) ? ctxt->tuple : 0;
    00059       item  = (ctxt) ? ctxt->item : 0;
    00060     }
    00061     MyContextType(const MyContextType& ctxt)
    00062       : IEvtSelector::Context(ctxt)
    00063     {
    00064       addressBuffer = new GenericAddress();
    00065       addressBuffer->addRef();
    00066       tuple = ctxt.tuple;
    00067       item  = ctxt.item;
    00068     }
    00069     virtual ~MyContextType()    {
    00070       addressBuffer->release();
    00071     }
    00072     virtual void* identifier() const {
    00073       return (void*)addressBuffer;
    00074     }
    00075     void setAddress(IOpaqueAddress* pAddr);
    00076   };
    00077 protected:
    00079   mutable SmartIF<INTupleSvc>      m_tupleSvc;
    00080   mutable SmartIF<IAddressCreator> m_pAddrCreator;
    00082   std::string              m_tupleSvcName;
    00084   std::string              m_authentication;
    00086   std::string              m_cntName;
    00088   std::string              m_itemName;
    00090   std::string              m_criteria;
    00092   std::string              m_database;
    00094   std::string              m_dbType;
    00096   std::string              m_statement;
    00097 public:
    00098
    00100   virtual StatusCode initialize();
    00102   virtual StatusCode finalize();
    00103
    00105
    00109   virtual StatusCode createContext(Context*& refpCtxt) const;
    00110
    00112
    00116   virtual StatusCode next(Context& refCtxt) const;
    00117
    00119
    00123   virtual StatusCode next(Context& refCtxt,int jump) const;
    00124
    00126
    00131   virtual StatusCode previous(Context& refCtxt) const;
    00132
    00134
    00139   virtual StatusCode previous(Context& refCtxt,int jump) const;
    00140
    00142
    00146   virtual StatusCode rewind(Context& refCtxt) const;
    00147
    00149
    00154   virtual StatusCode createAddress(const Context& refCtxt, IOpaqueAddress*& refpAddr) const;
    00155
    00157
    00161   virtual StatusCode releaseContext(Context*& refCtxt) const;
    00162
    00171   virtual StatusCode resetCriteria(const std::string& cr,Context& c)const;
    00172
    00178   virtual StatusCode last(Context& refCtxt) const;
    00179
    00181   virtual StatusCode connectCollection(MyContextType* ctxt) const;
    00182
    00184   virtual StatusCode connectDataSource(const std::string& db, const std::string& typ) const;
    00186   virtual StatusCode connectTuple(const std::string& nam, const std::string& itName, NTuple::Tuple*& tup, NTuple::Item<IOpaqueAddress*>*& item) const;
    00188   virtual StatusCode connectStatement(const std::string& typ, const std::string& crit, INTuple* tuple) const;
    00190   virtual StatusCode getNextRecord(NTuple::Tuple* tuple)  const;
    00192   virtual StatusCode getPreviousRecord(NTuple::Tuple* tuple)  const;
    00193
    00195   EventCollectionSelector( const std::string& name, ISvcLocator* svcloc );
    00197   ~EventCollectionSelector();
    00198 };
    00199
    00200 #endif  // GAUDISVC_EventCollectionSelector_EventCollectionSelector_H