FotoSHOCK
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
GraphManager.hpp
1 /*
2  * Copyright 2011, 2012 Lukas Jirkovsky
3  *
4  * This file is part of FotoSHOCKcore.
5  *
6  * FotoSHOCKcore is free software: you can redistribute it and/or modify it
7  * under the terms of the GNU Lesser General Public License as published by
8  * the Free Software Foundation, version 3 of the License.
9  *
10  * FotoSHOCKcore is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with FotoSHOCKcore. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #ifndef GRAPHMANAGER_H
20 #define GRAPHMANAGER_H
21 
22 #include "ConstPtr.hpp"
23 // these two can be replaced by forward declaration, but this is more convenient
24 #include "ImageOperation.hpp"
25 #include "GraphNode.hpp"
26 
27 #include <string>
28 #include <list>
29 #include <boost/bimap.hpp>
30 
31 namespace FotoSHOCKcore{
32 
33 class Graph_private;
34 
36 
57 class GraphManager {
58  public:
59  friend class GraphNode;
60 
62 
65  GraphManager();
67  ~GraphManager();
68 
70 
75  vector<GraphNode*>& getRoots();
76 
78 
88  GraphNode* addRoot(PixelData format, unsigned int width, unsigned int height, const std::string color);
90 
99  GraphNode* addRoot(const std::string fileName);
101 
108  GraphNode* addRoot(PixelData format, const std::string fileName);
109 
111 
121  // NOTE: this may be removed in the future
122  void addEdge(GraphNode* source, GraphNode* dest);
124 
135  void addEdge(GraphNode* source, int outputID, GraphNode* dest, int inputID);
137 
147  // NOTE: this may be removed in the future
148  void removeEdge(GraphNode* source, GraphNode* dest);
150 
158  void removeEdge(GraphNode* source, int outputID, GraphNode* dest, int inputID);
159 
161 
173 
175 
186  GraphNode* insertOperation(ImageOperationDescriptor* operationDescr, GraphNode* parent0, ...);
188 
196  vector<GraphNode*>& parents, vector<GraphNode*>& children);
197 
199 
206  bool removeOperation(GraphNode* node);
207 
209 
213  void interruptRecalculate();
214 
216  void join();
217 
219 
227  void timingSheer(double sheer);
229 
234  double timingSheer() const;
236 
243  void timingCurvature(double curvature);
245 
251  double timingCurvature() const;
252 
254 
260  unsigned int tileExtent() const;
261 
263 
271  void registerOperation(ImageOperationDescriptor* operationDescr);
272 
274 
279  xmlNodePtr serialize();
281 
286  void serialize(const char* fileName);
287 
288  typedef boost::bimap<unsigned int, GraphNode*> IdNodeBimapType;
290 
298  IdNodeBimapType deserialize(xmlNodePtr rootElement);
300 
307  IdNodeBimapType deserialize(const char* fileName);
308  protected:
310 };
311 
312 }
313 
314 #endif