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 Attributes
cmsutils::bqueue< T > Class Template Reference

#include <bqueue.h>

Public Types

typedef _bqueue_itr< value_typeconst_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

const Tback () const
 
const_iterator begin () const
 
 bqueue ()
 
 bqueue (const bqueue< T > &cp)
 
 bqueue (bqueue< T > &&cp) noexcept
 
void clear ()
 
template<typename... Args>
void emplace_back (Args &&...args)
 
bool empty () const
 
const_iterator end () const
 
bqueue< Tfork () const
 
const Tfront () const
 
void join (bqueue< T > &other)
 
bqueueoperator= (bqueue< T > &&cp) noexcept
 
const Toperator[] (size_type i) const
 
void pop_back ()
 
void push_back (const T &val)
 
void push_back (T &&val)
 
const_iterator rbegin () const
 
const_iterator rend () const
 
bool shared ()
 
size_type size () const
 
void swap (bqueue< T > &cp)
 
 ~bqueue ()
 

Private Attributes

itemptr m_head
 
size_type m_size
 
itemptr m_tail
 

Detailed Description

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

Definition at line 40 of file bqueue.h.

Member Typedef Documentation

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

Definition at line 102 of file bqueue.h.

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

Definition at line 99 of file bqueue.h.

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

Definition at line 100 of file bqueue.h.

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

Definition at line 101 of file bqueue.h.

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

Definition at line 98 of file bqueue.h.

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

Definition at line 97 of file bqueue.h.

Constructor & Destructor Documentation

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

Definition at line 104 of file bqueue.h.

104 : m_size(0), m_head(), m_tail() { }
itemptr m_head
Definition: bqueue.h:210
itemptr m_tail
Definition: bqueue.h:210
size_type m_size
Definition: bqueue.h:209
template<class T>
cmsutils::bqueue< T >::~bqueue ( )
inline

Definition at line 105 of file bqueue.h.

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

Definition at line 107 of file bqueue.h.

107 : m_size(cp.m_size), m_head(cp.m_head), m_tail(cp.m_tail) { }
itemptr m_head
Definition: bqueue.h:210
itemptr m_tail
Definition: bqueue.h:210
size_type m_size
Definition: bqueue.h:209
template<class T>
cmsutils::bqueue< T >::bqueue ( bqueue< T > &&  cp)
inlinenoexcept

Definition at line 110 of file bqueue.h.

110  :
111  m_size(cp.m_size),
112  m_head(std::move(cp.m_head)), m_tail(std::move(cp.m_tail)) {cp.m_size=0; }
itemptr m_head
Definition: bqueue.h:210
itemptr m_tail
Definition: bqueue.h:210
size_type m_size
Definition: bqueue.h:209

Member Function Documentation

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

Definition at line 166 of file bqueue.h.

Referenced by TempTrajectory::TempTrajectory().

166 { return m_tail.get(); }
itemptr m_tail
Definition: bqueue.h:210
template<class T>
void cmsutils::bqueue< T >::clear ( void  )
inline

Definition at line 202 of file bqueue.h.

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

202  {
203  m_head = m_tail = nullptr;
204  m_size = 0;
205  }
itemptr m_head
Definition: bqueue.h:210
itemptr m_tail
Definition: bqueue.h:210
size_type m_size
Definition: bqueue.h:209
template<class T>
template<typename... Args>
void cmsutils::bqueue< T >::emplace_back ( Args &&...  args)
inline

Definition at line 147 of file bqueue.h.

Referenced by TempTrajectory::emplace().

147  {
148  m_tail = itemptr(new item(this->m_tail, std::forward<Args>(args)...));
149  if ((++m_size) == 1) { m_head = m_tail; };
150  }
itemptr m_head
Definition: bqueue.h:210
_bqueue_item< value_type > item
Definition: bqueue.h:99
itemptr m_tail
Definition: bqueue.h:210
boost::intrusive_ptr< _bqueue_item< value_type > > itemptr
Definition: bqueue.h:100
size_type m_size
Definition: bqueue.h:209
template<class T>
bool cmsutils::bqueue< T >::empty ( void  ) const
inline

Definition at line 169 of file bqueue.h.

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

169 { return m_size == 0; }
size_type m_size
Definition: bqueue.h:209
template<class T>
const_iterator cmsutils::bqueue< T >::end ( void  ) const
inline

Definition at line 167 of file bqueue.h.

Referenced by TempTrajectory::TempTrajectory().

167 { return nullptr; }
template<class T>
bqueue<T> cmsutils::bqueue< T >::fork ( ) const
inline

Definition at line 129 of file bqueue.h.

129  {
130  return *this;
131  }
template<class T>
const T& cmsutils::bqueue< T >::front ( ) const
inline

Definition at line 160 of file bqueue.h.

Referenced by GroupedCkfTrajectoryBuilder::advanceOneLayer(), TempTrajectory::firstMeasurement(), and TempTrajectory::pushAux().

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

Definition at line 187 of file bqueue.h.

Referenced by TempTrajectory::join().

187  {
188  assert(!other.shared());
189  using std::swap;
190  if (m_size == 0) {
191  swap(m_head,other.m_head);
192  swap(m_tail,other.m_tail);
193  swap(m_size,other.m_size);
194  } else {
195  other.m_head->back = this->m_tail;
196  m_tail = other.m_tail;
197  m_size += other.m_size;
198  other.clear();
199  }
200  }
void swap(bqueue< T > &cp)
Definition: bqueue.h:122
itemptr m_head
Definition: bqueue.h:210
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
itemptr m_tail
Definition: bqueue.h:210
size_type m_size
Definition: bqueue.h:209
template<class T>
bqueue& cmsutils::bqueue< T >::operator= ( bqueue< T > &&  cp)
inlinenoexcept

Definition at line 114 of file bqueue.h.

114  {
115  using std::swap;
116  swap(m_size,cp.m_size);
117  swap(m_head,cp.m_head);
118  swap(m_tail,cp.m_tail);
119  return *this;
120  }
void swap(bqueue< T > &cp)
Definition: bqueue.h:122
itemptr m_head
Definition: bqueue.h:210
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
itemptr m_tail
Definition: bqueue.h:210
size_type m_size
Definition: bqueue.h:209
template<class T>
const T& cmsutils::bqueue< T >::operator[] ( size_type  i) const
inline

Definition at line 170 of file bqueue.h.

170  {
171  int idx = m_size - i - 1;
172  const_iterator it = rbegin();
173  while (idx-- > 0) --it;
174  return *it;
175  }
int i
Definition: DBlmapReader.cc:9
_bqueue_itr< value_type > const_iterator
Definition: bqueue.h:102
const_iterator rbegin() const
Definition: bqueue.h:164
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
size_type m_size
Definition: bqueue.h:209
template<class T>
void cmsutils::bqueue< T >::pop_back ( )
inline

Definition at line 152 of file bqueue.h.

Referenced by TempTrajectory::pop().

152  {
153  assert(m_size > 0);
154  --m_size;
155  m_tail = m_tail->back;
156  if (m_size == 0) m_head = nullptr;
157  }
itemptr m_head
Definition: bqueue.h:210
itemptr m_tail
Definition: bqueue.h:210
size_type m_size
Definition: bqueue.h:209
template<class T>
void cmsutils::bqueue< T >::push_back ( const T val)
inline

Definition at line 134 of file bqueue.h.

Referenced by TempTrajectory::push().

134  {
135  m_tail = itemptr(new item(this->m_tail, val));
136  if ((++m_size) == 1) { m_head = m_tail; };
137  }
itemptr m_head
Definition: bqueue.h:210
_bqueue_item< value_type > item
Definition: bqueue.h:99
itemptr m_tail
Definition: bqueue.h:210
boost::intrusive_ptr< _bqueue_item< value_type > > itemptr
Definition: bqueue.h:100
size_type m_size
Definition: bqueue.h:209
template<class T>
void cmsutils::bqueue< T >::push_back ( T &&  val)
inline

Definition at line 140 of file bqueue.h.

140  {
141  m_tail = itemptr(new item(this->m_tail, std::forward<T>(val)));
142  if ((++m_size) == 1) { m_head = m_tail; };
143  }
itemptr m_head
Definition: bqueue.h:210
_bqueue_item< value_type > item
Definition: bqueue.h:99
itemptr m_tail
Definition: bqueue.h:210
boost::intrusive_ptr< _bqueue_item< value_type > > itemptr
Definition: bqueue.h:100
size_type m_size
Definition: bqueue.h:209
template<class T>
const_iterator cmsutils::bqueue< T >::rbegin ( ) const
inline
template<class T>
const_iterator cmsutils::bqueue< T >::rend ( ) const
inline
template<class T>
bool cmsutils::bqueue< T >::shared ( )
inline

Definition at line 177 of file bqueue.h.

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

177  {
178  // size = 0: never shared
179  // size = 1: shared if head->refCount > 2 (m_head and m_tail)
180  // size > 1: shared if head->refCount > 2 (m_head and second_hit->back)
181  return (m_size > 0) && (m_head->refCount > 2);
182  }
itemptr m_head
Definition: bqueue.h:210
size_type m_size
Definition: bqueue.h:209
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 122 of file bqueue.h.

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

122  {
123  using std::swap;
124  swap(m_size,cp.m_size);
125  swap(m_head,cp.m_head);
126  swap(m_tail,cp.m_tail);
127  }
void swap(bqueue< T > &cp)
Definition: bqueue.h:122
itemptr m_head
Definition: bqueue.h:210
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
itemptr m_tail
Definition: bqueue.h:210
size_type m_size
Definition: bqueue.h:209

Member Data Documentation

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