|
Nokia N97 SDK Example Applications Guide |
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 |
|
|
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 }
|
|
|
Push New Item is created on Stack for every push operation
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 }
|
|
|
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.
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 }
|
|
© Nokia 2009 |