Calculator
Extensible stack-based calculator primarily in library form
|
Stack Modifier for Stack Operations. More...
#include <StackManipulator.h>
Public Types | |
enum class | Operation { POP , DUP , SWAP , RESET , POP_ALL } |
Operations supported. More... | |
Public Types inherited from Calculator::StackOperator | |
typedef std::shared_ptr< StackOperator > | Ptr |
Public Member Functions | |
~StackManipulator () | |
virtual Result | operator() (Stack &stack, StackOperator::Ptr ofThis) |
Execute this operator on stack. More... | |
Public Member Functions inherited from Calculator::StackOperator | |
virtual | ~StackOperator () |
Static Public Member Functions | |
static StackManipulator::Ptr | create (Operation operation) |
Create to perform operation. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from Calculator::StackOperator | |
StackOperator ()=default | |
StackOperator (const StackOperator &)=delete | |
StackOperator (StackOperator &&)=delete | |
StackOperator & | operator= (const StackOperator &)=delete |
StackOperator & | operator= (StackOperator &&)=delete |
Stack Modifier for Stack Operations.
Support multiple operations distinguished by the Operation parameter.
Operations support separate stack-element manipulations
Definition at line 29 of file StackManipulator.h.
|
strong |
Operations supported.
Enumerator | |
---|---|
POP | Pop the top value off and forget it. |
DUP | Duplicate the top value. |
SWAP | Swap the top two elements. |
RESET | Clear the entire stack and set of variables. |
POP_ALL | Clear the entire stack. |
Definition at line 32 of file StackManipulator.h.
Calculator::StackManipulator::~StackManipulator | ( | ) |
Definition at line 29 of file StackManipulator.cpp.
|
static |
Create to perform operation.
operation | to perform |
Definition at line 25 of file StackManipulator.cpp.
|
virtual |
Execute this operator on stack.
stack | to operate on |
ofThis | is this in a copied StackOperator::Ptr to maintain integrity of the shared_ptrs. |
Implements Calculator::StackOperator.
Definition at line 37 of file StackManipulator.cpp.