activemq-cpp-3.6.0
decaf::internal::util::TimerTaskHeap Class Reference

A Binary Heap implemented specifically for the Timer class in Decaf Util. More...

#include <src/main/decaf/internal/util/TimerTaskHeap.h>

Public Member Functions

 TimerTaskHeap ()
virtual ~TimerTaskHeap ()
Pointer< TimerTaskpeek ()
 Peaks at the Head of the Heap, returns the task with the nearest scheduled run time.
bool isEmpty () const
std::size_t size () const
void insert (const Pointer< TimerTask > &task)
 Inserts the specified Task into the heap, heap is reordered to reflect the addition of a new element.
void remove (std::size_t pos)
 Removes the Task at the specified position from the heap, resorts the heap from the position down to the bottom.
void reset ()
 Clear all contents from the heap.
void adjustMinimum ()
 Resorts the heap starting at the top.
std::size_t deleteIfCancelled ()
 Runs through the heap removing all cancelled Tasks from it, this is not normally used but in case a a cancellation of a large number of tasks the user can perform this purge.
std::size_t find (const Pointer< TimerTask > &task) const
 Searches the heap for the specified TimerTask element and returns its position in the heap.

Detailed Description

A Binary Heap implemented specifically for the Timer class in Decaf Util.

Since
1.0

Constructor & Destructor Documentation

decaf::internal::util::TimerTaskHeap::TimerTaskHeap ( )
virtual decaf::internal::util::TimerTaskHeap::~TimerTaskHeap ( )
virtual

Member Function Documentation

void decaf::internal::util::TimerTaskHeap::adjustMinimum ( )

Resorts the heap starting at the top.

std::size_t decaf::internal::util::TimerTaskHeap::deleteIfCancelled ( )

Runs through the heap removing all cancelled Tasks from it, this is not normally used but in case a a cancellation of a large number of tasks the user can perform this purge.

Returns
the number of task that were removed from the heap becuase they were cancelled.
std::size_t decaf::internal::util::TimerTaskHeap::find ( const Pointer< TimerTask > &  task) const

Searches the heap for the specified TimerTask element and returns its position in the heap.

Returns the unsigned equivalent of -1 if the element is not found.

Returns
the position in the Heap where the Task is stored, or npos.
void decaf::internal::util::TimerTaskHeap::insert ( const Pointer< TimerTask > &  task)

Inserts the specified Task into the heap, heap is reordered to reflect the addition of a new element.

Parameters
taskThe TimerTask to insert into the heap.
bool decaf::internal::util::TimerTaskHeap::isEmpty ( ) const
Returns
true if the heap is empty.
Pointer<TimerTask> decaf::internal::util::TimerTaskHeap::peek ( )

Peaks at the Head of the Heap, returns the task with the nearest scheduled run time.

Returns
The TimerTask that is scheduled to be executed next if the Heap is empty a Null Pointer value is returned.
void decaf::internal::util::TimerTaskHeap::remove ( std::size_t  pos)

Removes the Task at the specified position from the heap, resorts the heap from the position down to the bottom.

Parameters
posThe position at which to remove the TimerTask and begin a resort of the heap.
void decaf::internal::util::TimerTaskHeap::reset ( )

Clear all contents from the heap.

std::size_t decaf::internal::util::TimerTaskHeap::size ( ) const
Returns
the size of the heap.

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