5.24. PLVstk: Stack Manager
The PLVstk (PL/Vision STacK manager) package is a generic manager for both first-in-first-out (FIFO) and last-in-last-out (LIFO) stacks; it is built on PLVlst. See the companion disk (see http://examples.oreilly.com/advoracle) for details.
5.24.1. Package constants
defstk CONSTANT VARCHAR2(5) := 'stack';
The name of the default stack.
lifo CONSTANT VARCHAR2(4) := 'LIFO';
Indicates that you are working with a last-in-first-out stack. Used in calls to pop.
fifo CONSTANT VARCHAR2(4) := 'FIFO';
Indicates that you are working with a first-in-first-out stack. Used in calls to pop.
5.24.2. Creating and destroying stacks
PROCEDURE make (stack_in IN VARCHAR2 := defstk, overwrite_in IN BOOLEAN := TRUE);Allocates storage for a stack of up to 1,000 items with the specified name. By default, if the stack already exists it will be reinitialized to an empty stack.
PROCEDURE destroy (stack_in IN VARCHAR2 := defstk);
Releases all memory associated with this stack.
5.24.3. Modifying stack contents
PROCEDURE push (item_in IN VARCHAR2, stack_in IN VARCHAR2 := defstk);
Pushes an item onto the specified stack.
PROCEDURE pop (value_out IN OUT VARCHAR2, stack_in IN VARCHAR2 := defstk, stack_type_in IN VARCHAR2 := lifo);Pops an item off the top (LIFO) or bottom (FIFO) of the stack.
5.24.4. Analyzing stack contents
FUNCTION nitems (stack_in IN VARCHAR2 := defstk) RETURN INTEGER;
Returns the number of items currently in the stack.
FUNCTION itemin (stack_in ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access