|
Leonardus
|
Semantic Object Array. More...
#include <soa.h>
Inheritance diagram for SOA:
Collaboration diagram for SOA:Classes | |
| struct | SOAArray |
| Semantic Object Array - array member class. More... | |
Public Member Functions | |
| SOA (bool p_exec, size_t p_len=0) | |
| Ctor. | |
| SOA (const SOA &p_other) | |
| Copy ctor. | |
| ~SOA () override | |
| Dtor. | |
| SOA (SOA &&)=delete | |
| SOA & | operator= (const SOA &)=delete |
| SOA & | operator= (SOA &&)=delete |
| void | setSO (size_t p_index, SOp p_sop) |
| Setter for an array object. | |
| SOp | ncat (size_t p_pos) const |
| Returns a copy of the SOp at the given position. | |
| SOA * | dup () const override |
| Creates a new instance as copy following the red book definition. | |
| SOA * | 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_view | 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 | dagheight (size_t p_myheight) const override |
| DAG Height. | |
| auto | begin () const |
| Returns an iterator to the first SOp. | |
| auto | end () const |
| Returns an iterator to the marker at end of the vector of SOps. | |
| void | reduce () |
| Reduces the array by one SO at the end. | |
| void | unfold2exec (Context &k) const |
| Unfolds duplicates of the array-content to the execution stack. | |
| SOp | front_pop () |
| Returns a copy of the SOp at position 0 and removes this first position from the array. | |
| void | bind (Context &k) |
| Replaces executable names with operator objects recursively into elements that are SOA. | |
| int | findSubArray (const SOA *p_sub) |
| Searches for p_sub within this. | |
| void | substSubArray (size_t p_idx, size_t p_oldSize, const SOA *p_sub) |
| Substitute at index p_idx p_oldsize elements by p_sub. | |
Public Member Functions inherited from SOshptr | |
| std::string | opequal () const override |
| String representation of object for operators '=', 'cvs' and 'stack'. | |
| bool | equal (const SO *p_other) const override |
| Checks if this SO is equal to another SO. | |
| 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 ()=default |
| 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 | |
| void * | shptr () const override |
| Pointer to the shared object. | |
| bool | invariant () const noexcept override |
| Checks class invariants. | |
Protected Member Functions inherited from SOshptr | |
| 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< SOAArray > | vec_ |
| The shared array. | |
Additional Inherited Members | |
Static Public Member Functions inherited from SOcomposite | |
| static bool | otcodeIsComposite (OTCode p_code) |
| Checks if an OTCode represents a composite type (A, Ax, D, K). | |
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 Array.
SOA owns its objects.
|
explicit |
| void SOA::bind | ( | Context & | k | ) |
|
overridevirtual |
|
overridevirtual |
DAG Height.
The composite semantic objects can contain other composite semantic objects.
This creates a directed acyclic graph (DAG) of objects.
dagheight() calculates the height of this DAG starting at this.
Loops will be dedected by an heuristics. We stop the recursion if the heigth
exceeds DET_MAXDAGHEIGHT, a global constant in Leonardus.
| [in] | p_myheigth | Call with 0. Used internally for recursion. |
Implements SOcomposite.
|
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.
| int SOA::findSubArray | ( | const SOA * | p_sub | ) |
Searches for p_sub within this.
Uses equal for comparison of elements.
| [in] | p_sub | The array to look for. |
|
inline |
Returns a copy of the SOp at position 0 and removes this first position from the array.
Has an undefined result if size of vector is 0.
|
inlineoverridevirtual |
|
inlineoverrideprotectedvirtualnoexcept |
Checks class invariants.
Reimplemented from DbC.
|
inline |
Returns a copy of the SOp at the given position.
The arrays keeps ownership of the element.
| [in] | p_pos | The position, which is not checked. |
|
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.
| void SOA::reduce | ( | ) |
Reduces the array by one SO at the end.
The element will be deleted.
An empty array stays unchanged without an error condition.
|
inline |
|
inlineoverrideprotectedvirtual |
| void SOA::substSubArray | ( | size_t | p_idx, |
| size_t | p_oldSize, | ||
| const SOA * | p_sub | ||
| ) |
Substitute at index p_idx p_oldsize elements by p_sub.
The size of this->vec_ grows/shrinks/stay the same by (p_new->getSize()-p_oldsize). The replaced elements will be deleted. The member function setSO() is a special case. The new elements from p_sub are cloned.
| [in] | p_idx | The index starting with 0 of the old subarray. |
| [in] | p_oldSize | The size of the subarray which will be replaced. |
| [in] | p_sub | The array with the new elements. |
|
inlineoverridevirtual |
| void SOA::unfold2exec | ( | Context & | k | ) | const |
Unfolds duplicates of the array-content to the execution stack.
| [in,out] | k | The Context to use. |