CMS 3D CMS Logo

Public Types | Public Member Functions | Private Member Functions | Private Attributes

cmsutils::bqueue< T > Class Template Reference

#include <bqueue.h>

List of all members.

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


Member Typedef Documentation

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

Definition at line 88 of file bqueue.h.

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

Definition at line 85 of file bqueue.h.

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

Definition at line 86 of file bqueue.h.

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

Definition at line 87 of file bqueue.h.

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

Definition at line 84 of file bqueue.h.

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

Definition at line 83 of file bqueue.h.


Constructor & Destructor Documentation

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

Definition at line 89 of file bqueue.h.

template<class T>
cmsutils::bqueue< T >::~bqueue ( ) [inline]

Definition at line 90 of file bqueue.h.

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

Definition at line 91 of file bqueue.h.

: m_size(cp.m_size), m_bound(cp.m_bound), m_head(cp.m_head), m_tail(cp.m_tail) { }
template<class T>
cmsutils::bqueue< T >::bqueue ( size_type  size,
itemptr  bound,
itemptr  head,
itemptr  tail 
) [inline, private]

Definition at line 178 of file bqueue.h.

                                                                          :
            m_size(size), m_bound(bound), m_head(head), m_tail(tail) { }

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

{ return m_tail->value; }
template<class T>
void cmsutils::bqueue< T >::clear ( void  ) [inline]

Definition at line 172 of file bqueue.h.

Referenced by TempTrajectory::join().

template<class T>
bool cmsutils::bqueue< T >::empty ( void  ) const [inline]

Definition at line 144 of file bqueue.h.

Referenced by TempTrajectory::empty(), and SeedingLayerSetsBuilder::layers().

{ return m_size == 0; }
template<class T>
bqueue<T> cmsutils::bqueue< T >::fork ( ) [inline]

Definition at line 116 of file bqueue.h.

                         {
            return bqueue<T>(m_size,m_bound,m_head,m_tail);
        }
template<class T>
T& cmsutils::bqueue< T >::front ( ) [inline]
template<class T>
const T& cmsutils::bqueue< T >::front ( ) const [inline]

Definition at line 137 of file bqueue.h.

{ return m_head->value; }
template<class T>
void cmsutils::bqueue< T >::join ( bqueue< T > &  other) [inline]

Definition at line 158 of file bqueue.h.

Referenced by TempTrajectory::join().

                                    {
            using std::swap;
            if (m_size == 0) {
                swap(m_head,other.m_head);
                swap(m_tail,other.m_tail);
                swap(m_size,other.m_size);
            } else {
                other.m_head->back = this->m_tail;
                m_tail = other.m_tail;
                m_size += other.m_size;
                other.m_head = other.m_tail = other.m_bound;
                other.m_size = 0;
            }
        }
template<class T>
const T& cmsutils::bqueue< T >::operator[] ( size_type  i) const [inline]

Definition at line 145 of file bqueue.h.

                                                {
                int idx = m_size - i - 1;
                const_iterator it = rbegin();
                while (idx-- > 0) --it;
                return *it;
        }
template<class T>
void cmsutils::bqueue< T >::pop_back ( ) [inline]

Definition at line 130 of file bqueue.h.

Referenced by TempTrajectory::pop().

                        {
            assert(m_size > 0);
            --m_size;
            m_tail = m_tail->back;
            if (m_size == 0) m_head = m_bound; 
        }
template<class T>
void cmsutils::bqueue< T >::push_back ( const T val) [inline]

Definition at line 119 of file bqueue.h.

Referenced by TempTrajectory::push().

                                     {
            m_tail = itemptr(new item(this->m_tail, val)); 
            if ((++m_size) == 1) { m_head = m_tail; };
        }
template<class T>
iterator cmsutils::bqueue< T >::rbegin ( ) [inline]
template<class T>
const_iterator cmsutils::bqueue< T >::rbegin ( ) const [inline]

Definition at line 141 of file bqueue.h.

{ return m_tail.get(); }
template<class T>
const_iterator cmsutils::bqueue< T >::rend ( ) const [inline]
template<class T>
bool cmsutils::bqueue< T >::shared ( ) [inline]

Definition at line 151 of file bqueue.h.

Referenced by TempTrajectory::join().

                      { 
            // size = 0: never shared
            // size = 1: shared if head->refCount > 2 (m_head and m_tail)
            // size > 1: shared if head->refCount > 2 (m_head and second_hit->back)
            return (m_size > 0) && (m_head->refCount > 2);
        }
template<class T>
size_type cmsutils::bqueue< T >::size ( void  ) const [inline]
template<class T>
void cmsutils::bqueue< T >::swap ( bqueue< T > &  cp) [inline]

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]