CStack Class
Members (8)
Documentation
CStack Class
A Stack collection is an ordered set of data items, which are accessed on a LIFO (Last-In / First-Out) basis. Each data item is passed and stored as a variant variable, using the Push and Pop methods.
Include file: AfxNova/CStack.inc
Methods
| Name | Description |
|---|---|
| Push | Appends a variant at the end of the collection. |
| Pop | Gets and removes the last element of the collection. |
| Count | Returns the number of elements in the collection. |
| Clear | Removes all the elements in the collection. |
CQueue Class
A Queue` collection is an ordered set of data items, which are accessed on a FIFO (First-In / First-Out) basis. Each data item is passed and stored as a variant variable, using the Enqueue and Dequeue methods.
Include file: AfxNova/CStack.inc
Methods
| Name | Description |
|---|---|
| Enqueue | Appends a variant at the end of the collection. |
| Dequeue | Gets and removes the first element of the collection. |
| Count | Returns the number of elements in the collection. |
| Clear | Removes all the elements in the collection. |
Push (CStack)
Appends a variant at the end of the collection.
FUNCTION Push (BYREF dv AS DVARIANT) AS HRESULT
Return value
Returns S_OK on success, or an error HRESULT on failure. Error DISP_E_ARRAYISLOCKED: The array is locked.
Usage example:
#INCLUDE ONCE "AfxNova/CStack.inc"
USING AfxNova
DIM pStack AS CStack
pStack.Push "String 1"
pStack.Push "String 2"
DIM dv AS DVARIANT
dv = pStack.Pop
PRINT dv
dv = pStack.Pop
PRINT dv
' --or--
PRINT pStack.Pop
PRINT pStack.Pop
Pop (CStack)
Gets and removes the last element of the collection.
FUNCTION Pop () AS DVARIANT
Return value
A Variant. If there are no elements to pop, the returned variant will be empty.
Count (CStack)
Returns the number of elements in the collection.
FUNCTION Count () AS UINT
Clear (CStack)
Returns the number of elements in the collection.
FUNCTION Clear () AS HRESULT
Return value
Returns S_OK on success, or an error HRESULT on failure.
Enqueue (CQueue)
Appends a variant at the end of the collection.
FUNCTION Enqueue (BYREF dv AS DVARIANT) AS HRESULT
Return value
Returns S_OK on success, or an error HRESULT on failure.
Error DISP_E_ARRAYISLOCKED: The array is locked.
Usage example:
#INCLUDE ONCE "AfxNova/CStack.inc"
USING AfxNova
DIM pQueue AS CQueue
pQueue.Enqueue "String 1"
pQueue.Enqueue 12345.12
print pQueue.Dequeue
print pQueue.Dequeue
Dequeue (CQueue)
Gets and removes the first element of the collection.
FUNCTION Dequeue () AS DVARIANT
Return value
A Variant. If there are no elements to dequeue, the returned variant will be empty.
Count (CQueue)
Returns the number of elements in the collection.
FUNCTION Count () AS UINT
Clear (CQueue)
Removes all the elements in the collection.
FUNCTION Clear () AS HRESULT
Return value
Returns S_OK on success, or an error HRESULT on failure.