Kryptostack
Public Member Functions | Private Attributes | List of all members
Stack Class Reference

Our own container adapter to build a stack. More...

#include <stack.h>

Inheritance diagram for Stack:
Inheritance graph
[legend]
Collaboration diagram for Stack:
Collaboration graph
[legend]

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< SOpq_
 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.
 

Detailed Description

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.

Member Function Documentation

◆ at()

SOp Stack::at ( size_t  p_pos)
inline

Returns a copy of the SOp at the given position.

The Stack keeps ownership.

◆ countto()

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.

Returns
bool ... true if the given OTCode can be found
Parameters
[out]p_retvalnumber of objects
[in]p_codeOTCode to find

◆ find()

SOp Stack::find ( const SO p_key) const

Finds the given key within the whole stack, assuming a stack with dictionaries only.

Equality is determined by SO::equal().

Returns
SOp ... points to the found value, the ownership stays within the dictionary. returns nullpointer if key cann't be found.'

◆ getI()

__int128 Stack::getI ( )

I from Stack.

Deletes the top object after reading its integer value.

Note
IDEA: Stack should not know much about its objects! E.g. Migration to a implementation as friend to separate details.

◆ getISize_t()

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.

◆ otchecker()

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.

◆ push()

void Stack::push ( SOp  p_s)
inline

Pushes the object onto the Stack and transfers ownership to the Stack.

The Stack is now responsible for managing the object's lifetime.

◆ top()

SOp Stack::top ( )
inline

Returns a copy of the SOp of the top most position.

The Stack keeps ownership.

◆ top_pop()

SOp Stack::top_pop ( )
inline

Returns a copy of the top SOp, removes the SOp from the Stack.

The returned SOp becomes the owner.


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