1 #ifndef CMSUTILS_BEUEUE_H 2 #define CMSUTILS_BEUEUE_H 3 #include <boost/intrusive_ptr.hpp> 59 template<
typename... Args>
62 boost::intrusive_ptr< _bqueue_item<T> >
back;
99 typedef boost::intrusive_ptr< _bqueue_item<value_type> >
itemptr;
103 bqueue() : m_size(0), m_head(), m_tail() { }
134 m_tail = itemptr(
new item(this->m_tail, val));
135 if ((++m_size) == 1) { m_head = m_tail; };
140 m_tail = itemptr(
new item(this->m_tail, std::forward<T>(
val)));
141 if ((++m_size) == 1) { m_head = m_tail; };
145 template<
typename... Args>
147 m_tail = itemptr(
new item(this->m_tail, std::forward<Args>(
args)...));
148 if ((++m_size) == 1) { m_head = m_tail; };
154 m_tail = m_tail->back;
155 if (m_size == 0) m_head =
nullptr;
159 const T &
front()
const {
return m_head->value; }
161 const T &
back()
const {
return m_tail->value; }
163 const_iterator
rbegin()
const {
return m_tail.get(); }
164 const_iterator
rend()
const {
return nullptr; }
165 const_iterator
begin()
const {
return m_tail.get(); }
166 const_iterator
end()
const {
return nullptr; }
167 size_type
size()
const {
return m_size; }
168 bool empty()
const {
return m_size == 0; }
170 int idx = m_size - i - 1;
171 const_iterator it = rbegin();
172 while (idx-- > 0) --it;
180 return (m_size > 0) && (m_head->refCount > 2);
194 other.
m_head->back = this->m_tail;
202 m_head = m_tail =
nullptr;
const_iterator rend() const
bqueue & operator=(bqueue< T > &&cp) noexcept
_bqueue_itr< value_type > iterator
void swap(bqueue< T > &cp)
bool operator==(const _bqueue_itr< T > &t2) const
_bqueue_item(boost::intrusive_ptr< _bqueue_item< T > > tail, const T &val)
_bqueue_itr< value_type > const_iterator
bqueue(bqueue< T > &&cp) noexcept
unsigned short int size_type
_bqueue_itr< T > & operator++()
void swap(bqueue< T > &rh, bqueue< T > &lh)
void emplace_back(Args &&...args)
friend void intrusive_ptr_release(_bqueue_item< T > *it)
const T * operator->() const
_bqueue_item< T > const * it
_bqueue_itr< T > & operator--()
friend void intrusive_ptr_add_ref(_bqueue_item< T > *it)
_bqueue_item< value_type > item
bqueue(const bqueue< T > &cp)
_bqueue_item(boost::intrusive_ptr< _bqueue_item< T > > tail, T &&val)
_bqueue_item(boost::intrusive_ptr< _bqueue_item< T > > tail, Args &&...args)
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
const_iterator begin() const
_bqueue_itr(const _bqueue_item< T > *t)
const _bqueue_itr< T > & operator--() const
void intrusive_ptr_add_ref(_bqueue_item< T > *it)
const_iterator rbegin() const
boost::intrusive_ptr< _bqueue_item< T > > back
const T & operator[](size_type i) const
void intrusive_ptr_release(_bqueue_item< T > *it)
boost::intrusive_ptr< _bqueue_item< value_type > > itemptr
const T & operator*() const
void join(bqueue< T > &other)
bool operator!=(const _bqueue_itr< T > &t2) const
const _bqueue_itr< T > & operator=(const _bqueue_itr< T > &t2)
const_iterator end() const
void push_back(const T &val)