C3D Toolkit  Kernel - 117982, Vision - 2.9.2.2

Queue of objects without destructors. More...

#include <templ_s_queue.h>

Public Member Functions

 SQueue (size_t capacity=0)
 Constructor.
 
virtual ~SQueue ()
 Destructor.
 
size_t Capacity () const
 Get the size of the allocated memory.
 
Type & Back ()
 The last element of the queue. More...
 
const Type & Back () const
 The last element of the queue. More...
 
Type & Front ()
 The first element of the queue.
 
const Type & Front () const
 The first element of the queue.
 
bool Empty () const
 A property of the empty set.
 
bool IsFull () const
 An expended memory property. More...
 
Type & First () const
 The very first one outgoing from the queue (it works correctly only for nonempty queue).
 
void Push (const Type &obj)
 Add to the queue and increase the buffer of the allocated memory if it is necessary. More...
 
void Pop ()
 Move out from queue.
 
void Pop (Type &obj)
 Move out from queue.
 
bool Reserve (size_t)
 Reserve an additional memory.
 
void SetEmpty ()
 Clear the queue.
 
size_t Size () const
 Get the queue size.
 

Detailed Description

template<class Type>
class SQueue< Type >

Queue of objects without destructors.

Queue of objects without destructors.
Requirement for the objects are the same as in SArray<Type>.

Attention
In order to efficiency of the container validation - the usage of prohibitive memory are implemented only for debug version
Usage recommendations
If the fixed (known) maximum size of queue is assumed then it is recommended to use the function SQueue<class Type>::Push() to add an object. If the limit size of queue is unknown then there should be applied the method SQueue<class Type>::PushAlloc() which builds up the memory as necessary.
The rule of memory allocation
If the size of the buffer for storage of queue objects is not enough then allocated a new part of the heap which has size greater on SQueue::delta. If SQueue::delta = 1, then the size of allocated memory is increased by 12,5% each time the limit is reached.

Member Function Documentation

◆ Back() [1/2]

template<class Type >
Type & SQueue< Type >::Back
inline

The last element of the queue.

Which is the last? (it works correctly only for nonempty queue)

◆ Back() [2/2]

template<class Type >
const Type & SQueue< Type >::Back
inline

The last element of the queue.

Which is the last? (it works correctly only for nonempty queue);.

◆ IsFull()

template<class Type >
bool SQueue< Type >::IsFull
inline

An expended memory property.

A expended buffer property.

In fact this property answeres whether it is possible to add in a queue an element without redeployment of the buffer.

◆ Push()

template<class Type >
void SQueue< Type >::Push ( const Type &  obj)

Add to the queue and increase the buffer of the allocated memory if it is necessary.

Add to the queue and increase the buffer of the llocated memory if it is necessary.

The same as SQueue<Type>::Push, but with memory reallocation in a case when the buffer is full


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