BOSS 7.0.3
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
 
 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 Calibration/facilities/facilities-00-00-04/facilities/FIFO.h.

Constructor & Destructor Documentation

◆ FIFO() [1/4]

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

Definition at line 23 of file Calibration/facilities/facilities-00-00-04/facilities/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/4]

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

Definition at line 33 of file Calibration/facilities/facilities-00-00-04/facilities/FIFO.h.

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

◆ FIFO() [3/4]

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

Definition at line 23 of file InstallArea/include/facilities/facilities/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() [4/4]

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

Definition at line 33 of file InstallArea/include/facilities/facilities/FIFO.h.

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

Member Function Documentation

◆ avail() [1/2]

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

Definition at line 103 of file Calibration/facilities/facilities-00-00-04/facilities/FIFO.h.

103{ return size() < m_depth; }

◆ avail() [2/2]

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

Definition at line 103 of file InstallArea/include/facilities/facilities/FIFO.h.

103{ return size() < m_depth; }

◆ back() [1/4]

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

Definition at line 65 of file Calibration/facilities/facilities-00-00-04/facilities/FIFO.h.

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

◆ back() [2/4]

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

Definition at line 65 of file InstallArea/include/facilities/facilities/FIFO.h.

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

◆ back() [3/4]

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

Definition at line 68 of file Calibration/facilities/facilities-00-00-04/facilities/FIFO.h.

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

◆ back() [4/4]

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

Definition at line 68 of file InstallArea/include/facilities/facilities/FIFO.h.

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

◆ clear() [1/2]

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

Definition at line 84 of file Calibration/facilities/facilities-00-00-04/facilities/FIFO.h.

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

◆ clear() [2/2]

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

Definition at line 84 of file InstallArea/include/facilities/facilities/FIFO.h.

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

◆ empty() [1/2]

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

Definition at line 70 of file Calibration/facilities/facilities-00-00-04/facilities/FIFO.h.

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

◆ empty() [2/2]

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

Definition at line 70 of file InstallArea/include/facilities/facilities/FIFO.h.

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

◆ front() [1/4]

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

Definition at line 64 of file Calibration/facilities/facilities-00-00-04/facilities/FIFO.h.

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

◆ front() [2/4]

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

Definition at line 64 of file InstallArea/include/facilities/facilities/FIFO.h.

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

◆ front() [3/4]

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

Definition at line 67 of file Calibration/facilities/facilities-00-00-04/facilities/FIFO.h.

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

◆ front() [4/4]

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

Definition at line 67 of file InstallArea/include/facilities/facilities/FIFO.h.

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

◆ full() [1/2]

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

Definition at line 101 of file Calibration/facilities/facilities-00-00-04/facilities/FIFO.h.

101{ return size() == m_depth; }

◆ full() [2/2]

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

Definition at line 101 of file InstallArea/include/facilities/facilities/FIFO.h.

101{ return size() == m_depth; }

◆ maxSize() [1/2]

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

Definition at line 73 of file Calibration/facilities/facilities-00-00-04/facilities/FIFO.h.

74 {
75 return m_depth;
76 }

◆ maxSize() [2/2]

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

Definition at line 73 of file InstallArea/include/facilities/facilities/FIFO.h.

74 {
75 return m_depth;
76 }

◆ pop() [1/2]

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

Definition at line 53 of file Calibration/facilities/facilities-00-00-04/facilities/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)

◆ pop() [2/2]

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

Definition at line 53 of file InstallArea/include/facilities/facilities/FIFO.h.

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

◆ printOn() [1/2]

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

Definition at line 90 of file Calibration/facilities/facilities-00-00-04/facilities/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 }

◆ printOn() [2/2]

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

Definition at line 90 of file InstallArea/include/facilities/facilities/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 }

◆ push() [1/2]

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

Definition at line 41 of file Calibration/facilities/facilities-00-00-04/facilities/FIFO.h.

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

◆ push() [2/2]

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

Definition at line 41 of file InstallArea/include/facilities/facilities/FIFO.h.

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

◆ size() [1/2]

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

◆ size() [2/2]

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

Definition at line 79 of file InstallArea/include/facilities/facilities/FIFO.h.

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

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