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

In This Package:

Public Types | Public Member Functions | Protected Attributes | Private Attributes
UserBuffer Class Reference

#include <UserBuffer.h>

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

List of all members.

Public Types

typedef std::deque< Data * >
::iterator 
Iterator

Public Member Functions

 UserBuffer (EvtSelector *selector)
virtual ~UserBuffer ()
const std::string & name ()
bool tryPushBack (PhyEvent *evt)
void synchronize (PhyEventBuf *buf)
Iterator begin ()
Iterator current ()
Iterator end ()
Iterator find (const Data *data)
Iterator seek (int pos)
Data * curEvt ()
Data * seekEvt (int pos)
int totalSize ()
int forwardSize ()
int backwardSize ()
void clear ()
template<>
void clear ()
template<>
void clear ()

Protected Attributes

unsigned int m_iCur
std::deque< Data * > m_dBuf

Private Attributes

EvtSelectorm_selector

Detailed Description

Definition at line 7 of file UserBuffer.h.


Member Typedef Documentation

template<typename Data >
typedef std::deque<Data*>::iterator DataBuffer< Data >::Iterator [inherited]

Definition at line 12 of file DataBuffer.h.


Constructor & Destructor Documentation

UserBuffer::UserBuffer ( EvtSelector selector)

Definition at line 3 of file UserBuffer.cc.

    : m_selector(selector)
{
}
UserBuffer::~UserBuffer ( ) [virtual]

Definition at line 8 of file UserBuffer.cc.

{
    delete m_selector;
}

Member Function Documentation

const std::string& UserBuffer::name ( void  ) [inline]

Definition at line 14 of file UserBuffer.h.

{ return m_selector->name(); }
bool UserBuffer::tryPushBack ( PhyEvent evt)

Definition at line 13 of file UserBuffer.cc.

{
    if ( m_selector->select(evt) ) {
        m_dBuf.push_back(evt->GrabInstance());
        return true;
    }
    return false;
}
void UserBuffer::synchronize ( PhyEventBuf buf)

Definition at line 22 of file UserBuffer.cc.

{
    PhyEventBuf::Iterator it = buf->begin();
    while ( !m_dBuf.empty() && m_dBuf[0]->m_trigTime < (*it)->m_trigTime ) {
        m_dBuf[0]->ReleaseInstance();
        m_dBuf[0] = 0;
        m_dBuf.pop_front();
    }
    unsigned int size = m_dBuf.size();
    m_iCur = size;
    if ( size > 0 ) {
        int curEntry = buf->curEvt()->m_entry;
        const TTimeStamp& curTime = buf->curEvt()->m_trigTime;
        while ( --m_iCur != 0 && m_dBuf[m_iCur]->m_entry != curEntry ) {
            if ( m_dBuf[m_iCur]->m_trigTime < curTime ) break;
        }
        if ( m_dBuf[m_iCur]->m_entry != curEntry ) {
            m_iCur = size;
        }
    }
}
template<typename Data >
DataBuffer< Data >::Iterator DataBuffer< Data >::begin ( ) [inline, inherited]

Definition at line 60 of file DataBuffer.h.

{
    return m_dBuf.begin();
}
template<typename Data >
DataBuffer< Data >::Iterator DataBuffer< Data >::current ( ) [inline, inherited]

Definition at line 66 of file DataBuffer.h.

{
    return (m_dBuf.begin()+m_iCur);
}
template<typename Data >
DataBuffer< Data >::Iterator DataBuffer< Data >::end ( ) [inline, inherited]

Definition at line 72 of file DataBuffer.h.

{
    return m_dBuf.end();
}
template<typename Data >
DataBuffer< Data >::Iterator DataBuffer< Data >::find ( const Data *  data) [inline, inherited]

Definition at line 78 of file DataBuffer.h.

{
    return std::find(m_dBuf.begin(), m_dBuf.end(), data);
}
template<typename Data >
DataBuffer< Data >::Iterator DataBuffer< Data >::seek ( int  pos) [inline, inherited]

Definition at line 84 of file DataBuffer.h.

{
    return (m_dBuf.begin()+(int(m_iCur)+pos));
}
template<typename Data >
Data * DataBuffer< Data >::curEvt ( ) [inline, inherited]

Definition at line 90 of file DataBuffer.h.

{
    if ( !m_dBuf.empty() ) {
        return m_dBuf[m_iCur];
    }
    return (Data*)0;
}
template<typename Data >
Data * DataBuffer< Data >::seekEvt ( int  pos) [inline, inherited]

Definition at line 99 of file DataBuffer.h.

{
    return m_dBuf.at(m_iCur+pos);
}
template<typename Data >
int DataBuffer< Data >::totalSize ( ) [inline, inherited]

Definition at line 105 of file DataBuffer.h.

{
    return m_dBuf.size();
}
template<typename Data >
int DataBuffer< Data >::forwardSize ( ) [inline, inherited]

Definition at line 111 of file DataBuffer.h.

{
    return (m_dBuf.size()-m_iCur-1);
}
template<typename Data >
int DataBuffer< Data >::backwardSize ( ) [inline, inherited]

Definition at line 117 of file DataBuffer.h.

{
    return m_iCur;
}
template<typename Data >
void DataBuffer< Data >::clear ( void  ) [inherited]

Definition at line 123 of file DataBuffer.h.

{
    for(typename std::deque<Data*>::iterator it=m_dBuf.begin(); it!=m_dBuf.end(); ++it) {
        delete (*it);
    }
    m_dBuf.clear();
}
template<>
void DataBuffer< PhyEvent >::clear ( void  ) [inherited]

Definition at line 8 of file PhyEventBuffer.cc.

{
    for(std::deque<PhyEvent*>::iterator it=m_dBuf.begin(); it!=m_dBuf.end(); ++it) {
        (*it)->ReleaseInstance();
    }
    m_dBuf.clear();
}
template<>
void DataBuffer< PhyEvent >::clear ( ) [inherited]

Member Data Documentation

Definition at line 21 of file UserBuffer.h.

template<typename Data >
unsigned int DataBuffer< Data >::m_iCur [protected, inherited]

Definition at line 37 of file DataBuffer.h.

template<typename Data >
std::deque<Data*> DataBuffer< Data >::m_dBuf [protected, inherited]

Definition at line 38 of file DataBuffer.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 09:50:18 for LafKernel by doxygen 1.7.4