/search.css" rel="stylesheet" type="text/css"/> /search.js">
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

MockEvtSelector.cpp
Go to the documentation of this file.
00001 #include "MockEvtSelector.h"
00002 
00003 #include "MockEvtStructure.h"
00004 
00005 #include "GaudiKernel/GaudiException.h"
00006 #include "GaudiKernel/MsgStream.h"
00007 
00008 using namespace MockEvtConverters;
00009 
00010 MockEvtSelector::MockEvtSelector(const std::string& name,
00011                                  ISvcLocator* svc) :
00012                                    Service(name,
00013                                            svc) {
00014   declareProperty("ReadoutPath",
00015                   m_readoutPath="/Event/MockEvt/Readout");
00016 }
00017 
00018 StatusCode MockEvtSelector::createContext(Context*& context) const {
00019 
00020   context = new MockEvtContext();
00021 
00022   return StatusCode::SUCCESS;
00023 }
00024 
00025 StatusCode MockEvtSelector::releaseContext(Context*& context) const {
00026 
00027   if (0 != context) {
00028     delete context;
00029   }
00030 
00031   return StatusCode::SUCCESS;
00032 }
00033 
00034 StatusCode MockEvtSelector::next(Context& context) const {
00035   return next(context,
00036               1);
00037 }
00038 
00039 StatusCode MockEvtSelector::next(Context& context,
00040                                  int jump) const {
00041   MockEvtContext *ctxt = dynamic_cast<MockEvtContext*>(&context);
00042   ctxt->jump(jump);
00043 
00044   return StatusCode::SUCCESS;
00045 }
00046 
00047 StatusCode MockEvtSelector::createAddress(const Context& context,
00048                                           IOpaqueAddress*& addr) const {
00049 
00050   const MockEvtContext *ctxt = dynamic_cast<const MockEvtContext*>(&context);
00051   StatusCode status = ctxt->getEvent();
00052   if (status.isFailure()) {
00053     return StatusCode::FAILURE;
00054   }
00055 
00056   addr = new MockEvtStructure::Address(ctxt);
00057 
00058   return StatusCode::SUCCESS;
00059 }
00060 
00061 StatusCode MockEvtSelector::queryInterface(const InterfaceID& id,
00062                                            void** interface) {
00063   if (IEvtSelector::interfaceID().versionMatch(id)) {
00064     // If good enough match return this object.
00065     *interface = (IEvtSelector*)this;
00066     addRef();
00067   } else {
00068     // Interface is not directly available: try out a base class.
00069     return Service::queryInterface(id,
00070                                    interface);
00071   }
00072 
00073   return StatusCode::SUCCESS;
00074 }
00075 
00076 MockEvtSelector::~MockEvtSelector() {
00077 }
00078 
00079 StatusCode MockEvtSelector::previous(Context&) const {
00080   return StatusCode::FAILURE;
00081 }
00082 
00083 StatusCode MockEvtSelector::previous(Context&,
00084                                      int) const {
00085   return StatusCode::FAILURE;
00086 }
00087 
00088 StatusCode MockEvtSelector::last(Context&) const {
00089   return StatusCode::FAILURE;
00090 }
00091 
00092 StatusCode MockEvtSelector::rewind(Context&) const {
00093   return StatusCode::FAILURE;
00094 }
00095 
00096 StatusCode MockEvtSelector::resetCriteria(const std::string&,
00097                                           Context&) const {
00098   return StatusCode::FAILURE;
00099 }
00100 
00101 
00102 MockEvtSelector::MockEvtContext::MockEvtContext() :
00103   m_sequenceNumber(0),
00104   m_readoutTime(time(0),
00105                 0) {
00106 }
00107 
00108 MockEvtSelector::MockEvtContext::~MockEvtContext() {
00109 }
00110 
00111 void MockEvtSelector::MockEvtContext::jump(int distance) {
00112   m_sequenceNumber += distance;
00113   m_readoutTime.Add(distance * 0.0000001 * (random() % 1000));
00114 }
00115 
00116 StatusCode MockEvtSelector::MockEvtContext::getEvent() const {
00117   return StatusCode::SUCCESS;
00118 }
00119 
00120 const TimeStamp& MockEvtSelector::MockEvtContext::readoutTime() const {
00121   return m_readoutTime;
00122 }
00123 
00124 int MockEvtSelector::MockEvtContext::sequenceNumber() const {
00125   return m_sequenceNumber;
00126 }
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Fri May 16 2014 10:08:54 for MockEvt by doxygen 1.7.4