Kryptostack
|
Our own container adapter to build a stack. More...
#include <stack.h>
Public Member Functions | |
Stack () | |
CTor. | |
~Stack () | |
Dtor. | |
public_accessor size_t | getSize () const |
Returns the number of objects on the Stack. | |
SOp | at (size_t p_pos) |
Returns a copy of the SOp at the given position. More... | |
SOp | top () |
Returns a copy of the SOp of the top most position. More... | |
public_other void | pop () |
Removes the top most object from Stack, but the referenced SO will not be deleted. | |
SOp | top_pop () |
Returns a copy of the top SOp, removes the SOp from the Stack. More... | |
void | pop_delete () |
Removes the top most object from Stack, and the referenced SO will be deleted. | |
void | push (SOp p_s) |
Pushes the object onto the Stack and transfers ownership to the Stack. More... | |
void | push2 (SOp p_o1, SOp p_o2) |
Pushes the 2 objects onto the Stack and transfers ownership to the Stack. | |
void | push3 (SOp p_o1, SOp p_o2, SOp p_o3) |
Pushes the 3 objects onto the Stack and transfers ownership to the Stack. | |
void | push4 (SOp p_o1, SOp p_o2, SOp p_o3, SOp p_o4) |
Pushes the 4 objects onto the Stack and transfers ownership to the Stack. | |
bool | underflowcheck (size_t p_g) const |
Checks Stack against given size. | |
bool | otchecker (const string &p_s) |
Checks SO classes on operational stack against a string of given OTCodes. More... | |
bool | countto (size_t &p_retval, OTCode p_code) |
Count the objects on the Stack down to but excluding the object from the given type. More... | |
SOp | find (const SO *p_key) const |
Finds the given key within the whole stack, assuming a stack with dictionaries only. More... | |
__int128 | getI () |
I from Stack. More... | |
size_t | getISize_t () |
I from Stack as size_t. More... | |
Public Member Functions inherited from Counter< Stack > | |
Counter () | |
Ctor. | |
Private Attributes | |
deque< SOp > | q_ |
Internally the Stack is a STL deque<SOp>. | |
Additional Inherited Members | |
Static Public Member Functions inherited from Counter< Stack > | |
static int | getTotalCounter () |
Static getter for created objects. | |
static int | getAliveCounter () |
Static getter for objects alive. | |
Our own container adapter to build a stack.
It'a a stack of SOs. The bottom object has position 0. The top most object has position size-1.
|
inline |
Returns a copy of the SOp at the given position.
The Stack keeps ownership.
bool Stack::countto | ( | size_t & | p_retval, |
OTCode | p_code | ||
) |
Count the objects on the Stack down to but excluding the object from the given type.
Implemented without C++ polymorphisms.
[out] | p_retval | number of objects |
[in] | p_code | OTCode to find |
Finds the given key within the whole stack, assuming a stack with dictionaries only.
Equality is determined by SO::equal().
__int128 Stack::getI | ( | ) |
size_t Stack::getISize_t | ( | ) |
I from Stack as size_t.
Deletes the top object after reading its integer value. Exits with rangecheck, if the integer from stack can not be converted to size_t.
bool Stack::otchecker | ( | const string & | p_s | ) |
Checks SO classes on operational stack against a string of given OTCodes.
A character '.' in p_s matches all object types on the stack.
|
inline |
|
inline |
Returns a copy of the SOp of the top most position.
The Stack keeps ownership.
|
inline |
Returns a copy of the top SOp, removes the SOp from the Stack.
The returned SOp becomes the owner.