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

Interpreter status. More...

#include <interpreter.h>

+ Inheritance diagram for Interpreter:
+ Collaboration diagram for Interpreter:

Classes

struct  PimplTime
 Pointer to Implementation for Time. More...
 

Public Member Functions

 Interpreter (const Interpreter &)=delete
 Delete the copy ctor.
 
 Interpreter (Interpreter &&)=delete
 Delete the move ctor.
 
Interpreteroperator= (const Interpreter &)=delete
 Delete copy assignement.
 
Interpreteroperator= (Interpreter &&)=delete
 Delete move assignement.
 
bool getVerbose () const
 Getter for verbose mode.
 
void setContext (Context *p_c)
 Setter for current context.
 
__int128 getClockStart () const
 Getter for clock start. More...
 
void setOdo (bool p_odo)
 Setter for odo_.
 
bool getOdo () const
 Getter for odo_.
 
size_t getOdoIterations () const
 Getter for odo_iterations_.
 
size_t getMaxopeelevel () const
 Getter for maximum opee level.
 
std::ostream & getCout ()
 Getter for cout_.
 
void leonline (std::string &p_line, Context &k)
 Processes one line of the leon-format input. More...
 
bool getLine (std::string &p_line) const
 Wrapper around getline to hide input stream. More...
 
void commandline (int p_argc, char *p_argv[])
 Command line parsing. More...
 
void property_statistics ()
 Dumps property statistical data.
 
void status_statistics ()
 Dumps various status statistical data.
 
void snap ()
 Snapshot of complete Interpreter and Context statistics to Interpreter-cout.
 

Static Public Member Functions

static auto get ()
 Get the singleton pointer. More...
 
static ContextgetContext ()
 Get the current context.
 
static void addchanges (size_t p_allchanges)
 Add p_allchanges to odo_changes_ counter.
 
static void shutdown ()
 Shut down. More...
 
static void memory_statistics (bool p_force, std::ostream &p_cout)
 Dumps memory statistical data. More...
 

Protected Member Functions

bool invariant () const noexcept override
 Checks class invariants. More...
 
virtual bool invariant () const noexcept
 Checks the invariants of the class in which it is defined. More...
 

Private Member Functions

 Interpreter ()
 Private ctor.
 
virtual ~Interpreter ()
 Private dtor. More...
 
void help ()
 Command line help text.
 

Static Private Member Functions

static std::string strEscape (const std::string &p_s)
 Substitutes double backslashes by single backslashes and sequences backslash + 'n' by the ASCII CR code.
 

Private Attributes

Contextcurctx_ {}
 Access to the current Context. More...
 
LineSourcelinesource_ {}
 Read from cin or from file. More...
 
PimplTimepimpltime_
 Pointer to implemenation of time functions - opaque pointer.
 
size_t odo_changes_ = 0
 Number of changes applied by odo.
 
bool verbose_ = false
 Interpreter Property. More...
 
bool odo_ = false
 Interpreter Property. More...
 
std::ostream cout_ { std::cout.rdbuf() }
 Interpreter Property. More...
 
size_t odo_iterations_ = 10
 Interpreter Property. More...
 
size_t maxopeelevel_ = 2
 Interpreter Property. More...
 

Static Private Attributes

static Interpreterinstance_ = nullptr
 Pointer to the singleton instance or a nullptr.
 

Detailed Description

Interpreter status.

Invariant
Singleton.
pimpltime_ is not null

Constructor & Destructor Documentation

◆ ~Interpreter()

Interpreter::~Interpreter ( )
privatevirtual

Private dtor.

It's virtual, because DbC has a virtual bool invariant() member.

Member Function Documentation

◆ commandline()

void Interpreter::commandline ( int  p_argc,
char *  p_argv[] 
)

Command line parsing.

exit() in case of command line issues or after printing the help text.

◆ get()

static auto Interpreter::get ( )
inlinestatic

Get the singleton pointer.

Postcondition
return value != nullptr

◆ getClockStart()

__int128 Interpreter::getClockStart ( ) const

Getter for clock start.

Hides implementation with a struct PimplTime.

◆ getLine()

bool Interpreter::getLine ( std::string &  p_line) const

Wrapper around getline to hide input stream.

Precondition
linesource != nullptr

◆ invariant()

bool Interpreter::invariant ( ) const
inlineoverrideprotectedvirtualnoexcept

Checks class invariants.

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

Reimplemented from DbC.

◆ leonline()

void Interpreter::leonline ( std::string &  p_line,
Context k 
)

Processes one line of the leon-format input.

Executable names outside of procedures and '{', '}' are pushed onto the execution stack. Everything else is pushed onto the operand stack.

◆ memory_statistics()

void Interpreter::memory_statistics ( bool  p_force,
std::ostream &  p_cout 
)
static

Dumps memory statistical data.

Dumps it if and only if (i) there are open memory allocations or (ii) p_force is true

◆ shutdown()

void Interpreter::shutdown ( )
static

Shut down.

Closes the line source and deletes pimpltime pointer via destructor call. Ignores Context pointer. Frees the singleton Interpreter memory.

Member Data Documentation

◆ cout_

std::ostream Interpreter::cout_ { std::cout.rdbuf() }
private

Interpreter Property.

Our out ostream. Prepares for rerouting.

◆ curctx_

Context* Interpreter::curctx_ {}
private

Access to the current Context.

Interpreter is not the owner.

◆ linesource_

LineSource* Interpreter::linesource_ {}
private

Read from cin or from file.

Interpreter is the owner. Interpreter allocates memory on demand.

◆ maxopeelevel_

size_t Interpreter::maxopeelevel_ = 2
private

Interpreter Property.

A maximum for the nesting level of printed SOA, SOD and SOK in the "OPerator Equal Equal".

◆ odo_

bool Interpreter::odo_ = false
private

Interpreter Property.

Controls if the operator bind includes odo features.

◆ odo_iterations_

size_t Interpreter::odo_iterations_ = 10
private

Interpreter Property.

Maximum odo iterations even if there are more possible optimizations.

◆ verbose_

bool Interpreter::verbose_ = false
private

Interpreter Property.

Execution in verbose mode or not.


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