Calculator
Extensible stack-based calculator primarily in library form
Calculator::Executive Class Reference

Drivable class to run the calculator with a variable factory per process call to support changing command sets. More...

#include <Executive.h>

Public Member Functions

 Executive (Stack &stack)
 Create with the stack to process. More...
 
 Executive (const Executive &)=delete
 
 Executive (Executive &&)=delete
 
Executiveoperator= (const Executive &)=delete
 
Executiveoperator= (Executive &&)=delete
 
std::string toString () const
 
void process (StackOperatorFactory &factory, std::istream &input, std::ostream &output)
 Process commands from input and pushing generated info to output. More...
 
Result process (StackOperatorFactory &factory, const std::string &input)
 Process commands from input and pushing generated info to output. More...
 
Result process (StackOperator::Ptr oper)
 Process oper upon the Stack. More...
 
unsigned int getOperationCount () const
 
void doHelp (const StackOperatorFactory &factory, std::ostream &output) const
 Generate help info for this executive to output. More...
 

Detailed Description

Drivable class to run the calculator with a variable factory per process call to support changing command sets.

Definition at line 30 of file Executive.h.

Constructor & Destructor Documentation

◆ Executive() [1/3]

Calculator::Executive::Executive ( Stack stack)

Create with the stack to process.

Parameters
stackto process

Definition at line 28 of file Executive.cpp.

◆ Executive() [2/3]

Calculator::Executive::Executive ( const Executive )
delete

◆ Executive() [3/3]

Calculator::Executive::Executive ( Executive &&  )
delete

Member Function Documentation

◆ doHelp()

void Calculator::Executive::doHelp ( const StackOperatorFactory factory,
std::ostream &  output 
) const

Generate help info for this executive to output.

Parameters
factoryproviding commands to get help from
outputto write help info to

Definition at line 93 of file Executive.cpp.

◆ getOperationCount()

unsigned int Calculator::Executive::getOperationCount ( ) const
Returns
the count of processed operations

Definition at line 89 of file Executive.cpp.

◆ operator=() [1/2]

Executive& Calculator::Executive::operator= ( const Executive )
delete

◆ operator=() [2/2]

Executive& Calculator::Executive::operator= ( Executive &&  )
delete

◆ process() [1/3]

Result Calculator::Executive::process ( StackOperator::Ptr  oper)

Process oper upon the Stack.

Parameters
operto process on the Stack
Returns
Result of processing

Definition at line 77 of file Executive.cpp.

◆ process() [2/3]

Result Calculator::Executive::process ( StackOperatorFactory factory,
const std::string &  input 
)

Process commands from input and pushing generated info to output.

Parameters
factoryto parse input and generate Operators from
inputto create one operator and execute from
Returns
Result of processing

Definition at line 57 of file Executive.cpp.

◆ process() [3/3]

void Calculator::Executive::process ( StackOperatorFactory factory,
std::istream &  input,
std::ostream &  output 
)

Process commands from input and pushing generated info to output.

Parameters
factoryto parse input and generate Operators from
inputto read commands from
outputto write status to

Definition at line 33 of file Executive.cpp.

◆ toString()

std::string Calculator::Executive::toString ( ) const
Returns
string representation of the current state

Definition at line 53 of file Executive.cpp.


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