ext/ containers/ stack.bi

Summary
ext/ containers/ stack.bi
LicenseCopyright © 2009, FreeBASIC Extended Library Development Group
fbext_StackMacro template that generates classes used to store element values of type T_ in a last-in first-out stack structure, using an object of type Container_(T_) to actually store the elements.
Functions
constructorConstructs an empty stack.
constructorConstructs a stack consisting of copies of the elements from the container object c.
SizeReturns the size of the Stack.
EmptyReturns ext.true if the stack contains zero elements, or ext.false otherwise.
TopReturns a pointer to the top-most element in the stack.
cTopReturns a pointer to the top-most element in the stack.
PushAdds an item onto the top of the stack.
PopRemoves the topmost item from the stack.

License

Copyright © 2009, FreeBASIC Extended Library Development Group

Distributed under the FreeBASIC Extended Library Group license.  See accompanying file LICENSE.txt or copy at http://code.google.com- /p- /fb-extended-lib- /wiki- /License

fbext_Stack

Macro template that generates classes used to store element values of type T_ in a last-in first-out stack structure, using an object of type Container_(T_) to actually store the elements.

Parameters

T_the type of element value stored in the stack.
Container_the name of the macro template used as the underlying container class.

The macro template Container_ must accept T_ as its first argument.  It also must support the following member procedures:

.Back( ) as T_ ptr
.cBack( ) as const T_ ptr
.PushBack( byref value as const T_ )
.PopBack( )

By default, Container_ is fbext Array, so the underlying container object is <fbext_Array(T_)>.

Summary
Functions
constructorConstructs an empty stack.
constructorConstructs a stack consisting of copies of the elements from the container object c.
SizeReturns the size of the Stack.
EmptyReturns ext.true if the stack contains zero elements, or ext.false otherwise.
TopReturns a pointer to the top-most element in the stack.
cTopReturns a pointer to the top-most element in the stack.
PushAdds an item onto the top of the stack.
PopRemoves the topmost item from the stack.

Functions

constructor

declare constructor ( )

Constructs an empty stack.

constructor

declare constructor (byref c as const fbext_TypeName(Container_)((T_)))

Constructs a stack consisting of copies of the elements from the container object c.

Parameters

ca container object to copy elements from.

Size

declare const function Size ( ) as ext.SizeType

Returns the size of the Stack.

Empty

declare const function Empty ( ) as ext.bool

Returns ext.true if the stack contains zero elements, or ext.false otherwise.

Top

declare function Top () as fbext_TypeName(T_) ptr

Returns a pointer to the top-most element in the stack.

cTop

declare const function cTop () as const fbext_TypeName(T_) ptr

Returns a pointer to the top-most element in the stack.

Push

declare sub Push (byref x as const fbext_TypeName(T_))

Adds an item onto the top of the stack.

Parameters

xthe item to add.

Pop

declare sub Pop ( )

Removes the topmost item from the stack.

declare constructor ( )
Constructs an empty stack.
declare const function Size ( ) as ext.SizeType
Returns the size of the Stack.
declare const function Empty ( ) as ext.bool
Returns ext.true if the stack contains zero elements, or ext.false otherwise.
-1
0
declare function Top () as fbext_TypeName(T_) ptr
Returns a pointer to the top-most element in the stack.
declare const function cTop () as const fbext_TypeName(T_) ptr
Returns a pointer to the top-most element in the stack.
declare sub Push (byref x as const fbext_TypeName(T_))
Adds an item onto the top of the stack.
declare sub Pop ( )
Removes the topmost item from the stack.