./
stack__define.pro
This class provides an array-based implementation of a stack. Elements can be added into a stack (a 'push') and retrieved in a last in, first out manner (via 'peek' or 'pop' methods).
Class description for STACK
Author information
- History
January 2009: Written by Chris Beaumont Oct 2009: Added /NOCOPY keyword to toArray(). cnb. April 2010: Added contains() method. cnb
Routines
STACK::push, dataPush data onto the stack
result = stack::pop(num)pop elements off the stack, removing them from the stack.
result = stack::peek(num)return, but don't remove, elements from the top of the stack
result = stack::contains(num)result = stack::fetch(num, remove=remove)result = stack::isEmpty()Test whether the stack has any data
result = stack::getSize()Return the number of elements in the stack
result = stack::toArray(count, nocopy=nocopy)Return the stack in array form
stack::ensureCapacity, numAn internal method to ensure the stack is big enough for push events
stack::cleanupSTACK__DEFINE
Routine details
topSTACK::push
STACK::push, data
Push data onto the stack
Parameters
- data in required
The data to push onto the stack, a scalar or vector. The data should be of the same type as the rest of the stack
topstack::pop
result = stack::pop(num)
pop elements off the stack, removing them from the stack.
Parameters
- num in required
The number of elements to remove. Defaults to 1
topstack::peek
result = stack::peek(num)
return, but don't remove, elements from the top of the stack
Parameters
- num in required
The number of elements to return. Defaults to 1
topstack::toArray
result = stack::toArray(count, nocopy=nocopy)
Return the stack in array form
Parameters
- count in required
On output, holds the number of elements in the stack.
Keywords
- nocopy
topstack::ensureCapacity
stack::ensureCapacity, num
An internal method to ensure the stack is big enough for push events
Parameters
- num
topstack::cleanup
stack::cleanup
topSTACK__DEFINE
STACK__DEFINE
File attributes
| Modifcation date: | Thu Feb 3 13:36:04 2011 |
| Lines: | 233 |
![[attach.png]](idldoc-resources/attach.png)