containers/ queue.bi

Summary
containers/ queue.bi
LicenseCopyright © 2009, FreeBASIC Extended Library Development Group
ext
fbext_Queue((T_)(Container_))Macro template that generates classes used to store element values of type T_ in a first-in first-out queue structure, using an object of type fbext_TypeName(Container_)(T_) to actually store the elements.
Functions
default constructorConstructs an empty queue.
constructorConstructs a queue consisting of copies of the elements from the container object c.
SizeReturns the size of the queue.
EmptyReturns ext.true if the queue contains zero elements, or ext.false otherwise.
FrontReturns a pointer to the first element in the queue.
cFrontReturns a pointer to the first element in the queue.
BackReturns a pointer to the last element in the queue.
cBackReturns a pointer to the last element in the queue.
PushAdds an item onto the back of the queue.
PopRemoves the first element in the queue.

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

ext

fbext_Queue((T_)(Container_))

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

Parameters

T_the type of element value stored in the queue.
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:

  • .Front( ) as T_ ptr
  • .cFront( ) as const T_ ptr
  • .Back( ) as T_ ptr
  • .cBack( ) as const T_ ptr
  • .PushBack( byref value as const T_ )
  • .PopFront( )

By default, Container_ is fbext_List.

Summary
Functions
default constructorConstructs an empty queue.
constructorConstructs a queue consisting of copies of the elements from the container object c.
SizeReturns the size of the queue.
EmptyReturns ext.true if the queue contains zero elements, or ext.false otherwise.
FrontReturns a pointer to the first element in the queue.
cFrontReturns a pointer to the first element in the queue.
BackReturns a pointer to the last element in the queue.
cBackReturns a pointer to the last element in the queue.
PushAdds an item onto the back of the queue.
PopRemoves the first element in the queue.

Functions

default constructor

Constructs an empty queue.

constructor

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

Constructs a queue 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 queue.

Empty

declare const function Empty ( ) as ext.bool

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

Front

declare function Front () as fbext_TypeName(T_) ptr

Returns a pointer to the first element in the queue.

cFront

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

Returns a pointer to the first element in the queue.

Back

declare function Back () as fbext_TypeName(T_) ptr

Returns a pointer to the last element in the queue.

cBack

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

Returns a pointer to the last element in the queue.

Push

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

Adds an item onto the back of the queue.

Parameters

xthe item to add.

Pop

declare sub Pop ( )

Removes the first element in the queue.

declare constructor (byref c as const fbext_TypeName(Container_)((T_)))
Constructs a queue consisting of copies of the elements from the container object c.
declare const function Size ( ) as ext.SizeType
Returns the size of the queue.
declare const function Empty ( ) as ext.bool
Returns ext.true if the queue contains zero elements, or ext.false otherwise.
-1
0
declare function Front () as fbext_TypeName(T_) ptr
Returns a pointer to the first element in the queue.
declare const function cFront () as const fbext_TypeName(T_) ptr
Returns a pointer to the first element in the queue.
declare function Back () as fbext_TypeName(T_) ptr
Returns a pointer to the last element in the queue.
declare const function cBack () as const fbext_TypeName(T_) ptr
Returns a pointer to the last element in the queue.
declare sub Push (byref x as const fbext_TypeName(T_))
Adds an item onto the back of the queue.
declare sub Pop ( )
Removes the first element in the queue.