Public Member Functions

Queue Class Reference

Protocol class which defines the Queue interface. More...

#include <keyvalue/frontend/Queue.h>

List of all members.

Public Member Functions

virtual string getName () const =0
virtual bool isEmpty () const =0
 Checks if this Queue is empty.
virtual value::Value pop ()=0
 Gets the next element and mark it for latter removal.
virtual void remove ()=0
 Removes popped elements from the Queue.
virtual void putBack ()=0
 Puts popped elements back in the Queue.

Detailed Description

Protocol class which defines the Queue interface.

Each front-end (spreadsheet add-in, XML parser, ...) has to implement a Queue which is responsible for converting from its own types to value::Value objects which become elements of the Queue.

Elements can be popped (throw pop()) one by one. When one element is popped, it is marked for later removal. Marked elements can be put back on the Queue (throw putBack()) or they can be definitely removed from it (throw remove()).


Member Function Documentation

virtual bool isEmpty (  )  const [pure virtual]

Checks if this Queue is empty.

Returns:
If this Queue is empty or all its elements are marked for removal, then this methods returns true. Otherwise, it returns false.
virtual value::Value pop (  )  [pure virtual]

Gets the next element and mark it for latter removal.

The debug version should check if there is any element to be popped (by calling isEmpty()) and throw an exception when the check fails. The release version has undefined behaviour when this Queue is empty.

Returns:
Next value which is not marked for removal.
Exceptions:
LogicError : (Debug build only) When there is no element to be popped.
virtual void remove (  )  [pure virtual]

Removes popped elements from the Queue.

The implementation should be such that it is safe to call this method even when there is no element to be removed.

virtual void putBack (  )  [pure virtual]

Puts popped elements back in the Queue.

The implementation should be such that it is safe to call this method even when there is no element to be put back.