|
Leonardus
|
Semantic Object stacK. More...
#include <sok.h>
Inheritance diagram for SOK:
Collaboration diagram for SOK:Classes | |
| struct | SOKDeque |
| Semantic Object Stack - deque member class. More... | |
Public Member Functions | |
| SOK () | |
| Ctor. | |
| SOK (const SOcomposite &p_other) | |
| Ctor from parent class. | |
| SOK (const SOK &p_other) | |
| Copy ctor. | |
| ~SOK () override | |
| Dtor. | |
| SOK (SOK &&)=delete | |
| SOK & | operator= (const SOK &)=delete |
| SOK & | operator= (SOK &&)=delete |
| SOK * | dup () const override |
| Creates a new instance as copy following the red book definition. | |
| SOK * | clone () const override |
| Creates a new instance as copy with deep cloning. | |
| std::string | opequalequal () const override |
| String representation for operators '==' and 'pstack'. | |
| OTCode | ot () const override |
| Returns an OTCode. | |
| std::string | type () const override |
| Returns a type name. | |
| bool | equal (const SO *p_other) const override |
| Checks if this SO is equal to another SO. | |
| size_t | getSize () const override |
| Returns the size of the SO. | |
| size_t | treeheight (size_t p_myheight) const override |
| Tree Height. | |
| size_t | getWatermark () const |
| Returns the maximum size the stack has reached. | |
| SOp | ncat (size_t p_pos) const |
| Returns a copy of the SOp at the given position. | |
| SOp | peek () const |
| Returns a copy of the SOp of the top most position. | |
| void | putSO (size_t p_index, SOp p_sop) |
| Put a single SO into a stack object. | |
| SOp | pop () |
| Returns a copy of the top SOp, removes the SOp from the SOK. | |
| void | pop_delete () |
| Removes the top most object from SOK, and the referenced SO will be deleted. | |
| void | push (SOp p_o1) |
| Pushes the object onto the SOK and transfers ownership to the SOK. | |
| void | push (std::initializer_list< SOp > p_list) |
| Pushes n objects onto the SOK and transfers ownership to the SOK. | |
| void | push_front (SOp p_obj) |
| Pushes the object onto the front side of the SOK and transfers ownership to the SOK. | |
| bool | underflowcheck (size_t p_size) const |
| Checks SOK against given size. | |
| bool | otchecker (std::initializer_list< OTCode > p_list) const |
| Checks SO classes on the operand stack against a list of given OTCodes. | |
| bool | otchecker (OTCode p_code) const |
| Checks SO classes on the operand stack against an OTCode. | |
| bool | otcheckerOr (OTCode p_code1, OTCode p_code2) const |
| Checks SO class on the operand stack against two possible OTCodes. | |
| bool | countto (size_t &p_retval, OTCode p_code) const |
| Count the objects on the SOK down to but excluding the object from the given type. | |
| SOp | findValue (const SO *p_key) const |
| Finds the given key within the whole stack, assuming a stack with dictionaries only. | |
| SOp | findDict (const SO *p_key) const |
| Finds the dictionary storing the given key within the whole stack, assuming a stack with dictionaries only. | |
| __int128 | getI (OpError &p_ec) |
| I from SOK. | |
| __float128 | getR (OpError &p_ec) |
| R from SOK. | |
| __float128 | getIorRasR () |
| I or R from SOK as R Deletes the top object after reading its value. | |
| size_t | getISize_t (OpError &p_ec) |
| I from SOK as size_t. | |
Public Member Functions inherited from SOcomposite | |
| std::string | opequal () const override |
| String representation of object for operators '=', 'cvs' and 'stack'. | |
| SO () | |
| Ctor. | |
| SO (bool p_exec) | |
| Ctor. | |
| SO (const SO &p_other) | |
| Copy ctor. | |
| SO (SO &&)=delete | |
Public Member Functions inherited from SO | |
| SO () | |
| Ctor. | |
| SO (bool p_exec) | |
| Ctor. | |
| SO (const SO &p_other) | |
| Copy ctor. | |
| virtual | ~SO () |
| Virtual dtor. | |
| SO (SO &&)=delete | |
| SO & | operator= (const SO &)=delete |
| SO & | operator= (SO &&)=delete |
| bool | getExec () const |
| Getter for exec_. | |
| void | setExec (bool p_exec) |
| Setter for exec_. | |
| virtual bool | gt (OpError &p_ec, const SO *) const |
| Greater than. | |
| virtual bool | ge (OpError &p_ec, const SO *) const |
| Greater or equal. | |
Public Member Functions inherited from Counter< SO > | |
| Counter (Counter< SO > &&)=delete | |
| Counter< SO > & | operator= (const Counter< SO > &)=delete |
| Counter< SO > & | operator= (Counter< SO > &&)=delete |
Protected Member Functions | |
| bool | invariant () const noexcept override |
| Checks class invariants. | |
Protected Member Functions inherited from Counter< SO > | |
| Counter () | |
| Ctor. | |
| Counter (const Counter< SO > &) | |
| Copy ctor. | |
| ~Counter () | |
| Dtor. | |
Protected Member Functions inherited from DbC | |
| ~DbC ()=default | |
| Protected dtor. | |
Private Attributes | |
| std::shared_ptr< SOKDeque > | deque_ |
| The shared deque. | |
Additional Inherited Members | |
Static Public Member Functions inherited from Counter< SO > | |
| static size_t | getTotalCounter () |
| Static getter for totaly created objects. | |
| static size_t | getAliveCounter () |
| Static getter for objects alive. | |
| static size_t | getWatermarkCounter () |
| Static getter for the object counter watermark. | |
Semantic Object stacK.
Our own container adapter to std::deque to build a stack. It's a stack of pointers to SO. The bottom object has position 0. The top most object has position size-1.
|
inlineexplicit |
Ctor from parent class.
Only copies the SOcomposite part; the deque_ is initialized as empty.
| [in] | p_other | Parent class object. |
|
overridevirtual |
| bool SOK::countto | ( | size_t & | p_retval, |
| OTCode | p_code | ||
| ) | const |
Count the objects on the SOK 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. |
|
inlineoverridevirtual |
|
inlineoverridevirtual |
Checks if this SO is equal to another SO.
Equality means:
SOL und SOM are always equal.
For SOD, SOF and SOK, share_ptr<> points to the same object.
For SOA, share_ptr<> points to the same object, but empty arrays are equal nonetheless.
For SOO and SOo the function pointer must be the same.
Otherwise the value must be the same, even for SOS with shared_ptr<>.
| [in] | p_other | The object to compare with. |
Implements SO.
Finds the dictionary storing the given key within the whole stack, assuming a stack with dictionaries only.
Equality is determined by SO::equal().
We return a SOp instead of a SOD * to reduce coupling.
| [in] | p_key | The key to search for. |
Finds the given key within the whole stack, assuming a stack with dictionaries only.
Equality is determined by SO::equal().
| [in] | p_key | The key to search for. |
| __int128 SOK::getI | ( | OpError & | p_ec | ) |
I from SOK.
Deletes the top object after reading its integer value.
Checks the type of the operand stack object.
Does not check for stack underflow.
| [out] | p_ec | Success or error code. |
| __float128 SOK::getIorRasR | ( | ) |
I or R from SOK as R Deletes the top object after reading its value.
Does not check the type of the operand stack object.
Does not check for stack underflow.
| size_t SOK::getISize_t | ( | OpError & | p_ec | ) |
I from SOK 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.
Checks the type of the operand stack object.
Does not check for stack underflow.
| [out] | p_ec | Success or error code. |
| __float128 SOK::getR | ( | OpError & | p_ec | ) |
R from SOK.
Deletes the top object after reading its real value.
Checks the type of the operand stack object.
Does not check for stack underflow.
| [out] | p_ec | Success or error code. |
|
inlineoverridevirtual |
|
inline |
Returns the maximum size the stack has reached.
|
inlineoverrideprotectedvirtualnoexcept |
Checks class invariants.
Reimplemented from DbC.
|
inline |
|
overridevirtual |
String representation for operators '==' and 'pstack'.
This function attempts to produce a result that resembles the red book syntax
for creating the object.
Reimplemented from SO.
|
inlineoverridevirtual |
Returns an OTCode.
A "manual" implementation of polymorphism, where C++-polymorphisms fail
Implements SO.
|
inline |
| bool SOK::otchecker | ( | std::initializer_list< OTCode > | p_list | ) | const |
|
inline |
|
inline |
|
inline |
| void SOK::push | ( | SOp | p_o1 | ) |
| void SOK::push | ( | std::initializer_list< SOp > | p_list | ) |
| void SOK::push_front | ( | SOp | p_obj | ) |
Pushes the object onto the front side of the SOK and transfers ownership to the SOK.
This is a non-stack feature supporting the constructing of a SOK from the operand stack.
The SOK is now responsible for managing the object's lifetime.
| [in] | p_obj | ... Pointer to SO. |
|
inline |
|
overridevirtual |
Tree Height.
The composite semantic objects can contain other composite semantic objects.
This creates a tree of objects. treeheigth() calculates the height of this tree
starting at this.
Loops will be dedected by an heuristics. We stop the recursion if the heigth
exceeds maxtreeheight, a global constant in Leonardus.
| [in] | p_myheigth | Call with 0. Used internally for recursion. |
Reimplemented from SOcomposite.
|
inlineoverridevirtual |
|
inline |
Checks SOK against given size.
| [in] | p_size | Check value. |