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

Variable Modifier for Variable Operations. More...

#include <VariableManipulator.h>

Inheritance diagram for Calculator::VariableManipulator:
Collaboration diagram for Calculator::VariableManipulator:

Public Types

enum class  Operation { WRITE , READ }
 Operations supported. More...
 
typedef std::shared_ptr< VariableManipulatorPtr
 
- Public Types inherited from Calculator::StackOperator
typedef std::shared_ptr< StackOperatorPtr
 

Public Member Functions

 ~VariableManipulator ()
 
- Public Member Functions inherited from Calculator::StackOperator
virtual ~StackOperator ()
 

Static Public Member Functions

static VariableManipulator::Ptr create (Operation op)
 Create to perform operation. More...
 

Protected Member Functions

 VariableManipulator (Operation op)
 Create to perform operation. More...
 
 VariableManipulator (const VariableManipulator &)=delete
 
 VariableManipulator (VariableManipulator &&)=delete
 
VariableManipulatoroperator= (const VariableManipulator &)=delete
 
VariableManipulatoroperator= (VariableManipulator &&)=delete
 
virtual Result operator() (Stack &stack, StackOperator::Ptr ofThis)
 Execute this operator on stack. More...
 
- Protected Member Functions inherited from Calculator::StackOperator
 StackOperator ()=default
 
 StackOperator (const StackOperator &)=delete
 
 StackOperator (StackOperator &&)=delete
 
StackOperatoroperator= (const StackOperator &)=delete
 
StackOperatoroperator= (StackOperator &&)=delete
 

Detailed Description

Variable Modifier for Variable Operations.

Support multiple operations distinguished by the Operation parameter.

Operations support separate variable-element manipulations

Definition at line 29 of file VariableManipulator.h.

Member Typedef Documentation

◆ Ptr

Definition at line 31 of file VariableManipulator.h.

Member Enumeration Documentation

◆ Operation

Operations supported.

Enumerator
WRITE 

Write the value in next-to-top to variable in top.

READ 

Replace the top variable with its value.

Definition at line 34 of file VariableManipulator.h.

Constructor & Destructor Documentation

◆ ~VariableManipulator()

Calculator::VariableManipulator::~VariableManipulator ( )

Definition at line 31 of file VariableManipulator.cpp.

◆ VariableManipulator() [1/3]

Calculator::VariableManipulator::VariableManipulator ( Operation  op)
protected

Create to perform operation.

Parameters
opto perform

Definition at line 34 of file VariableManipulator.cpp.

◆ VariableManipulator() [2/3]

Calculator::VariableManipulator::VariableManipulator ( const VariableManipulator )
protecteddelete

◆ VariableManipulator() [3/3]

Calculator::VariableManipulator::VariableManipulator ( VariableManipulator &&  )
protecteddelete

Member Function Documentation

◆ create()

VariableManipulator::Ptr Calculator::VariableManipulator::create ( Operation  op)
static

Create to perform operation.

Parameters
opto perform
Returns
VariableManipulator created

Definition at line 27 of file VariableManipulator.cpp.

◆ operator()()

Result Calculator::VariableManipulator::operator() ( Stack stack,
StackOperator::Ptr  ofThis 
)
protectedvirtual

Execute this operator on stack.

Parameters
stackto operate on
ofThisis this in a copied StackOperator::Ptr to maintain integrity of the shared_ptrs.
Returns
Result of execution

Implements Calculator::StackOperator.

Definition at line 39 of file VariableManipulator.cpp.

◆ operator=() [1/2]

VariableManipulator& Calculator::VariableManipulator::operator= ( const VariableManipulator )
protecteddelete

◆ operator=() [2/2]

VariableManipulator& Calculator::VariableManipulator::operator= ( VariableManipulator &&  )
protecteddelete

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