Semantic Object Dictionary.
More...
#include <sod.h>
|
| struct | SODMap |
| | Semantic Object Dictionary - map member class. More...
|
| |
|
|
| SOD () |
| | Ctor.
|
| |
| | SOD (const SOcomposite &p_other) |
| | Ctor from parent class object.
|
| |
|
| SOD (const SOD &p_other) |
| | Copy ctor.
|
| |
|
| ~SOD () override |
| | Dtor.
|
| |
|
| SOD (SOD &&)=delete |
| |
|
SOD & | operator= (const SOD &)=delete |
| |
|
SOD & | operator= (SOD &&)=delete |
| |
| SOD * | dup () const override |
| | Creates a new instance as copy following the red book definition.
|
| |
| SOD * | 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.
|
| |
|
auto | begin () |
| | Returns an iterator to the begin of the map of two SOps.
|
| |
|
auto | end () |
| | Returns an iterator to the marker at end of the map of two SOps.
|
| |
| void | insert (SOp p_key, SOp p_value, bool p_forcebegin=false) |
| | Insert with the red book definition of equal.
|
| |
| SOp | find (const SO *p_key) const |
| | Searches for p_key in the dictionary.
|
| |
| auto | any_pop () |
| | Returns a pair from the dictionary.
|
| |
| void | undef (const SO *p_key) |
| | Removes both p_key and its value from the dictionary.
|
| |
| 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 |
| |
|
| 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.
|
| |
|
| Counter (Counter< SO > &&)=delete |
| |
|
Counter< SO > & | operator= (const Counter< SO > &)=delete |
| |
|
Counter< SO > & | operator= (Counter< SO > &&)=delete |
| |
|
| bool | invariant () const noexcept override |
| | Checks class invariants.
|
| |
|
| Counter () |
| | Ctor.
|
| |
|
| Counter (const Counter< SO > &) |
| | Copy ctor.
|
| |
|
| ~Counter () |
| | Dtor.
|
| |
|
| ~DbC ()=default |
| | Protected dtor.
|
| |
|
|
std::shared_ptr< SODMap > | map_ |
| | The shared dictionary.
|
| |
|
|
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 Dictionary.
- Invariant
- map_ never is null.
-
map_.stlmap_ elements are never null
◆ SOD()
Ctor from parent class object.
- Parameters
-
| [in] | p_other | We construct as copy from this parent class object. |
◆ any_pop()
Returns a pair from the dictionary.
The pair is removed from the dictionary.
- Precondition
- getSize() > 0
- Returns
- std::pair<const SOp, SOp> ... from the SOD
◆ clone()
| SOD * SOD::clone |
( |
| ) |
const |
|
overridevirtual |
Creates a new instance as copy with deep cloning.
Default implementation falls back to dup().
Subclasses must override this if deep cloning is required.
- Returns
- SO * ... A deep copy.
- Postcondition
- return value != nullptr
-
return value maintains invariants
Reimplemented from SO.
◆ dup()
Creates a new instance as copy following the red book definition.
- Returns
- SO * ... A copy.
Implements SO.
◆ equal()
| bool SOD::equal |
( |
const SO * |
p_other | ) |
const |
|
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<>.
- Returns
- bool ... true if the SO's are of the same type and equal
- See also
- Will be used directly and unchanged as operator eq
- Parameters
-
| [in] | p_other | The object to compare with. |
Implements SO.
◆ find()
| SOp SOD::find |
( |
const SO * |
p_key | ) |
const |
Searches for p_key in the dictionary.
Equality is defined by SO::equal().
- Precondition
- p_key != nullptr
- Parameters
-
- Returns
- SOp ... a SOp to the value, the ownership stays within the dictionary; a nullptr if not found
◆ getSize()
| size_t SOD::getSize |
( |
| ) |
const |
|
inlineoverridevirtual |
Returns the size of the SO.
Default implementation returns 1 (for simple objects).
Override in subclasses to return the actual size (e.g., length of a string, number of elements in a composite).
Reimplemented from SO.
◆ insert()
| void SOD::insert |
( |
SOp |
p_key, |
|
|
SOp |
p_value, |
|
|
bool |
p_forcebegin = false |
|
) |
| |
Insert with the red book definition of equal.
The SOD takes ownership. If the key is found in the dictionary,
then this existing key and the corresponding value will be deleted.
- Precondition
- p_key != nullptr and p_value != nullptr.
- Parameters
-
| [in] | p_key | Key. |
| [in] | p_value | Value. |
| [in] | p_forcebegin | This parameter forces the insertion of the key-value pair at the beginning of the dictionary. |
◆ invariant()
| bool SOD::invariant |
( |
| ) |
const |
|
inlineoverrideprotectedvirtualnoexcept |
Checks class invariants.
- Returns
- bool ... Indicates whether the class invariants are maintained.
Reimplemented from DbC.
◆ opequalequal()
| string SOD::opequalequal |
( |
| ) |
const |
|
overridevirtual |
String representation for operators '==' and 'pstack'.
This function attempts to produce a result that resembles the red book syntax
for creating the object.
- Returns
- std::string ... The representation.
Reimplemented from SO.
◆ ot()
Returns an OTCode.
A "manual" implementation of polymorphism, where C++-polymorphisms fail
- Returns
- OTCode ... The OTCode of the instance.
Implements SO.
◆ treeheight()
| size_t SOD::treeheight |
( |
size_t |
p_myheigth | ) |
const |
|
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.
- Parameters
-
| [in] | p_myheigth | Call with 0. Used internally for recursion. |
- Returns
- size_t ... The maximum height of the tree of SOcomposite -or- maxtreeheight if there is a loop.
Reimplemented from SOcomposite.
◆ type()
| std::string SOD::type |
( |
| ) |
const |
|
inlineoverridevirtual |
Returns a type name.
- Returns
- std::string ... The type name of the instance.
Implements SO.
◆ undef()
| void SOD::undef |
( |
const SO * |
p_key | ) |
|
Removes both p_key and its value from the dictionary.
Equality is defined by SO::equal(). Doesn't generate a error if p_key can not be found.
- Precondition
- p_key != nullptr
- Parameters
-
The documentation for this class was generated from the following files: