Dillo v3.1.1-117-gc0464026
Loading...
Searching...
No Matches
lout::container::untyped::Stack Class Reference

A stack (LIFO). More...

#include <container.hh>

Classes

class  Node
 
class  StackIterator
 

Public Member Functions

 Stack (bool ownerOfObjects)
 
 ~Stack ()
 
int size ()
 
void push (object::Object *object)
 
void pushUnder (object::Object *object)
 
object::ObjectgetTop () const
 
void pop ()
 
int size () const
 
- Public Member Functions inherited from lout::container::untyped::Collection
void intoStringBuffer (misc::StringBuffer *sb)
 Store a textual representation of the object in a misc::StringBuffer.
 
Iterator iterator ()
 
- Public Member Functions inherited from lout::object::Object
virtual ~Object ()
 The destructor is defined as virtual (but not abstract), so that destruction of Object's works properly.
 
virtual bool equals (Object *other)
 Returns, whether two objects are equal.
 
virtual int hashValue ()
 Return a hash value for the object.
 
virtual Objectclone ()
 Return an exact copy of the object.
 
const char * toString ()
 Use object::Object::intoStringBuffer to return a textual representation of the object.
 
virtual size_t sizeOf ()
 Return the number of bytes, this object totally uses.
 

Protected Member Functions

AbstractIteratorcreateIterator ()
 

Private Attributes

Nodebottom
 
Nodetop
 
bool ownerOfObjects
 
int numElements
 

Friends

class StackIterator
 

Detailed Description

A stack (LIFO).

Can be used as Queue (FIFO) when pushUnder() is used instead of push().

Note that the iterator returns all elements in the reversed order they have been put on the stack.

Definition at line 336 of file container.hh.

Constructor & Destructor Documentation

◆ Stack()

lout::container::untyped::Stack::Stack ( bool  ownerOfObjects)

Definition at line 721 of file container.cc.

References bottom, numElements, ownerOfObjects, and top.

◆ ~Stack()

lout::container::untyped::Stack::~Stack ( )

Definition at line 728 of file container.cc.

References pop(), and top.

Member Function Documentation

◆ createIterator()

Collection0::AbstractIterator * lout::container::untyped::Stack::createIterator ( )
protectedvirtual

Implements lout::container::untyped::Collection0.

Definition at line 800 of file container.cc.

References top.

◆ getTop()

object::Object * lout::container::untyped::Stack::getTop ( ) const
inline

Definition at line 373 of file container.hh.

References lout::container::untyped::Stack::Node::object, and top.

◆ pop()

void lout::container::untyped::Stack::pop ( )

◆ push()

void lout::container::untyped::Stack::push ( object::Object object)

◆ pushUnder()

void lout::container::untyped::Stack::pushUnder ( object::Object object)

◆ size() [1/2]

int lout::container::untyped::Stack::size ( )
virtual

Implements lout::container::untyped::Collection.

Definition at line 734 of file container.cc.

References numElements.

◆ size() [2/2]

int lout::container::untyped::Stack::size ( ) const
inline

Definition at line 375 of file container.hh.

References numElements.

Friends And Related Symbol Documentation

◆ StackIterator

friend class StackIterator
friend

Definition at line 338 of file container.hh.

Member Data Documentation

◆ bottom

Node* lout::container::untyped::Stack::bottom
private

Definition at line 358 of file container.hh.

Referenced by pop(), push(), pushUnder(), and Stack().

◆ numElements

int lout::container::untyped::Stack::numElements
private

Definition at line 360 of file container.hh.

Referenced by pop(), push(), pushUnder(), size(), size(), and Stack().

◆ ownerOfObjects

bool lout::container::untyped::Stack::ownerOfObjects
private

Definition at line 359 of file container.hh.

Referenced by pop(), and Stack().

◆ top

Node * lout::container::untyped::Stack::top
private

Definition at line 358 of file container.hh.

Referenced by createIterator(), getTop(), pop(), push(), pushUnder(), Stack(), and ~Stack().


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