OpenDaVINCI  4.15.3
odcore::base::BufferedLIFOQueue Class Reference

#include <BufferedLIFOQueue.h>

Inheritance diagram for odcore::base::BufferedLIFOQueue:
Inheritance graph

Public Member Functions

 BufferedLIFOQueue (const uint32_t &bufferSize)
 
virtual ~BufferedLIFOQueue ()
 
virtual void push (const data::Container &container)
 
int32_t getIndexOfLastElement () const
 
const data::Container getElementAt (const uint32_t &index) const throw (exceptions::ArrayIndexOutOfBoundsException)
 
virtual void clear ()
 
const data::Container pop ()
 
virtual void add (odcore::data::Container &container)
 
virtual uint32_t getSize () const
 
virtual bool isEmpty () const
 
virtual void waitForData ()
 
virtual void wakeAll ()
 

Protected Member Functions

const data::Container get (const uint32_t &index) const
 
virtual void wait ()
 

Detailed Description

This interface encapsulates all methods necessary for a buffered LIFO. A buffered LIFO allows indexed access to the elements without removing them.

Constructor & Destructor Documentation

odcore::base::BufferedLIFOQueue::BufferedLIFOQueue ( const uint32_t &  bufferSize)

Constructor.

Parameters
bufferSizeMaximum size for this buffered lifo.
odcore::base::BufferedLIFOQueue::~BufferedLIFOQueue ( )
virtual

Member Function Documentation

void odcore::base::LIFOQueue::add ( odcore::data::Container container)
virtualinherited

This method adds a new container to this data store depending on the entering strategy (i.e. front or end).

Parameters
containerContainer to be added.

Implements odcore::base::AbstractDataStore.

References odcore::base::LIFOQueue::push().

void odcore::base::LIFOQueue::clear ( )
virtualinherited

This method clears a datastore.

Implements odcore::base::AbstractDataStore.

References odcore::base::AbstractDataStore::wakeAll().

const Container odcore::base::LIFOQueue::get ( const uint32_t &  index) const
protectedinherited

This method returns the element at the given index or an empty container.

Parameters
indexIndex of the element to be retrieved.
Returns
Element at the given index.

References odcore::base::LIFOQueue::getSize(), and odcore::base::LIFOQueue::isEmpty().

const Container odcore::base::BufferedLIFOQueue::getElementAt ( const uint32_t &  index) const
throw (exceptions::ArrayIndexOutOfBoundsException
)

This method returns the elements at the current index.

Parameters
indexIndex of the element to be retrieved.
Returns
Element at the given index.
Exceptions
ArrayIndexOutOfBoundsExceptionif the index is invalid.

References OPENDAVINCI_CORE_THROW_EXCEPTION.

int32_t odcore::base::BufferedLIFOQueue::getIndexOfLastElement ( ) const

This method returns the index of the last element.

Returns
Index of the last element or -1 if the LIFO is empty.

References odcore::base::LIFOQueue::getSize().

uint32_t odcore::base::LIFOQueue::getSize ( ) const
virtualinherited

This method returns the number of elements currently available in the queue.

Implements odcore::base::AbstractDataStore.

Referenced by odcore::base::LIFOQueue::get(), getIndexOfLastElement(), and push().

bool odcore::base::LIFOQueue::isEmpty ( ) const
virtualinherited

This method returns true if getSize() == 0.

Returns
true if getSize() == 0.

Implements odcore::base::AbstractDataStore.

Referenced by odcore::base::LIFOQueue::get(), and odcore::base::LIFOQueue::pop().

const Container odcore::base::LIFOQueue::pop ( )
inherited
void odcore::base::BufferedLIFOQueue::push ( const data::Container container)
virtual
void odcore::base::AbstractDataStore::wait ( )
protectedvirtualinherited

This method can be called to fall asleep.

References odcore::base::Condition::waitOnSignal().

void odcore::base::AbstractDataStore::waitForData ( )
virtualinherited