Backproject
ContextOperation.h
1 
2 #ifndef BACKPROJECT_CONTEXTOPERATION_H
3 #define BACKPROJECT_CONTEXTOPERATION_H
4 
5 #include "ContextOperation.h"
6 #include "../Context.h"
7 
8 
9 //The code below adopts the pattern in the accepted answer of the following Stackoverflow:
10 //https://stackoverflow.com/questions/10332725/how-to-automatically-register-a-class-on-creation
11 
12 
13 class Context;
14 
20 {
21 
22 public:
28  virtual bool IsPossible(const Context &context) const =0;
29 
34  virtual std::string getDescription() const =0;
35 
41  virtual std::string Perform(Context &context) const =0;
42 
43 };
44 
45 
46 #endif //BACKPROJECT_CONTEXTOPERATION_H
Represents an operation that can be performed based on the 'Context' (This is an abstract class...
Definition: ContextOperation.h:19
A context; keeps track of overal program state in a way that is easily accessed by multiple functions...
Definition: Context.h:19
virtual std::string Perform(Context &context) const =0
Performs the operation on the context.
virtual bool IsPossible(const Context &context) const =0
Indicates whether the operation can be performed given the current state of affairs.
virtual std::string getDescription() const =0
Gives a short (infinitive verb) indication of what the operation does.