Mana
mana::Stack Class Referencefinal

#include <Stack.h>

Inheritance diagram for mana::Stack:
mana::Noncopyable

Public Member Functions

 Stack ()
 
 Stack (const Stack &)=delete
 
 Stack (Stack &&) noexcept=delete
 
Stackoperator= (const Stack &)=delete
 
Stackoperator= (Stack &&) noexcept=delete
 
 ~Stack ()=default
 
void Serialize (const std::shared_ptr< OutputStream > &stream) const
 
void Deserialize (const std::shared_ptr< OutputStream > &stream)
 
void Clear ()
 
void Duplicate ()
 
void Remove (const address_t size)
 
template<typename T >
void Push (T value)
 
void Push (const void *buffer, const address_t size)
 
template<typename T >
Pop ()
 
void PopData (void *buffer, const address_t size)
 
template<typename T >
Get (const address_t index) const
 
void * GetAddress (const address_t index) const
 
template<typename T >
void Set (const address_t index, T value)
 
address_t GetSize () const
 
void SetSize (const address_t size)
 
bool operator== (const Stack &other) const
 

Detailed Description

Stack memory for VM, allocating memory from the heap on each push; pop does not shrink the memory used.

Constructor & Destructor Documentation

◆ Stack() [1/3]

mana::Stack::Stack ( )
inline

◆ Stack() [2/3]

mana::Stack::Stack ( const Stack )
delete

◆ Stack() [3/3]

mana::Stack::Stack ( Stack &&  )
deletenoexcept

◆ ~Stack()

mana::Stack::~Stack ( )
default

Member Function Documentation

◆ Clear()

void mana::Stack::Clear ( )
inline

Set the size used to 0. No memory is released.

◆ Deserialize()

void mana::Stack::Deserialize ( const std::shared_ptr< OutputStream > &  stream)
inline

◆ Duplicate()

void mana::Stack::Duplicate ( )
inline

Duplicate the pushed value; if Data was pushed, the first 8 bytes (4 bytes in 32-bit environment) will be duplicated.

◆ Get()

template<typename T >
T mana::Stack::Get ( const address_t  index) const
inline

Get the value of the specified position.

Template Parameters
TSpecify the arithmetic or pointer type
Parameters
[in]indexPosition to get value
Returns
Value to pop

◆ GetAddress()

void * mana::Stack::GetAddress ( const address_t  index) const
inline

Get the address of the specified location.

Parameters
[in]indexPosition to get address
Returns
Address of stack

◆ GetSize()

address_t mana::Stack::GetSize ( ) const
inline

Get the size of the stack.

Returns
Stack Size

◆ operator=() [1/2]

Stack& mana::Stack::operator= ( const Stack )
delete

◆ operator=() [2/2]

Stack& mana::Stack::operator= ( Stack &&  )
deletenoexcept

◆ operator==()

bool mana::Stack::operator== ( const Stack other) const
inline

Compare stacks.

Parameters
[in]otherCompare Stacks
Returns
If true, same content

◆ Pop()

template<typename T >
T mana::Stack::Pop
inline

Pop value

Template Parameters
TSpecify the arithmetic or pointer type
Returns
Value to pop

◆ PopData()

void mana::Stack::PopData ( void *  buffer,
const address_t  size 
)
inline

Pop memory contents

Parameters
[in]bufferAddress to pop
[in]sizeSize to pop

◆ Push() [1/2]

void mana::Stack::Push ( const void *  buffer,
const address_t  size 
)
inline

Push memory contents

Parameters
[in]bufferAddress to push
[in]sizeSize to push

◆ Push() [2/2]

template<typename T >
void mana::Stack::Push ( value)
inline

Push value

Template Parameters
TSpecify the arithmetic or pointer type
Parameters
[in]valueValue to push

◆ Remove()

void mana::Stack::Remove ( const address_t  size)
inline

Shrink stack by specified size

Parameters
[in]sizesize to shrink

◆ Serialize()

void mana::Stack::Serialize ( const std::shared_ptr< OutputStream > &  stream) const
inline

◆ Set()

template<typename T >
void mana::Stack::Set ( const address_t  index,
value 
)
inline

Sets a value at the specified position

Template Parameters
TSpecify the arithmetic or pointer type
Parameters
[in]indexPosition to set address
[in]valueValue to set

◆ SetSize()

void mana::Stack::SetSize ( const address_t  size)
inline

Set the stack size. Do not specify a size larger than you have allocated.

Parameters
[in]sizeStack Size

The documentation for this class was generated from the following files: