Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

CC_IntStack Class Reference

#include <CC_IntStack.h>

Inheritance diagram for CC_IntStack:

CC_RootObject List of all members.

Detailed Description

Stack-like container class for items of type: int.

This class was automatically generated by an XSLT program. It models a FIFO container with a fixed size. The items in the container are handled as variables of type: int. This is a type-safe class that does not perform any type casting. The size of the stack must be set by the user during the initialization phase and cannot be changed afterwards. This class offers the two traditional push and pop operations and a reset operation that empties the stack. Attempts to push a full stack or to pop an empty stack result in no action other than the generation of an event report.

Author:
Alessandro Pasetti (P&P Software)
Version:
1.0

Definition at line 36 of file CC_IntStack.h.

Public Member Functions

 CC_IntStack ()
 Instantiate a new stack container.

void push (int newItem)
 Push an item onto the stack.

int pop ()
 Pop an item from the stack.

void setStackSize (unsigned int size)
 Set the size of the stack.

unsigned int getStackSize () const
 Return the size of the stack.

unsigned int getNumberOfItems () const
 Return the number of items currently on the stack.

bool isEmpty () const
 Check whether the stack is emtpy.

bool isFull () const
 Check whether the stack is full.

void reset ()
 Reset the stack.

virtual bool isObjectConfigured ()
 Perform a class-specific configuration check on a stack object: verify that the stack size has a legal value.


Constructor & Destructor Documentation

CC_IntStack::CC_IntStack  ) 
 

Instantiate a new stack container.

The stack is initially empty. Its size is set to an illegal value to signify that the stack is not yet configured.

Definition at line 22 of file CC_IntStack.cpp.


Member Function Documentation

unsigned int CC_IntStack::getNumberOfItems  )  const
 

Return the number of items currently on the stack.

Returns:
the number of items currently on the stack

Definition at line 43 of file CC_IntStack.cpp.

unsigned int CC_IntStack::getStackSize  )  const
 

Return the size of the stack.

See also:
setStackSize
Returns:
the desired size of the stack

Definition at line 39 of file CC_IntStack.cpp.

bool CC_IntStack::isEmpty  )  const
 

Check whether the stack is emtpy.

Returns:
true if the stack is emtpy, false otherwise

Definition at line 77 of file CC_IntStack.cpp.

bool CC_IntStack::isFull  )  const
 

Check whether the stack is full.

Returns:
true if the stack is full, false otherwise

Definition at line 72 of file CC_IntStack.cpp.

bool CC_IntStack::isObjectConfigured  )  [virtual]
 

Perform a class-specific configuration check on a stack object: verify that the stack size has a legal value.

Returns:
true if the object is configured, false otherwise

Reimplemented from CC_RootObject.

Definition at line 87 of file CC_IntStack.cpp.

int CC_IntStack::pop  ) 
 

Pop an item from the stack.

If the stack is empty, the value of NULL is returned and event report EVT_STACK_FULL is generated to report the fact. Users should always check that the stack is not empty (using operation isEmpty) before performing a pop operation.

See also:
TD_EventType
Returns:
the most recently item pushed onto the stack or NULL if the stack is empty

Definition at line 60 of file CC_IntStack.cpp.

void CC_IntStack::push int  newItem  ) 
 

Push an item onto the stack.

If the stack is already full, no action is taken but event report EVT_STACK_FULL is generated to report the fact. Users should always check that the stack is not full (using operation isFull) before performing a push operation.

See also:
TD_EventType
Parameters:
newItem the new item to be added to the stack

Definition at line 48 of file CC_IntStack.cpp.

void CC_IntStack::reset  ) 
 

Reset the stack.

The stack is brought back to the status it had after it was configured but before it was ever used.

Definition at line 82 of file CC_IntStack.cpp.

void CC_IntStack::setStackSize unsigned int  size  ) 
 

Set the size of the stack.

The size of the stack is the maximum number of items that can be held by the stack. A call to this method causes the internal FIFO data structure where the stack items are stored to be created and initialized.

This is an initialization method. It should be called before the stack is used for the first time and it should not be called more than once. Attempts to call it more than once will result in memory leaks. It is not legal to set the repository size to 0.

Parameters:
size the desired size of the stack

Definition at line 29 of file CC_IntStack.cpp.


The documentation for this class was generated from the following files:
Copyright 2003 P&P Software GmbH - All Rights Reserved