Backproject
Context.h
1 
2 #ifndef BACKPROJECT_CONTEXT_H
3 #define BACKPROJECT_CONTEXT_H
4 
5 #include <memory>
6 #include <vector>
7 #include <ostream>
8 #include "Image.h"
9 #include "Operations/ContextOperation.h"
10 
11 
12 //Forward declaration: the two H files need eachother.
13 class ContextOperation;
14 
15 
19 class Context
20 {
21 
22 private:
26  static std::vector<std::shared_ptr<ContextOperation>> operations;
27  std::vector<std::shared_ptr<Image>> Images;
28  std::vector<std::vector<double>> Points;
29 
30 public:
31 
38  friend std::ostream &operator<<(std::ostream &os, const Context &context);
39 
44  static void registerOperation(std::shared_ptr<ContextOperation> operation);
45 
46 
51  const std::vector<std::shared_ptr<ContextOperation>> &listOperations() const;
52 
57  const std::vector<std::shared_ptr<Image>> listImages() const;
58 
63  const std::vector<std::vector<double>> listPoints() const;
64 
69  void addImage(const std::shared_ptr<Image> image);
70 
75  void addPoint(const std::vector<double> point);
76 
80  void removeAllPoints();
81 
85  void removeAllImages();
86 
92  void Enter(std::ostream &os, std::istream &is);
93 
94 };
95 
96 
97 #endif //BACKPROJECT_CONTEXT_H
static void registerOperation(std::shared_ptr< ContextOperation > operation)
Adds operations to all contexts.
Definition: Context.cpp:33
const std::vector< std::vector< double > > listPoints() const
Returns the points in the context.
Definition: Context.cpp:48
Represents an operation that can be performed based on the &#39;Context&#39; (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
const std::vector< std::shared_ptr< ContextOperation > > & listOperations() const
Lists the operations in the context.
Definition: Context.cpp:38
void removeAllPoints()
Removes all of the points in the context.
Definition: Context.cpp:137
const std::vector< std::shared_ptr< Image > > listImages() const
Returns the images that are in the context.
Definition: Context.cpp:43
friend std::ostream & operator<<(std::ostream &os, const Context &context)
Registration of the stream operator as a friend.
Definition: Context.cpp:9
void addImage(const std::shared_ptr< Image > image)
Addsa new image to the context.
Definition: Context.cpp:53
void addPoint(const std::vector< double > point)
Adds a new point to the context.
Definition: Context.cpp:58
void removeAllImages()
Removes all of the images in the context.
Definition: Context.cpp:142
void Enter(std::ostream &os, std::istream &is)
&#39;Enter&#39; the context and let the user interact with it
Definition: Context.cpp:63