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

Semantic Object Real. More...

#include <sosimp.h>

+ Inheritance diagram for SOR:
+ Collaboration diagram for SOR:

Public Member Functions

 SOR (const std::string &p_s)
 Ctor from a string representation.
 
 SOR (__float128 p_r)
 Ctor from a float.
 
 ~SOR () override=default
 Dtor.
 
 SOR (const SOR &)=delete
 
 SOR (SOR &&)=delete
 
SOR & operator= (const SOR &)=delete
 
SOR & operator= (SOR &&)=delete
 
__float128 getReal () const
 Getter for real value.
 
bool setReal (__float128 p_r)
 Setter for real value.
 
SOR * 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'. Reals are formated for output with a default precision of 10 digits.
 
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.
 
bool gt (OpError &p_ec, const SO *p_other) const override
 Greater than.
 
bool ge (OpError &p_ec, const SO *p_other) const override
 Greater or equal.
 
void half__1 ()
 In place half value.
 
OpError sqr__1 ()
 In place square.
 
void trunc__1 ()
 In place trunc().
 
void ceil__1 ()
 In place ceil().
 
void floor__1 ()
 In place floor().
 
OpError reciprocal__1 ()
 In place reciprocal.
 
- 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 std::string opequalequal () const
 String representation for operators '==' and 'pstack'.
 
- 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

__float128 r_
 The real value as decimal number.
 

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.
 

Detailed Description

Semantic Object Real.

A real number as a quad-precision floating-point number adhering to the IEEE 754-2008 standard,
featuring a 112-bit significand and a 15-bit exponent.
This format offers at least 33 bits of precision.

Invariant
r_ is neighter +-Inf nor NaN.

Constructor & Destructor Documentation

◆ SOR() [1/2]

SOR::SOR ( const std::string &  p_s)
inlineexplicit

Ctor from a string representation.

Precondition
p_s format is a valid IEEE 128 bit float.
Parameters
[in]p_sThe string to parse as float.

◆ SOR() [2/2]

SOR::SOR ( __float128  p_r)
inlineexplicit

Ctor from a float.

Parameters
[in]p_rThe float.

Member Function Documentation

◆ dup()

SOR * SOR::dup ( ) const
inlineoverridevirtual

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

Returns
SO * ... A copy.

Implements SO.

◆ equal()

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

◆ ge()

bool SOR::ge ( OpError &  p_ec,
const SO *  p_other 
) const
inlineoverridevirtual

Greater or equal.

The redundancy between equal(), gt() and ge() is a matter of performance.

Parameters
[out]p_ecError code.
Returns
bool ... true is comparable and ge.
Precondition
p_other != nullptr
Parameters
[in]p_otherThe object to compare with.

Reimplemented from SO.

◆ gt()

bool SOR::gt ( OpError &  p_ec,
const SO *  p_other 
) const
inlineoverridevirtual

Greater than.

The redundancy between equal(), gt() and ge() is a matter of performance.

Parameters
[out]p_ecError code.
Returns
bool ... true is comparable and gt.
Precondition
p_other != nullptr
Parameters
[in]p_otherThe object to compare with.

Reimplemented from SO.

◆ invariant()

bool SOR::invariant ( ) const
inlineoverrideprotectedvirtualnoexcept

Checks class invariants.

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

Reimplemented from DbC.

◆ opequal()

std::string SOR::opequal ( ) const
overridevirtual

String representation of object for operators '=', 'cvs' and 'stack'. Reals are formated for output with a default precision of 10 digits.


The precision can be changed with the operator __rprecision.

Returns
std::string ... String representation of the real value.

Implements SO.

◆ ot()

OTCode SOR::ot ( ) const
inlineoverridevirtual

Returns an OTCode.

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

Returns
OTCode ... The OTCode of the instance.

Implements SO.

◆ reciprocal__1()

OpError SOR::reciprocal__1 ( )
inline

In place reciprocal.

Returns
OpError ...
- OpError::undefinedresult for real numbers too small to have a reciprocal.
- OpError::success otherwise.

◆ setReal()

bool SOR::setReal ( __float128  p_r)
inline

Setter for real value.

Parameters
[in]p_rThe new float value.
Returns
bool ... true, if and only if p_r is neigther +-Inf nor NaN.

◆ sqr__1()

OpError SOR::sqr__1 ( )
inline

In place square.

Returns
OpError ... undefinedresult for r_^2 > maximum __float128, success otherwise

◆ type()

std::string_view SOR::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 files: