ImGraph
 All Classes Functions Variables Enumerations Pages
Graph.h
1 #ifndef _GRAPH_HEADER_
2 #define _GRAPH_HEADER_
3 
4 #include "Block.h"
5 
6 
23 namespace charliesoft
24 {
25  class SubBlock;
27  {
28  static bool _pauseProcess;
29  GraphOfProcess* _parent;
30  SubBlock *_subBlock;
31  std::map< Block*, std::set<Block*> > _waitingForRendering;
32  std::map< Block*, boost::thread > _runningThread;
33  std::vector<Block*> _vertices;
34  boost::mutex _mtx;
35  //edges are stored into Block (_myInputs[]->isLinked())
36 
37  public:
39  ~GraphOfProcess();
40 
41  void saveGraph(boost::property_tree::ptree& tree) const;
42  void fromGraph(boost::property_tree::ptree& tree,
43  std::map<unsigned int, ParamValue*>& = std::map<unsigned int, ParamValue*>());
44  GraphOfProcess* getParent() const { return _parent; }
45  void setParent(GraphOfProcess* val, SubBlock* block) { _parent = val; _subBlock = block; }
46 
47  void initChildDatas(Block*, std::set<Block*>& listOfRenderedBlocks);
48 
49 
50  void addNewProcess(Block* filter);
51  void deleteProcess(Block* process);
52  void extractProcess(Block* process);
53 
54  void createLink(Block* src, std::string paramName, Block* dest, std::string paramNameDest);
55 
56  bool run(bool singleShot = false, bool delegateParent = true);
57  void stop(bool delegateParent = true, bool waitEnd = true);
58  void waitUntilEnd(size_t max_ms_time = 0);
59  bool switchPause(bool delegateParent = true);
60  bool isPause(){
61  return _pauseProcess;
62  };
63 
67  void blockProduced(Block* process, bool fullyRendered = true);
68 
72  void shouldWaitAncestors(Block* process);
76  void updateAncestors(Block* process);
81  void shouldWaitConsumers(Block* process=NULL);
82 
86  void clearWaitingList(Block* process);
87 
88  std::vector<Block*>& getVertices();
89  void removeLink(const BlockLink& l);
90  };
91 }
92 
93 
94 #endif
Definition: Graph.h:26
void updateAncestors(Block *process)
Definition: Graph.cpp:117
void shouldWaitAncestors(Block *process)
Definition: Graph.cpp:132
void shouldWaitConsumers(Block *process=NULL)
Definition: Graph.cpp:187
Definition: Block.h:197
void clearWaitingList(Block *process)
Definition: Graph.cpp:180
void blockProduced(Block *process, bool fullyRendered=true)
Definition: Graph.cpp:227
Definition: SubBlock.h:20