Kryptostack
All Classes Namespaces Files Functions Variables Typedefs Enumerations Macros Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
SOO Class Reference

Semantic Object Operator. More...

#include <sosimp.h>

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

Public Member Functions

 SOO (void(*const p_fun)(Context &), const char *p_str)
 Ctor.
 
SOOdup () const override
 Creates a new instance as copy following the red book definition. More...
 
std::string opequal () const override
 For operators '=', 'cvs' and 'stack'. More...
 
OTCode ot () const override
 Returns an OTCode. More...
 
std::string type () const override
 Returns a type name. More...
 
bool equal (const SO *p_other) const override
 Equality. More...
 
void exec (Context &k) const
 Call the core code.
 
- Public Member Functions inherited from SO
 SO (bool p_exec=false)
 Ctor.
 
virtual ~SO ()=default
 Virtual dtor. More...
 
bool getExec () const
 Getter for exec_.
 
void setExec (bool p_exec)
 Setter for exec_.
 
virtual size_t getSize () const
 Getter for the number of characters or number of objects. More...
 
virtual SOdup () const =0
 Creates a new instance as copy following the red book definition. More...
 
virtual SOclone () const
 Creates a new instance as copy with deep cloning. More...
 
virtual std::string opequal () const =0
 For operators '=', 'cvs' and 'stack'. More...
 
virtual std::string opequalequal () const
 For operators '==' and 'pstack'. More...
 
virtual OTCode ot () const =0
 Returns an OTCode. More...
 
virtual std::string type () const =0
 Returns a type name. More...
 
virtual bool equal (const SO *) const =0
 Equality. More...
 
virtual bool gt (const SO *) const
 Greater than. More...
 
virtual bool ge (const SO *) const
 Greater or equal. More...
 
- Public Member Functions inherited from Counter< SO >
 Counter (Counter< SO > &&)=delete
 
Counter< SO > & operator= (const Counter< SO > &)=delete
 
Counter< SO > & operator= (Counter< SO > &&)=delete
 

Private Member Functions

bool invariant () const noexcept override
 Checks class invariants. More...
 

Private Attributes

void(*const core_ )(Context &)
 The core code, a C++ implementation of the operator.
 
const char *const srep_
 A name just for representation. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from Counter< SO >
static int getTotalCounter ()
 Static getter for totaly created objects.
 
static int getAliveCounter ()
 Static getter for objects alive.
 
static int getWatermarkCounter ()
 Static getter for the object counter watermark.
 
- Protected Member Functions inherited from Counter< SO >
 Counter ()
 Ctor.
 
 Counter (const Counter< SO > &)
 Copy ctor.
 
 ~Counter ()
 Dtor.
 
virtual bool invariant () const noexcept
 Checks the invariants of the class in which it is defined. More...
 

Detailed Description

Semantic Object Operator.

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

Invariant
core_ != nullptr
srep_ != nullptr
*srep_ != 0

Member Function Documentation

◆ dup()

SOO * SOO::dup ( ) const
inlineoverridevirtual

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

Implements SO.

◆ equal()

bool SOO::equal ( const SO ) const
inlineoverridevirtual

Equality.

Equality means: SOL und SOM are always equal.
For SOD 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

Implements SO.

◆ invariant()

bool SOO::invariant ( ) const
inlineoverrideprivatevirtualnoexcept

Checks class invariants.

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

Reimplemented from DbC.

◆ opequal()

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

For operators '=', 'cvs' and 'stack'.

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

◆ type()

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

Returns a type name.

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

Implements SO.

Member Data Documentation

◆ srep_

const char* const SOO::srep_
private

A name just for representation.

We aren't the owner.


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