Nokia N97 SDK
Example Applications Guide

Stack Class Reference

List of all members.

Detailed Description

Definition at line 26 of file stack.h.


Public Member Functions

  Stack ()
  ~Stack ()
void  Push (ProducedItem *aItem)
ProducedItem *  Pop ()

Private Types

enum   { EMaxProduction = 1000 }

Private Attributes

ProducedItem *  iItems [EMaxProduction]
int  iStatckTop


Constructor & Destructor Documentation

Stack::~Stack (   )  [inline]
 

Destructor Delete all the items those are not yet consumed by the consumers

Definition at line 42 of file stack.h.

References Pop().

00043         {
00044                 ProducedItem* item = NULL; 
00045                 do
00046                         {
00047                         item = Pop();
00048                         delete item;
00049                         } while(item != NULL);
00050         }


Member Function Documentation

void Stack::Push (  ProducedItem *  aItem  )  [inline]
 

Push New Item is created on Stack for every push operation

Parameters:
aItem  - Item to be Pushed
Returns:
Nothing

Definition at line 60 of file stack.h.

References iItems, and iStatckTop.

Referenced by PushOntoStack().

00061         {
00062                 //If there is enough space to put item onto stack
00063                 if(iStatckTop < EMaxProduction-1)
00064                         {
00065                         ProducedItem* item = new ProducedItem;
00066                         memcpy(item, aItem, sizeof(ProducedItem));
00067                         iItems[++iStatckTop] = item;
00068                         }
00069                 //else Ignore it!
00070         }

ProducedItem* Stack::Pop (   )  [inline]
 

Pop Item is sent to the Consumer who is doing the Pop. Ownership will also ne given. So, this item has to be deleted by the Consumer.

Parameters:
Nothing 
Returns:
- Item Poped

Definition at line 82 of file stack.h.

References iItems, and iStatckTop.

Referenced by PopFromStack(), and ~Stack().

00083         {
00084                 if(iStatckTop != -1) 
00085                 {
00086                         ProducedItem* item = iItems[iStatckTop];
00087                         iItems[iStatckTop--] = NULL;
00088                         return item;
00089                 }
00090                 return NULL;
00091         }


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

© Nokia 2009

Back to top