EventCollectionSelector.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef GAUDISVC_EventCollectionSelector_EventCollectionSelector_H
00012 #define GAUDISVC_EventCollectionSelector_EventCollectionSelector_H 1
00013
00014
00015 #include "GaudiKernel/Service.h"
00016 #include "GaudiKernel/GenericAddress.h"
00017 #include "GaudiKernel/IEvtSelector.h"
00018 #include "GaudiKernel/NTuple.h"
00019
00020
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_dbSvc;
00098 std::string m_statement;
00099 public:
00100
00102 virtual StatusCode initialize();
00104 virtual StatusCode finalize();
00105
00107
00111 virtual StatusCode createContext(Context*& refpCtxt) const;
00112
00114
00118 virtual StatusCode next(Context& refCtxt) const;
00119
00121
00125 virtual StatusCode next(Context& refCtxt,int jump) const;
00126
00128
00133 virtual StatusCode previous(Context& refCtxt) const;
00134
00136
00141 virtual StatusCode previous(Context& refCtxt,int jump) const;
00142
00144
00148 virtual StatusCode rewind(Context& refCtxt) const;
00149
00151
00156 virtual StatusCode createAddress(const Context& refCtxt, IOpaqueAddress*& refpAddr) const;
00157
00159
00163 virtual StatusCode releaseContext(Context*& refCtxt) const;
00164
00173 virtual StatusCode resetCriteria(const std::string& cr,Context& c)const;
00174
00180 virtual StatusCode last(Context& refCtxt) const;
00181
00183 virtual StatusCode connectCollection(MyContextType* ctxt) const;
00184
00186 virtual StatusCode connectDataSource(const std::string& db, const std::string& typ) const;
00188 virtual StatusCode connectTuple(const std::string& nam, const std::string& itName, NTuple::Tuple*& tup, NTuple::Item<IOpaqueAddress*>*& item) const;
00190 virtual StatusCode connectStatement(const std::string& typ, const std::string& crit, INTuple* tuple) const;
00192 virtual StatusCode getNextRecord(NTuple::Tuple* tuple) const;
00194 virtual StatusCode getPreviousRecord(NTuple::Tuple* tuple) const;
00195
00197 EventCollectionSelector( const std::string& name, ISvcLocator* svcloc );
00199 ~EventCollectionSelector();
00200 };
00201
00202 #endif // GAUDISVC_EventCollectionSelector_EventCollectionSelector_H