00001 //-------------------------------------------------------------------------- 00002 // File and Version Information: 00003 // $Id: DgramSourceIndex.cpp 7696 2014-02-27 00:40:59Z cpo@SLAC.STANFORD.EDU $ 00004 // 00005 // Description: 00006 // Class DgramSourceIndex... 00007 // 00008 // Author List: 00009 // Christopher O'Grady 00010 // 00011 //------------------------------------------------------------------------ 00012 00013 //----------------------- 00014 // This Class's Header -- 00015 //----------------------- 00016 #include "PSXtcInput/DgramSourceIndex.h" 00017 00018 //----------------- 00019 // C/C++ Headers -- 00020 //----------------- 00021 #include <queue> 00022 00023 //------------------------------- 00024 // Collaborating Class Headers -- 00025 //------------------------------- 00026 00027 //----------------------------------------------------------------------- 00028 // Local Macros, Typedefs, Structures, Unions and Forward Declarations -- 00029 //----------------------------------------------------------------------- 00030 00031 // ---------------------------------------- 00032 // -- Public Function Member Definitions -- 00033 // ---------------------------------------- 00034 00035 namespace PSXtcInput { 00036 00037 //---------------- 00038 // Constructors -- 00039 //---------------- 00040 DgramSourceIndex::DgramSourceIndex () 00041 : IDatagramSource() 00042 { 00043 } 00044 00045 //-------------- 00046 // Destructor -- 00047 //-------------- 00048 DgramSourceIndex::~DgramSourceIndex () 00049 {} 00050 00051 // Initialization method for datagram source 00052 void 00053 DgramSourceIndex::init() { 00054 } 00055 00056 // This method returns next datagram from the source 00057 bool 00058 DgramSourceIndex::next(std::vector<XtcInput::Dgram>& eventDg, std::vector<XtcInput::Dgram>& nonEventDg) 00059 { 00060 if (not _queue->empty()) { 00061 DgramPieces pieces = _queue->front(); 00062 eventDg = pieces.eventDg; 00063 nonEventDg = pieces.nonEventDg; 00064 _queue->pop(); 00065 return true; 00066 } else { 00067 return false; 00068 } 00069 } 00070 00071 } // namespace PSXtcInput