Leonardus
Public Member Functions | Static Public Attributes | Protected Member Functions | Private Attributes | Static Private Attributes | List of all members
Context Class Reference

The context of execution. More...

#include <context.h>

+ Inheritance diagram for Context:
+ Collaboration diagram for Context:

Public Member Functions

 Context ()
 Ctor. More...
 
 Context (const Context &)=delete
 Delete the copy ctor.
 
 Context (Context &&)=delete
 Delete the move ctor.
 
Contextoperator= (const Context &)=delete
 Delete copy assignement.
 
Contextoperator= (Context &&)=delete
 Delete move assignement.
 
virtual ~Context ()
 Dtor. More...
 
SOKopst ()
 Access to the operand stack.
 
SOKexst ()
 Access to the execution stack.
 
SOKdist ()
 Access to the dictionary stack.
 
std::ostream & getCout ()
 Getter for cout_. More...
 
size_t getProclevel () const
 Getter for procedure level.
 
size_t getLoadlevel () const
 Getter for load level.
 
size_t getArraynesting () const
 Getter for nesting level.
 
size_t getMaxloadlevel () const
 Getter for maximum load level.
 
bool getInterpreterLoop () const
 Getter for interpreter loop control variable run_.
 
void stopInterpreterLoop ()
 Sets run_ to false.
 
void setSnapLeonline (const std::string &p_line)
 Setter for snapLeonline_.
 
size_t getRealprecision () const
 Getter for realprecision_.
 
void setRealprecision (size_t p_prec)
 Setter for realprecision_.
 
auto getAngularUnit () const
 Getter for angularunit_.
 
void setAngularUnit (AngularUnit p_unit)
 Setter for angularunit_.
 
uint32_t getSeed () const
 Getter for seed_.
 
void setSeed (uint32_t p_seed)
 Setter for seed_.
 
void incProclevel ()
 Increments the procedure level.
 
void decProclevel ()
 Decrements the procedure level.
 
void incLoadlevel ()
 Increments load level.
 
void decLoadlevel ()
 Decrements load level.
 
void incArraynesting ()
 Increments array nesting.
 
void decArraynesting ()
 Decrements array nesting.
 
void status_statistics ()
 Snapshot of Context state to cout. More...
 
void property_statistics ()
 Snapshot of Context properties to cout. More...
 
void stack_statistics ()
 Snapshot of stacks to cout. More...
 
- Public Member Functions inherited from Counter< Context >
 Counter (Counter< Context > &&)=delete
 
Counter< Context > & operator= (const Counter< Context > &)=delete
 
Counter< Context > & operator= (Counter< Context > &&)=delete
 

Static Public Attributes

static constexpr size_t mindictstack_ = 3
 Corresponds with the setup in the ctor.
 

Protected Member Functions

bool invariant () const noexcept override
 Checks class invariants. More...
 
- Protected Member Functions inherited from Counter< Context >
 Counter ()
 Ctor.
 
 Counter (const Counter< Context > &)
 Copy ctor.
 
 ~Counter ()
 Dtor.
 
virtual bool invariant () const noexcept
 Checks the invariants of the class in which it is defined. More...
 

Private Attributes

std::string snapLeonline_
 For debugging purposes a copy of the current leon-format line.
 
SOK os_
 The operand stack.
 
SOK es_
 The execution stack.
 
SOK ds_
 The dictionary stack.
 
bool run_ = true
 Control variable for the interpreter loop.
 
int proclevel_ = 0
 The process level is incremented for every '{' on input. More...
 
int loadlevel_ = 0
 The load level is incemented for ever load_exec() call. More...
 
int arraynesting_ = 0
 The nesting level is incemented for every array within an array for the bind operator. More...
 
AngularUnit angularunit_ = AngularUnit::DEG
 Context Property. More...
 
size_t realprecision_ = 10
 Context Property. More...
 
size_t maxloadlevel_ = 1000
 Context Property. More...
 
uint32_t seed_ = 0
 Context Property. More...
 

Static Private Attributes

static const std::map< const char *, core_t * > systemdictmap_
 Maps SON data to SOO data for the systemdict.
 
static const std::map< const char *, core_t * > leodictmap_
 Maps SON data to SOO data for the leodict. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from Counter< Context >
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

The context of execution.

Invariant
proclevel_ >= 0
loadlevel_ >= 0
arraynesting_ >= 0

Constructor & Destructor Documentation

◆ Context()

Context::Context ( )

Ctor.

Pushes and initializes a user dictionary, a leo dictionary, and a system dictionary onto the dictionary stack. Sets up empty stacks and all Context parameters.

Postcondition
mindictstack_ == ds_.getSize()

◆ ~Context()

Context::~Context ( )
virtual

Dtor.

Frees all resources to enable a comprehensive memory leak analysis upon program exit.

Member Function Documentation

◆ getCout()

std::ostream & Context::getCout ( )
inline

Getter for cout_.

We use the Interpreter stream until a split of streams for multiple Contexts will be implemented.

◆ invariant()

bool Context::invariant ( ) const
inlineoverrideprotectedvirtualnoexcept

Checks class invariants.

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

Reimplemented from DbC.

◆ property_statistics()

void Context::property_statistics ( )

Snapshot of Context properties to cout.


◆ stack_statistics()

void Context::stack_statistics ( )

Snapshot of stacks to cout.


◆ status_statistics()

void Context::status_statistics ( )

Snapshot of Context state to cout.


Member Data Documentation

◆ angularunit_

AngularUnit Context::angularunit_ = AngularUnit::DEG
private

Context Property.

The angular unit for trigonometric functions.

◆ arraynesting_

int Context::arraynesting_ = 0
private

The nesting level is incemented for every array within an array for the bind operator.

within the class it is an int and a size_t on the interface.

◆ leodictmap_

const std::map< const char *, core_t * > Context::leodictmap_
staticprivate
Initial value:
= {
{ "concat", &sox_concat },
{ "cvq", &sox_cvq },
{ "DEG", &sox_DEG },
{ "dictstack$", &sox_dictstack$ },
{ "divqr", &sox_divqr },
{ "__endstack", &sox___endstack }, { "$", &sox___endstack },
{ "execstack$", &sox_execstack$ },
{ "gcd", &sox_gcd }, { "ggT", &sox_gcd },
{ "index$", &sox_index$ },
{ "isunitfraction", &sox_isunitfraction },
{ "lcm", &sox_lcm }, { "kgV", &sox_lcm },
{ "nop", &sox_nop },
{ "pop$", &sox_pop$ },
{ "push$", &sox_push$ },
{ "RAD", &sox_RAD },
{ "reciprocal", &sox_reciprocal },
{ "turn", &sox_turn },
{ "xgcd", &sox_xgcd }, { "xggT", &sox_xgcd }
}
void sox_xgcd(Context &k)
Extension operator xgcd.
Definition: opext.cpp:423
void sox_dictstack$(Context &k)
Extension operator dictstack$.
Definition: opext.cpp:190
void sox_cvq(Context &k)
Extension operator cvq.
Definition: opext.cpp:102
void sox___endstack(Context &k)
Extension operator __endstack.
Definition: opext.cpp:203
void sox_isunitfraction(Context &k)
Extension operator isunitfraction.
Definition: opext.cpp:280
void sox_divqr(Context &k)
Extension operator divqr.
Definition: opext.cpp:165
void sox_concat(Context &k)
Extension operator concat.
Definition: opext.cpp:68
void sox_pop$(Context &k)
Extension operator pop$.
Definition: opext.cpp:328
void sox_RAD(Context &k)
Extension operator RAD.
Definition: opext.cpp:371
void sox_DEG(Context &k)
Extension operator DEG.
Definition: opext.cpp:148
void sox_reciprocal(Context &k)
Extension operator reciprocal.
Definition: opext.cpp:383
void sox_turn(Context &k)
Extension operator turn.
Definition: opext.cpp:403
void sox_lcm(Context &k)
Extension operator lcm.
Definition: opext.cpp:299
void sox_nop(Context &k)
Extension operator nop.
Definition: opext.cpp:316
void sox_execstack$(Context &k)
Extension operator execstack$.
Definition: opext.cpp:225
void sox_push$(Context &k)
Extension operator push$.
Definition: opext.cpp:349
void sox_gcd(Context &k)
Extension operator gcd.
Definition: opext.cpp:239
void sox_index$(Context &k)
Extension operator index$.
Definition: opext.cpp:257

Maps SON data to SOO data for the leodict.

◆ loadlevel_

int Context::loadlevel_ = 0
private

The load level is incemented for ever load_exec() call.

within the class it is an int and a size_t on the interface.

◆ maxloadlevel_

size_t Context::maxloadlevel_ = 1000
private

Context Property.

A maximum of nesting load of name objects.

◆ proclevel_

int Context::proclevel_ = 0
private

The process level is incremented for every '{' on input.

within the class it is an int and a size_t on the interface.

◆ realprecision_

size_t Context::realprecision_ = 10
private

Context Property.

Precison of printf() output of SOR values.

◆ seed_

uint32_t Context::seed_ = 0
private

Context Property.

A maximum of nesting load of name objects.


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