CCStack_T Class

class CCStack_T

A Collection Classes Stack that implements the First-In, First-Out method of storage. In addition, this stack can function as a circular buffer. Basically, when the stack reaches its maximum depth, the oldest element at the bottom of the stack is expired to make room for a new element. Use the SetMaxSize to setup the maximum depth.

Defined in: CollectMfc.h

Class Template Arguments

element_t

The class of the element to store in the stack.

arg_t

The class of the arguments to certain CArray functions.

Class Members

CCStack_T<element_t, arg_t>(SEC_INT nMaxSize)

This constructor creates a CCStack_T object initialized with the specified maximum depth

void SetMaxSize(SEC_INT nMaxSize)

Sets the maximum depth of the stack. Once this depth is reached, the stack "rolls"

SEC_INT GetElementCount() const

Returns the number of elements that currently exist in the stack

element_t Push(element_t elem)

Pushes a new element onto the stack

element_t Peek() const

Retrieves but does not delete the newest element off the top of the stack

element_t Pop()

Retrieves and deletes to newest element off the top of the stack

element_t GetElementAt(SEC_INT m_nIndex) const

Accessing elements