Leonardus
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Attributes | List of all members
SOO Class Reference

Semantic Object core code Operator. More...

#include <sosimp.h>

+ Inheritance diagram for SOO:
+ Collaboration diagram for SOO:

Public Member Functions

 SOO (core_t *p_fun)
 Ctor.
 
 ~SOO () override
 Dtor.
 
 SOO (const SOO &)=delete
 
 SOO (SOO &&)=delete
 
SOO & operator= (const SOO &)=delete
 
SOO & operator= (SOO &&)=delete
 
SOO * dup () const override
 Creates a new instance as copy following the red book definition.
 
std::string opequal () const override
 String representation of object for operators '=', 'cvs' and 'stack'.
 
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.
 
void exec (Context &k) const
 Call the core code.
 
- 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 size_t getSize () const
 Returns the size of the SO.
 
virtual SO * clone () const
 Creates a new instance as copy with deep cloning.
 
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
 

Static Public Member Functions

static bool otcodeIsCoreCode (OTCode p_code)
 Checks if an OTCode represents a core code operator type (O or o).
 
- 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.
 

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

core_t *const core_
 The core code, a C++ implementation of the operator.
 

Detailed Description

Semantic Object core code Operator.

The operator object links to the core code of an operator.
These objects are generated as values in the dictionaries systemdict and leodict of the startup configuration of the interpreter.

Invariant
core_ != nullptr
core_ is entry in Registry

Constructor & Destructor Documentation

◆ SOO()

SOO::SOO ( core_t *  p_fun)
inlineexplicit

Ctor.

Precondition
p_fun is entry in Registry
Parameters
[in]p_funA function pointer to the core code.

Member Function Documentation

◆ dup()

SOO * SOO::dup ( ) const
inlineoverridevirtual

Creates a new instance as copy following the red book definition.

Returns
SO * ... A copy.

Implements SO.

◆ equal()

bool SOO::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<>.

Precondition
parameter != nullptr
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_otherThe object to compare with.

Implements SO.

◆ exec()

void SOO::exec ( Context &  k) const
inline

Call the core code.

Parameters
[in,out]kThe context to use.

◆ invariant()

bool SOO::invariant ( ) const
inlineoverrideprotectedvirtualnoexcept

Checks class invariants.

Returns
bool ... Indicates whether the class invariants are maintained.

Reimplemented from DbC.

◆ opequal()

std::string SOO::opequal ( ) const
inlineoverridevirtual

String representation of object for operators '=', 'cvs' and 'stack'.

Returns
std::string ... The representation.

Implements SO.

◆ opequalequal()

std::string SOO::opequalequal ( ) const
inlineoverridevirtual

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()

OTCode SOO::ot ( ) const
inlineoverridevirtual

Returns an OTCode.

A "manual" implementation of polymorphism, where C++-polymorphisms fail

Returns
OTCode ... The OTCode of the instance.

Implements SO.

Reimplemented in SOo.

◆ otcodeIsCoreCode()

static bool SOO::otcodeIsCoreCode ( OTCode  p_code)
inlinestatic

Checks if an OTCode represents a core code operator type (O or o).

Parameters
[in]p_codeThe OTCode to check.
Returns
bool ... true, if the OTCode represents a core code operator type, otherwise false.

◆ type()

std::string_view SOO::type ( ) const
inlineoverridevirtual

Returns a type name.

Returns
std::string_view ... The type name of the instance.

Implements SO.


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