CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
cmsutils::bqueue< T > Class Template Reference

#include <bqueue.h>

Public Types

typedef const _bqueue_itr
< value_type
const_iterator
 
typedef _bqueue_item< value_typeitem
 
typedef boost::intrusive_ptr
< _bqueue_item< value_type > > 
itemptr
 
typedef _bqueue_itr< value_typeiterator
 
typedef unsigned short int size_type
 
typedef T value_type
 

Public Member Functions

Tback ()
 
const Tback () const
 
 bqueue ()
 
 bqueue (const bqueue< T > &cp)
 
void clear ()
 
bool empty () const
 
bqueue< Tfork ()
 
Tfront ()
 
const Tfront () const
 
void join (bqueue< T > &other)
 
const Toperator[] (size_type i) const
 
void pop_back ()
 
void push_back (const T &val)
 
iterator rbegin ()
 
const_iterator rbegin () const
 
const_iterator rend () const
 
bool shared ()
 
size_type size () const
 
void swap (bqueue< T > &cp)
 
 ~bqueue ()
 

Private Member Functions

 bqueue (size_type size, itemptr bound, itemptr head, itemptr tail)
 

Private Attributes

itemptr m_bound
 
itemptr m_head
 
size_type m_size
 
itemptr m_tail
 

Detailed Description

template<class T>
class cmsutils::bqueue< T >

Definition at line 31 of file bqueue.h.

Member Typedef Documentation

template<class T>
typedef const _bqueue_itr<value_type> cmsutils::bqueue< T >::const_iterator

Definition at line 89 of file bqueue.h.

template<class T>
typedef _bqueue_item<value_type> cmsutils::bqueue< T >::item

Definition at line 86 of file bqueue.h.

template<class T>
typedef boost::intrusive_ptr< _bqueue_item<value_type> > cmsutils::bqueue< T >::itemptr

Definition at line 87 of file bqueue.h.

template<class T>
typedef _bqueue_itr<value_type> cmsutils::bqueue< T >::iterator

Definition at line 88 of file bqueue.h.

template<class T>
typedef unsigned short int cmsutils::bqueue< T >::size_type

Definition at line 85 of file bqueue.h.

template<class T>
typedef T cmsutils::bqueue< T >::value_type

Definition at line 84 of file bqueue.h.

Constructor & Destructor Documentation

template<class T>
cmsutils::bqueue< T >::bqueue ( )
inline

Definition at line 91 of file bqueue.h.

91 : m_size(0), m_bound(), m_head(m_bound), m_tail(m_bound) { }
itemptr m_bound
Definition: bqueue.h:185
itemptr m_head
Definition: bqueue.h:185
itemptr m_tail
Definition: bqueue.h:185
size_type m_size
Definition: bqueue.h:184
template<class T>
cmsutils::bqueue< T >::~bqueue ( )
inline

Definition at line 92 of file bqueue.h.

92 { }
template<class T>
cmsutils::bqueue< T >::bqueue ( const bqueue< T > &  cp)
inline

Definition at line 93 of file bqueue.h.

93 : m_size(cp.m_size), m_bound(cp.m_bound), m_head(cp.m_head), m_tail(cp.m_tail) { }
itemptr m_bound
Definition: bqueue.h:185
itemptr m_head
Definition: bqueue.h:185
itemptr m_tail
Definition: bqueue.h:185
size_type m_size
Definition: bqueue.h:184
template<class T>
cmsutils::bqueue< T >::bqueue ( size_type  size,
itemptr  bound,
itemptr  head,
itemptr  tail 
)
inlineprivate

Definition at line 181 of file bqueue.h.

181  :
182  m_size(size), m_bound(bound), m_head(head), m_tail(tail) { }
itemptr m_bound
Definition: bqueue.h:185
itemptr m_head
Definition: bqueue.h:185
itemptr m_tail
Definition: bqueue.h:185
size_type m_size
Definition: bqueue.h:184
size_type size() const
Definition: bqueue.h:146

Member Function Documentation

template<class T>
T& cmsutils::bqueue< T >::back ( )
inline
template<class T>
const T& cmsutils::bqueue< T >::back ( ) const
inline

Definition at line 142 of file bqueue.h.

142 { return m_tail->value; }
itemptr m_tail
Definition: bqueue.h:185
template<class T>
void cmsutils::bqueue< T >::clear ( void  )
inline

Definition at line 175 of file bqueue.h.

Referenced by TempTrajectory::join().

175  {
176  m_head = m_bound;
177  m_tail = m_bound;
178  m_size = 0;
179  }
itemptr m_bound
Definition: bqueue.h:185
itemptr m_head
Definition: bqueue.h:185
itemptr m_tail
Definition: bqueue.h:185
size_type m_size
Definition: bqueue.h:184
template<class T>
bool cmsutils::bqueue< T >::empty ( void  ) const
inline

Definition at line 147 of file bqueue.h.

Referenced by TrajectorySegmentBuilder::addGroup(), TempTrajectory::empty(), and GroupedCkfTrajectoryBuilder::layers().

147 { return m_size == 0; }
size_type m_size
Definition: bqueue.h:184
template<class T>
bqueue<T> cmsutils::bqueue< T >::fork ( )
inline

Definition at line 118 of file bqueue.h.

118  {
119  return bqueue<T>(m_size,m_bound,m_head,m_tail);
120  }
itemptr m_bound
Definition: bqueue.h:185
itemptr m_head
Definition: bqueue.h:185
itemptr m_tail
Definition: bqueue.h:185
size_type m_size
Definition: bqueue.h:184
template<class T>
T& cmsutils::bqueue< T >::front ( )
inline
template<class T>
const T& cmsutils::bqueue< T >::front ( ) const
inline

Definition at line 140 of file bqueue.h.

140 { return m_head->value; }
itemptr m_head
Definition: bqueue.h:185
template<class T>
void cmsutils::bqueue< T >::join ( bqueue< T > &  other)
inline

Definition at line 161 of file bqueue.h.

Referenced by TempTrajectory::join().

161  {
162  using std::swap;
163  if (m_size == 0) {
164  swap(m_head,other.m_head);
165  swap(m_tail,other.m_tail);
166  swap(m_size,other.m_size);
167  } else {
168  other.m_head->back = this->m_tail;
169  m_tail = other.m_tail;
170  m_size += other.m_size;
171  other.m_head = other.m_tail = other.m_bound;
172  other.m_size = 0;
173  }
174  }
void swap(bqueue< T > &cp)
Definition: bqueue.h:110
itemptr m_head
Definition: bqueue.h:185
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
itemptr m_tail
Definition: bqueue.h:185
size_type m_size
Definition: bqueue.h:184
template<class T>
const T& cmsutils::bqueue< T >::operator[] ( size_type  i) const
inline

Definition at line 148 of file bqueue.h.

148  {
149  int idx = m_size - i - 1;
150  const_iterator it = rbegin();
151  while (idx-- > 0) --it;
152  return *it;
153  }
int i
Definition: DBlmapReader.cc:9
const _bqueue_itr< value_type > const_iterator
Definition: bqueue.h:89
iterator rbegin()
Definition: bqueue.h:143
size_type m_size
Definition: bqueue.h:184
template<class T>
void cmsutils::bqueue< T >::pop_back ( )
inline

Definition at line 133 of file bqueue.h.

Referenced by TempTrajectory::pop().

133  {
134  assert(m_size > 0);
135  --m_size;
136  m_tail = m_tail->back;
137  if (m_size == 0) m_head = m_bound;
138  }
itemptr m_bound
Definition: bqueue.h:185
itemptr m_head
Definition: bqueue.h:185
itemptr m_tail
Definition: bqueue.h:185
size_type m_size
Definition: bqueue.h:184
template<class T>
void cmsutils::bqueue< T >::push_back ( const T val)
inline

Definition at line 122 of file bqueue.h.

Referenced by TempTrajectory::push().

122  {
123  m_tail = itemptr(new item(this->m_tail, val));
124  if ((++m_size) == 1) { m_head = m_tail; };
125  }
itemptr m_head
Definition: bqueue.h:185
_bqueue_item< value_type > item
Definition: bqueue.h:86
itemptr m_tail
Definition: bqueue.h:185
boost::intrusive_ptr< _bqueue_item< value_type > > itemptr
Definition: bqueue.h:87
size_type m_size
Definition: bqueue.h:184
template<class T>
iterator cmsutils::bqueue< T >::rbegin ( )
inline
template<class T>
const_iterator cmsutils::bqueue< T >::rbegin ( ) const
inline

Definition at line 144 of file bqueue.h.

144 { return m_tail.get(); }
itemptr m_tail
Definition: bqueue.h:185
template<class T>
const_iterator cmsutils::bqueue< T >::rend ( ) const
inline
template<class T>
bool cmsutils::bqueue< T >::shared ( )
inline

Definition at line 154 of file bqueue.h.

Referenced by TempTrajectory::join().

154  {
155  // size = 0: never shared
156  // size = 1: shared if head->refCount > 2 (m_head and m_tail)
157  // size > 1: shared if head->refCount > 2 (m_head and second_hit->back)
158  return (m_size > 0) && (m_head->refCount > 2);
159  }
itemptr m_head
Definition: bqueue.h:185
size_type m_size
Definition: bqueue.h:184
template<class T>
size_type cmsutils::bqueue< T >::size ( void  ) const
inline
template<class T>
void cmsutils::bqueue< T >::swap ( bqueue< T > &  cp)
inline

Definition at line 110 of file bqueue.h.

Referenced by cmsutils::bqueue< TrajectoryMeasurement >::join(), cmsutils::bqueue< TrajectoryMeasurement >::swap(), and cmsutils::swap().

110  {
111  using std::swap;
112  swap(m_size,cp.m_size);
113  swap(m_bound,cp.m_bound);
114  swap(m_head,cp.m_head);
115  swap(m_tail,cp.m_tail);
116  }
itemptr m_bound
Definition: bqueue.h:185
void swap(bqueue< T > &cp)
Definition: bqueue.h:110
itemptr m_head
Definition: bqueue.h:185
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
itemptr m_tail
Definition: bqueue.h:185
size_type m_size
Definition: bqueue.h:184

Member Data Documentation

template<class T>
itemptr cmsutils::bqueue< T >::m_bound
private
template<class T>
itemptr cmsutils::bqueue< T >::m_head
private
template<class T>
size_type cmsutils::bqueue< T >::m_size
private
template<class T>
itemptr cmsutils::bqueue< T >::m_tail
private