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 39 of file bqueue.h.

Member Typedef Documentation

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

Definition at line 101 of file bqueue.h.

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

Definition at line 98 of file bqueue.h.

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

Definition at line 99 of file bqueue.h.

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

Definition at line 100 of file bqueue.h.

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

Definition at line 97 of file bqueue.h.

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

Definition at line 96 of file bqueue.h.

Constructor & Destructor Documentation

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

Definition at line 103 of file bqueue.h.

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

Definition at line 104 of file bqueue.h.

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

Definition at line 106 of file bqueue.h.

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

Definition at line 109 of file bqueue.h.

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

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 165 of file bqueue.h.

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

Definition at line 201 of file bqueue.h.

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

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

Definition at line 146 of file bqueue.h.

Referenced by TempTrajectory::emplace().

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

Definition at line 168 of file bqueue.h.

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

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

Definition at line 166 of file bqueue.h.

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

Definition at line 128 of file bqueue.h.

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

Definition at line 159 of file bqueue.h.

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

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

Definition at line 186 of file bqueue.h.

Referenced by TempTrajectory::join().

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

Definition at line 113 of file bqueue.h.

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

Definition at line 169 of file bqueue.h.

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

Definition at line 151 of file bqueue.h.

Referenced by TempTrajectory::pop().

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

Definition at line 133 of file bqueue.h.

Referenced by TempTrajectory::push().

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

Definition at line 139 of file bqueue.h.

139  {
140  m_tail = itemptr(new item(this->m_tail, std::forward<T>(val)));
141  if ((++m_size) == 1) { m_head = m_tail; };
142  }
itemptr m_head
Definition: bqueue.h:209
_bqueue_item< value_type > item
Definition: bqueue.h:98
itemptr m_tail
Definition: bqueue.h:209
boost::intrusive_ptr< _bqueue_item< value_type > > itemptr
Definition: bqueue.h:99
size_type m_size
Definition: bqueue.h:208
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 176 of file bqueue.h.

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

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

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

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

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