DABC (Data Acquisition Backbone Core)  2.9.9
Public Member Functions | Private Types
dabc::RecordsQueue< T, canexpand > Class Template Reference

Template of queue with complex objects. More...

#include <dabc/Queue.h>

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

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 ()
 
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
 

Detailed Description

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

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(); } };

Definition at line 402 of file Queue.h.

Member Typedef Documentation

◆ Parent

template<class T , bool canexpand = true>
typedef Queue<T, canexpand> dabc::RecordsQueue< T, canexpand >::Parent
private

Definition at line 403 of file Queue.h.

Constructor & Destructor Documentation

◆ RecordsQueue() [1/2]

template<class T , bool canexpand = true>
dabc::RecordsQueue< T, canexpand >::RecordsQueue ( )
inline

Definition at line 405 of file Queue.h.

◆ ~RecordsQueue()

template<class T , bool canexpand = true>
virtual dabc::RecordsQueue< T, canexpand >::~RecordsQueue ( )
inlinevirtual

Definition at line 407 of file Queue.h.

◆ RecordsQueue() [2/2]

template<class T , bool canexpand = true>
dabc::RecordsQueue< T, canexpand >::RecordsQueue ( unsigned  capacity)
inline

Definition at line 409 of file Queue.h.

Member Function Documentation

◆ Allocate()

template<class T , bool canexpand = true>
void dabc::RecordsQueue< T, canexpand >::Allocate ( unsigned  capacity)
inline

Definition at line 411 of file Queue.h.

◆ Empty()

template<class T , bool canexpand = true>
bool dabc::RecordsQueue< T, canexpand >::Empty ( ) const
inline

Definition at line 413 of file Queue.h.

◆ Full()

template<class T , bool canexpand = true>
bool dabc::RecordsQueue< T, canexpand >::Full ( ) const
inline

Definition at line 415 of file Queue.h.

◆ Size()

template<class T , bool canexpand = true>
unsigned dabc::RecordsQueue< T, canexpand >::Size ( ) const
inline

Definition at line 417 of file Queue.h.

◆ Capacity()

template<class T , bool canexpand = true>
unsigned dabc::RecordsQueue< T, canexpand >::Capacity ( ) const
inline

Definition at line 419 of file Queue.h.

◆ Item()

template<class T , bool canexpand = true>
T& dabc::RecordsQueue< T, canexpand >::Item ( unsigned  n) const
inline

Definition at line 421 of file Queue.h.

◆ Push()

template<class T , bool canexpand = true>
void dabc::RecordsQueue< T, canexpand >::Push ( const T &  val)
inline

Definition at line 423 of file Queue.h.

◆ Front()

template<class T , bool canexpand = true>
T& dabc::RecordsQueue< T, canexpand >::Front ( ) const
inline

Definition at line 425 of file Queue.h.

◆ Back()

template<class T , bool canexpand = true>
T& dabc::RecordsQueue< T, canexpand >::Back ( ) const
inline

Definition at line 427 of file Queue.h.

◆ PopOnly()

template<class T , bool canexpand = true>
void dabc::RecordsQueue< T, canexpand >::PopOnly ( )
inline

Definition at line 429 of file Queue.h.

◆ CopyTo()

template<class T , bool canexpand = true>
virtual void dabc::RecordsQueue< T, canexpand >::CopyTo ( T *  tgt)
inlinevirtual

Method can be used to copy content of the queue into externally allocated array.

Reimplemented from dabc::Queue< T, true >.

Definition at line 431 of file Queue.h.

◆ PushEmpty()

template<class T , bool canexpand = true>
T* dabc::RecordsQueue< T, canexpand >::PushEmpty ( )
inline

Definition at line 437 of file Queue.h.

◆ Reset()

template<class T , bool canexpand = true>
void dabc::RecordsQueue< T, canexpand >::Reset ( )
inline

Definition at line 439 of file Queue.h.

◆ FindItemWithId()

template<class T , bool canexpand = true>
template<class DDD >
T* dabc::RecordsQueue< T, canexpand >::FindItemWithId ( DDD  id)
inline

Definition at line 451 of file Queue.h.

◆ AllocateRecs()

template<class T , bool canexpand = true>
void dabc::RecordsQueue< T, canexpand >::AllocateRecs ( unsigned  rec_capacity)
inline

Helper methods to preallocate memory in each record in the queue.

Definition at line 461 of file Queue.h.


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