BOSS 7.1.1
BESIII Offline Software System
Loading...
Searching...
No Matches
FIFO< _T > Class Template Reference

#include <FIFO.h>

+ Inheritance diagram for FIFO< _T >:

Public Member Functions

 FIFO (unsigned int depth=0)
 
 FIFO (const FIFO &f)
 
bool push (const _T &x)
 
_T pop ()
 
_Tfront ()
 
_Tback ()
 
const _Tfront () const
 
const _Tback () const
 
bool empty () const
 
unsigned int maxSize () const
 
unsigned int size () const
 
void clear ()
 
void printOn (std::ostream &out=cout)
 
bool full () const
 
bool avail () const
 

Detailed Description

template<class _T>
class FIFO< _T >

Definition at line 20 of file FIFO.h.

Constructor & Destructor Documentation

◆ FIFO() [1/2]

template<class _T >
FIFO< _T >::FIFO ( unsigned int depth = 0)
inline

Definition at line 23 of file FIFO.h.

24 : vector<_T>(), m_depth(depth)
25 {
26 if (depth > 0) reserve ( depth );
27
28 // if the depth of the fifo is fixed, then reserve enough space to contain it entirely
29 // FIFO operates in two modes: one for a fixed depth,
30 // and another for a non-fixed depth (unlimited)
31 }

◆ FIFO() [2/2]

template<class _T >
FIFO< _T >::FIFO ( const FIFO< _T > & f)
inline

Definition at line 33 of file FIFO.h.

34 : vector<_T>(f), m_depth(f.m_depth)
35 {
36 }
TFile f("ana_bhabha660a_dqa_mcPat_zy_old.root")

Member Function Documentation

◆ avail()

template<class _T >
bool FIFO< _T >::avail ( ) const
inline

Definition at line 103 of file FIFO.h.

103{ return size() < m_depth; }
unsigned int size() const
Definition FIFO.h:79

◆ back() [1/2]

template<class _T >
_T & FIFO< _T >::back ( )
inline

Definition at line 65 of file FIFO.h.

65{ return vector<_T>::back(); }

◆ back() [2/2]

template<class _T >
const _T & FIFO< _T >::back ( ) const
inline

Definition at line 68 of file FIFO.h.

68{ return vector<_T>::back(); }

◆ clear()

template<class _T >
void FIFO< _T >::clear ( )
inline

Definition at line 84 of file FIFO.h.

85 {
86 vector<_T>::clear();
87 }

◆ empty()

template<class _T >
bool FIFO< _T >::empty ( ) const
inline

Definition at line 70 of file FIFO.h.

70{ return (size() == 0); }

◆ front() [1/2]

template<class _T >
_T & FIFO< _T >::front ( )
inline

Definition at line 64 of file FIFO.h.

64{ return vector<_T>::front(); }

◆ front() [2/2]

template<class _T >
const _T & FIFO< _T >::front ( ) const
inline

Definition at line 67 of file FIFO.h.

67{ return vector<_T>::front(); }

◆ full()

template<class _T >
bool FIFO< _T >::full ( ) const
inline

Definition at line 101 of file FIFO.h.

101{ return size() == m_depth; }

◆ maxSize()

template<class _T >
unsigned int FIFO< _T >::maxSize ( ) const
inline

Definition at line 73 of file FIFO.h.

74 {
75 return m_depth;
76 }

◆ pop()

template<class _T >
_T FIFO< _T >::pop ( )
inline

Definition at line 53 of file FIFO.h.

54 {
55 assert(size()>0);
56 _T value (*begin());
57 erase(begin());
58
59 // limited depth mode
60
61 return value;
62 }
#define _T(str)

◆ printOn()

template<class _T >
void FIFO< _T >::printOn ( std::ostream & out = cout)
inline

Definition at line 90 of file FIFO.h.

91 {
92 short i = 1;
93 for (vector<_T>::reverse_iterator it = rbegin(); it != rend(); ++it) {
94 out << (*it)();
95 if ((i % 8) == 0) out << "\n";
96 else out << "\t";
97 i++;
98 }
99 }
const double rend
Definition TofCalibFit.h:17
const double rbegin
Definition TofCalibFit.h:16

◆ push()

template<class _T >
bool FIFO< _T >::push ( const _T & x)
inline

Definition at line 41 of file FIFO.h.

42 {
43 if ((m_depth != 0) && (size() >= m_depth)) return false;
44
45 push_back( x );
46
47 return true;
48 }

◆ size()

template<class _T >
unsigned int FIFO< _T >::size ( ) const
inline

Definition at line 79 of file FIFO.h.

80 {
81 return vector<_T>::size();
82 }

Referenced by FIFO< _T >::avail(), FIFO< _T >::empty(), FIFO< _T >::full(), FIFO< _T >::pop(), and FIFO< _T >::push().


The documentation for this class was generated from the following file: