stream  0.10.0
stream analysis framework
Public Member Functions
base::RecordsQueue< T, canexpand > Class Template Reference

Special case of the queue when structure or class is used as entry of the queue. More...

#include <base/Queue.h>

Inheritance diagram for base::RecordsQueue< T, canexpand >:
base::Queue< T, true >

Public Member Functions

 RecordsQueue ()
 default constructor
 
 RecordsQueue (unsigned _capacity)
 construct queue with given capacity
 
T & front () const
 front element
 
T & back () const
 back element
 
unsigned capacity () const
 capacity
 
unsigned size () const
 size
 
bool full () const
 is queue full
 
bool empty () const
 is queue empty
 
T & item (unsigned indx) const
 item reference
 
T * item_ptr (unsigned indx) const
 item pointer
 
void pop ()
 pop item
 
pop_front ()
 pop item and return it
 
void pop_items (unsigned cnt)
 pop several items
 
void clear ()
 clear queue
 
bool erase_item (unsigned indx)
 erase item
 
- Public Member Functions inherited from base::Queue< T, true >
 Queue ()
 default constructor
 
 Queue (unsigned _capacity)
 constructor with capacity
 
virtual ~Queue ()
 destructor
 
void Init (unsigned _capacity)
 init queue
 
void Allocate (unsigned _capacity)
 allocate queue
 
virtual void CopyTo (T *tgt)
 Method can be used to copy content of the queue into externally allocated array.
 
bool Expand (unsigned newcapacity=0)
 increase capacity of queue without lost of content
 
bool Remove (T value)
 remove value from queue
 
bool erase_item (unsigned indx)
 erase item with index
 
bool MakePlaceForNext ()
 create place for next entry
 
void push (const T &val)
 push value
 
T * PushEmpty ()
 push empty, return pointer on place
 
void pop ()
 pop element
 
pop_front ()
 pop front element
 
T & front () const
 access front element
 
T & item (unsigned indx) const
 access arbitrary item
 
T * item_ptr (unsigned indx) const
 provide item pointer
 
T & back () const
 access back element
 
void clear ()
 clear queue
 
unsigned capacity () const
 return queue capacity
 
unsigned size () const
 return queue size
 
bool full () const
 is queue full
 
bool empty () const
 is queue empty
 
Iterator begin ()
 begin iterator
 
Iterator end ()
 end iterator
 

Additional Inherited Members

- Protected Attributes inherited from base::Queue< T, true >
T * fQueue
 queue
 
T * fBorder
 maximum pointer value
 
unsigned fCapacity
 capacity
 
unsigned fSize
 size
 
T * fHead
 head
 
T * fTail
 tail
 
unsigned fInitSize
 original size of the queue, restored then clear() method is called
 

Detailed Description

template<class T, bool canexpand = true>
class base::RecordsQueue< T, canexpand >

Special case of the queue when structure or class is used as entry of the queue.

Main difference from normal queue - one somehow should cleanup item when it is not longer used without item destructor. The only way is to introduce reset() method in contained class which do the job similar to destructor. It is also recommended that contained class has copy constructor and assign operator defined. For example, one should have class: struct Rec { int i; bool b; Rec() : i(0), b(false) {} Rec(const Rec& src) : i(src.i), b(src.b) {} Rec& operator=(const Rec& src) { i = src.y; b = src.b; return *this; } void reset() { i = 0; b = false; } ~Rec() { reset(); } };


The documentation for this class was generated from the following file: