DABC (Data Acquisition Backbone Core)
2.9.9
|
Template of queue with complex objects. More...
#include <dabc/Queue.h>
Public Member Functions | |
void | Allocate (unsigned capacity) |
void | AllocateRecs (unsigned rec_capacity) |
Helper methods to preallocate memory in each record in the queue. More... | |
T & | Back () const |
unsigned | Capacity () const |
virtual void | CopyTo (T *tgt) |
Method can be used to copy content of the queue into externally allocated array. More... | |
bool | Empty () const |
template<class DDD > | |
T * | FindItemWithId (DDD id) |
T & | Front () const |
bool | Full () const |
T & | Item (unsigned n) const |
void | PopOnly () |
void | Push (const T &val) |
T * | PushEmpty () |
RecordsQueue () | |
RecordsQueue (unsigned capacity) | |
void | Reset () |
unsigned | Size () const |
virtual | ~RecordsQueue () |
Public Member Functions inherited from dabc::Queue< T, true > | |
void | Allocate (unsigned capacity) |
T & | Back () const |
Iterator | begin () |
unsigned | Capacity () const |
bool | Empty () const |
Iterator | end () |
bool | Expand (unsigned newcapacity=0) |
T & | Front () const |
bool | Full () const |
void | Init (unsigned capacity) |
T & | Item (unsigned indx) const |
T * | ItemPtr (unsigned indx) const |
bool | MakePlaceForNext () |
T | Pop () |
void | PopOnly () |
void | Push (T val) |
T * | PushEmpty () |
void | PushRef (const T &val) |
Queue ()=default | |
Queue (unsigned capacity) | |
bool | Remove (T value) |
bool | RemoveItem (unsigned indx) |
void | Reset () |
unsigned | Size () const |
virtual | ~Queue () |
Private Types | |
typedef Queue< T, canexpand > | Parent |
Additional Inherited Members | |
Protected Member Functions inherited from dabc::Queue< T, true > | |
T * | QueueItem (unsigned n) |
Protected Attributes inherited from dabc::Queue< T, true > | |
T * | fBorder |
unsigned | fCapacity |
T * | fHead |
unsigned | fInitSize |
original size of the queue, restored then Reset() method is called More... | |
T * | fQueue |
unsigned | fSize |
T * | fTail |
Template of queue with complex objects.
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(); } };
|
private |
|
inline |
|
inlinevirtual |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlinevirtual |
Method can be used to copy content of the queue into externally allocated array.
Reimplemented from dabc::Queue< T, true >.
|
inline |
|
inline |
|
inline |
|
inline |