| # Gaudi Framework, version v21r10p1 |

Home |  | Generated: 29 Jul 2010

# EventIterator.h

Go to the documentation of this file.

    00001 //      ============================================================
    00002 //
    00003 //      EventIterator.h
    00004 //      ------------------------------------------------------------
    00005 //
    00006 //      Package   : EventSelector
    00007 //
    00008 //      Author    : Markus Frank
    00009 //
    00010 //      ===========================================================
    00011 #ifndef GAUDISVC_EVENTSELECTOR_EVENTITERATOR_H
    00012 #define GAUDISVC_EVENTSELECTOR_EVENTITERATOR_H 1
    00013
    00014 // Include files
    00015 #include "GaudiKernel/IEvtSelector.h"
    00016 #include "GaudiKernel/IDataStreamTool.h"
    00017
    00032 class EvtSelectorContext  : public IEvtSelector::Context {
    00033   // Friend declaration
    00034   friend class EventSelector;
    00035   friend class EventCollectionSelector;
    00036 private:
    00038   EvtSelectorContext ( const EvtSelectorContext& copy)
    00039   : IEvtSelector::Context(copy),
    00040     m_count(copy.m_count),
    00041     m_strCount(copy.m_strCount),
    00042     m_pSelector(copy.m_pSelector),
    00043     m_context(copy.m_context),
    00044     m_pAddress(copy.m_pAddress)
    00045   {
    00046   }
    00047 protected:
    00049   IDataStreamTool::size_type m_streamID;
    00051   long                       m_count;
    00053   long                       m_strCount;
    00055   const IEvtSelector*     m_pSelector;
    00057   IEvtSelector::Context*  m_context;
    00059   IOpaqueAddress*         m_pAddress;
    00061   void set(const IEvtSelector* sel, IDataStreamTool::size_type id, IEvtSelector::Context* it, IOpaqueAddress* pA)    {
    00062     m_pSelector = sel;
    00063     m_context   = it;
    00064     m_streamID  = id;
    00065     m_pAddress  = pA;
    00066     m_strCount  = -1;
    00067   }
    00069   void set(IEvtSelector::Context* it, IOpaqueAddress* pA)    {
    00070     m_context = it;
    00071     m_pAddress = pA;
    00072   }
    00074   void set(IOpaqueAddress* pA)    {
    00075     m_pAddress = pA;
    00076   }
    00078   IEvtSelector::Context* context()  const  {
    00079     return m_context;
    00080   }
    00082   IDataStreamTool::size_type increaseCounters(bool reset=false)   {
    00083     m_count++;
    00084     m_strCount = (reset) ? 0 : m_strCount+1;
    00085     return m_count;
    00086   }
    00088   IDataStreamTool::size_type decreaseCounters(bool reset=false)   {
    00089     m_count++;
    00090     m_strCount = (reset) ? 0 : m_strCount-1;
    00091     return m_count;
    00092   }
    00093 public:
    00095   EvtSelectorContext( const IEvtSelector* selector )
    00096   : m_streamID(-1),
    00097     m_count(-1),
    00098     m_strCount(-1),
    00099     m_pSelector(selector),
    00100     m_context(0),
    00101     m_pAddress(0)
    00102   {
    00103   }
    00105   virtual ~EvtSelectorContext() {
    00106   }
    00108   virtual EvtSelectorContext& operator=(const EvtSelectorContext& copy)   {
    00109     m_streamID  = copy.m_streamID;
    00110     m_count     = copy.m_count;
    00111     m_strCount  = copy.m_strCount;
    00112     m_pSelector = copy.m_pSelector;
    00113     m_context   = copy.m_context;
    00114     m_pAddress  = copy.m_pAddress;
    00115     return *this;
    00116   }
    00118   virtual IDataStreamTool::size_type ID()   const   {
    00119     return m_streamID;
    00120   }
    00122   long numEvent()  const    {
    00123     return m_count;
    00124   }
    00126   long numStreamEvent()  const    {
    00127     return m_strCount;
    00128   }
    00129   void* identifier() const  {
    00130     return (void*)m_pSelector;
    00131   }
    00132 };
    00133 #endif // GAUDISVC_EVENTSELECTOR_EVENTITERATOR_H