Public Types |
Public Member Functions |
Private Member Functions |
Private Attributes |
List of all members
mn::container::basic_stack< TType > Class Template Reference
#include <mn_stack.hpp>
Public Types | |
using | basic_type_t = TType |
Public Member Functions | |
basic_stack (size_t nSize) | |
basic_stack (size_t nSize, basic_type_t *addr) | |
basic_stack (size_t nSize, basic_type_t *addr, int offset) | |
int | push (basic_type_t item) |
int | pop (basic_type_t *item) |
int | peek (basic_type_t *item) |
void | reset () |
int | count () |
int | size () |
bool | is_empty () |
bool | is_full () |
int | get_left () |
Private Member Functions | |
void | internal_create (size_t nSize, basic_type_t *addr, int offset) |
void | internal_reset () |
Private Attributes | |
basic_type_t * | m_ulAdrr |
size_t | m_ulSize |
size_t | m_iFirst |
size_t | m_iLast |
size_t | m_iCurrent |
Detailed Description
template<typename TType>
class mn::container::basic_stack< TType >
A simple template for a Stack
Member Typedef Documentation
◆ basic_type_t
template<typename TType >
using mn::container::basic_stack< TType >::basic_type_t = TType |
Constructor & Destructor Documentation
◆ basic_stack() [1/3]
template<typename TType >
|
inlineexplicit |
This constructor use malloc to create the buffer
- Parameters
-
nSize The size of the stack
◆ basic_stack() [2/3]
template<typename TType >
|
inline |
This constructor use a given address as buffer
- Parameters
-
nSize The size of the stack (The last position [addr+(nSize)] ) addr The first buffer or adress to use as stack
◆ basic_stack() [3/3]
template<typename TType >
|
inline |
This constructor use a given address as buffer
- Parameters
-
nSize The size of the stack (The last position [addr+(nSize)] ) addr The first buffer or adress to use as stack offset The offset, when start position in the buffer not address 0 is
Member Function Documentation
◆ count()
template<typename TType >
|
inline |
Get the count of the stack
- Returns
- The count of the stack
◆ get_left()
template<typename TType >
|
inline |
How many empty spaves are currently left in the stack.
◆ internal_create()
template<typename TType >
|
inlineprivate |
the internal creating function for the stack
- Parameters
-
nSize The size of the stack (The last position [addr+(nSize)] ) addr The first buffer or adress to use as stack offset The offset, when start position in the buffer not address 0 is
◆ internal_reset()
template<typename TType >
|
inlineprivate |
The internal reset function
◆ is_empty()
template<typename TType >
|
inline |
Is the stack empty?
- Returns
- true the stack is empty and false when not
◆ is_full()
template<typename TType >
|
inline |
Is the stack full?
- Returns
- true the stack is full and false when not
◆ peek()
template<typename TType >
|
inline |
get the current obj from the stack, this will not remove it
- Parameters
-
item Where the item you are getting will be returned to.
- Returns
- - NO_ERROR the item was removed
- ERR_NULL the given item was null
- ERR_MNTHREAD_UNKN the stack is empty
◆ pop()
template<typename TType >
|
inline |
Pop an item from the stack
- Parameters
-
item Where the item you are removing will be returned to.
- Returns
- - NO_ERROR the item was removed
- ERR_NULL the given item was null
- ERR_MNTHREAD_UNKN the stack is empty
◆ push()
template<typename TType >
|
inline |
Add an item to the stack
- Parameters
-
item The item you are adding.
- Returns
- - NO_ERROR the item was added
- ERR_MNTHREAD_UNKN the stack is full
◆ reset()
template<typename TType >
|
inline |
Reset the stack, will remove all objects in the stack
◆ size()
template<typename TType >
|
inline |
Get the size of the stack
- Returns
- The size of the stack.
Member Data Documentation
◆ m_iCurrent
template<typename TType >
|
private |
◆ m_iFirst
template<typename TType >
|
private |
◆ m_iLast
template<typename TType >
|
private |
◆ m_ulAdrr
template<typename TType >
|
private |
◆ m_ulSize
template<typename TType >
|
private |
The documentation for this class was generated from the following file: