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

In This Package:

Public Member Functions | Static Public Member Functions | Private Attributes
ReadoutBufferSvc Class Reference

#include <ReadoutBufferSvc.h>

Inheritance diagram for ReadoutBufferSvc:
Inheritance graph
[legend]
Collaboration diagram for ReadoutBufferSvc:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 ReadoutBufferSvc (const std::string &name, ISvcLocator *svc)
virtual ~ReadoutBufferSvc ()
virtual StatusCode initialize ()
virtual StatusCode finalize ()
virtual StatusCode queryInterface (const InterfaceID &riid, void **ppvInterface)
virtual void clear ()
virtual bool hasMoreReadouts ()
virtual bool isEmpty ()
virtual TimeStamp earliest ()
virtual TimeStamp latest ()
virtual Context context ()
virtual DayaBay::SimReadoutnextReadout ()
virtual void setSimReadoutHeader (DayaBay::SimReadoutHeader *srh)

Static Public Member Functions

static const InterfaceID & interfaceID ()

Private Attributes

DayaBay::SimReadoutHeaderbufferedHeader
bool hasBufferedReadouts
DayaBay::SimReadoutHeader::SimReadoutContainer::const_iterator simRoIter
DayaBay::SimReadoutHeader::SimReadoutContainer::const_iterator lastRo
DayaBay::SimReadoutHeader::SimReadoutContainer simReadouts

Detailed Description

Definition at line 23 of file ReadoutBufferSvc.h.


Constructor & Destructor Documentation

ReadoutBufferSvc::ReadoutBufferSvc ( const std::string &  name,
ISvcLocator *  svc 
)

Definition at line 9 of file ReadoutBufferSvc.cc.

                      : Service(name,svc),
                        hasBufferedReadouts(false)
{  
    bufferedHeader=0;
    /* declare properties here*/
    /* none at this time      */
}
ReadoutBufferSvc::~ReadoutBufferSvc ( ) [virtual]

Definition at line 18 of file ReadoutBufferSvc.cc.

{    
}

Member Function Documentation

StatusCode ReadoutBufferSvc::initialize ( ) [virtual]

Definition at line 22 of file ReadoutBufferSvc.cc.

{
    this->Service::initialize();

    // Prepare the message service for reporting

    return StatusCode::SUCCESS;
}
StatusCode ReadoutBufferSvc::finalize ( ) [virtual]

Definition at line 31 of file ReadoutBufferSvc.cc.

{
    clear(); // release any remaining objects
    return this->Service::finalize();
}
StatusCode ReadoutBufferSvc::queryInterface ( const InterfaceID &  riid,
void **  ppvInterface 
) [virtual]

Definition at line 37 of file ReadoutBufferSvc.cc.

{
    StatusCode sc = StatusCode::SUCCESS;
    if (ppvInterface) {
        *ppvInterface = 0;

        if (IReadoutBufferSvc::interfaceID().versionMatch(riid)) {
            *ppvInterface = static_cast<IReadoutBufferSvc*>(this);
            sc = StatusCode::SUCCESS;
            addRef();
        }
        else sc = Service::queryInterface( riid, ppvInterface );    
    }
    return sc;
}
void ReadoutBufferSvc::clear ( ) [virtual]

Implements IReadoutBufferSvc.

Definition at line 82 of file ReadoutBufferSvc.cc.

{
    /* do cleanup */
    MsgStream log(msgSvc(), name());
    log << MSG::DEBUG << "in clear()" << endreq;
    log << MSG::DEBUG << "bufferedHeader: " << bufferedHeader << endreq;    
    hasBufferedReadouts=false;
    
    if( bufferedHeader ) bufferedHeader->release();
    
    bufferedHeader=0;
}
bool ReadoutBufferSvc::hasMoreReadouts ( ) [virtual]

Implements IReadoutBufferSvc.

Definition at line 95 of file ReadoutBufferSvc.cc.

                                      {
    return hasBufferedReadouts;
}
bool ReadoutBufferSvc::isEmpty ( ) [virtual]

Implements IReadoutBufferSvc.

Definition at line 99 of file ReadoutBufferSvc.cc.

                              {
    return !hasMoreReadouts();
}
TimeStamp ReadoutBufferSvc::earliest ( ) [virtual]

Implements IReadoutBufferSvc.

Definition at line 57 of file ReadoutBufferSvc.cc.

                                    {
    if (bufferedHeader) return bufferedHeader->earliest();
    MsgStream log(msgSvc(), name());
    log << MSG::WARNING << "earliest() call w/ no bufferedHeader" << endreq;
    TimeStamp *ts = new TimeStamp();
    return *ts;
}
TimeStamp ReadoutBufferSvc::latest ( ) [virtual]

Implements IReadoutBufferSvc.

Definition at line 65 of file ReadoutBufferSvc.cc.

                                  {
    if (bufferedHeader) return bufferedHeader->latest();
    MsgStream log(msgSvc(), name());
    log << MSG::WARNING << "earliest() call w/ no bufferedHeader" << endreq;
    TimeStamp *ts = new TimeStamp();
    return *ts;
}
Context ReadoutBufferSvc::context ( ) [virtual]

Implements IReadoutBufferSvc.

Definition at line 73 of file ReadoutBufferSvc.cc.

                                 {
    if (bufferedHeader) return bufferedHeader->context();
    MsgStream log(msgSvc(), name());    
    log << MSG::WARNING << "context() call w/ no bufferedHeader" << endreq;
    Context *con = new Context();
    return *con;
}
DayaBay::SimReadout * ReadoutBufferSvc::nextReadout ( ) [virtual]

Implements IReadoutBufferSvc.

Definition at line 104 of file ReadoutBufferSvc.cc.

{
    // return next readout
    MsgStream log(msgSvc(), name());
    if( isEmpty() ){
        log << MSG::WARNING << "Readout requested from an empty buffer"
            << endreq;
        return 0;
    }else
    {
        log << MSG::VERBOSE << "Returning simReadout: " 
            << *simRoIter << endreq;
    }
    
    DayaBay::SimReadout* sr = *simRoIter;
    if(++simRoIter == lastRo ) hasBufferedReadouts=false;
    return sr;
}
void ReadoutBufferSvc::setSimReadoutHeader ( DayaBay::SimReadoutHeader srh) [virtual]

Implements IReadoutBufferSvc.

Definition at line 124 of file ReadoutBufferSvc.cc.

{
    MsgStream log(msgSvc(), name());
    if( hasMoreReadouts() )
    {
        log<< MSG::ERROR << "Buffering a new header with data is still"
            << " in buffer" << endreq;
    }
    
    log << MSG::VERBOSE << "entering setSimReadoutHeader() " << endreq;
     // get rid of anything still laying around
    clear();
    bufferedHeader = srh;
    bufferedHeader->addRef();
    simReadouts = bufferedHeader->readouts();
    
    log << MSG::INFO << "New Buffered Header: " << bufferedHeader 
                     << " With " << simReadouts.size()
                     << " Readouts in it " << endreq;
                     
    log << MSG::VERBOSE << "Header: \n " << *bufferedHeader << endreq;
    log << MSG::VERBOSE << "new readout vector : " << simReadouts << endreq;
        
    if ( simReadouts.size() < 1 )
    {
      log << MSG::DEBUG << " zero length readout vector " << endreq;
      hasBufferedReadouts=false;
    }else
    {
      simRoIter = simReadouts.begin(); 
      lastRo = simReadouts.end();
      hasBufferedReadouts=true;
    }
    log << MSG::DEBUG << "leaving setSimReadoutHeader() " << endreq;
}
static const InterfaceID& IReadoutBufferSvc::interfaceID ( ) [inline, static, inherited]

Definition at line 33 of file IReadoutBufferSvc.h.


Member Data Documentation

Definition at line 49 of file ReadoutBufferSvc.h.

Definition at line 50 of file ReadoutBufferSvc.h.

DayaBay::SimReadoutHeader::SimReadoutContainer::const_iterator ReadoutBufferSvc::simRoIter [private]

Definition at line 52 of file ReadoutBufferSvc.h.

DayaBay::SimReadoutHeader::SimReadoutContainer::const_iterator ReadoutBufferSvc::lastRo [private]

Definition at line 53 of file ReadoutBufferSvc.h.

Definition at line 54 of file ReadoutBufferSvc.h.


The documentation for this class was generated from the following files:
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Fri May 16 2014 10:04:57 for ReadoutBufferSvc by doxygen 1.7.4