Vuo  2.0.0
VuoCompilerGraphvizParser.hh
Go to the documentation of this file.
1 
10 #pragma once
11 
12 class VuoCable;
13 class VuoComment;
15 class VuoNode;
16 class VuoNodeClass;
17 class VuoPort;
18 class VuoPortClass;
19 class VuoPublishedPort;
20 class VuoType;
21 class VuoCompiler;
22 class VuoCompilerCable;
23 class VuoCompilerPort;
24 
25 struct Agraph_t;
26 struct Agnode_t;
27 typedef struct Agraph_t graph_t;
28 
29 #include "VuoHeap.h"
30 
35 {
36 private:
37  static dispatch_queue_t graphvizQueue;
38  VuoCompiler *compiler;
39  graph_t *graph;
40  map<string, VuoNodeClass *> dummyNodeClassForName;
41  map<string, VuoNodeClass *> nodeClassForName;
42  map<string, VuoNode *> nodeForName;
43  map<string, VuoComment *> commentForName;
44  vector<VuoNode *> orderedNodes;
45  vector<VuoCable *> orderedCables;
46  vector<VuoComment *> orderedComments;
47  vector<VuoPublishedPort *> publishedInputPorts;
48  vector<VuoPublishedPort *> publishedOutputPorts;
49  VuoNode *publishedInputNode;
50  VuoNode *publishedOutputNode;
51  map< size_t, pair< VuoCompilerCable *, pair<string, string> > > publishedCablesInProgress;
52  VuoNode *manuallyFirableInputNode;
53  VuoPort *manuallyFirableInputPort;
54  VuoCompositionMetadata *metadata;
55 
56  VuoCompilerGraphvizParser(const string &composition, VuoCompiler *compiler, bool nodeClassNamesOnly);
57  void makeDummyNodeClasses(void);
58  void makeNodeClasses(void);
59  void makeNodes(void);
60  void makeCables(void);
61  void makeComments(void);
62  void makePublishedPorts(void);
63  void setInputPortConstantValues(void);
64  void setPublishedPortDetails(void);
65  void setTriggerPortEventThrottling(void);
66  void setManuallyFirableInputPort(void);
67  map<string, string> parsePortConstantValues(Agnode_t *n);
68  bool parseAttributeOfPort(Agnode_t *n, string portName, string suffix, string &attributeValue);
69  void checkPortClasses(string nodeClassName, vector<VuoPortClass *> dummy, vector<VuoPortClass *> actual);
70  void saveNodeDeclarations(const string &compositionAsString);
71  static VuoType * inferTypeForPublishedPort(string name, const set<VuoCompilerPort *> &connectedPorts);
72 
73 public:
74  static VuoCompilerGraphvizParser * newParserFromCompositionFile(const string &path, VuoCompiler *compiler);
75  static VuoCompilerGraphvizParser * newParserFromCompositionString(const string &composition, VuoCompiler *compiler);
76  static set<string> getNodeClassNamesFromCompositionFile(const string &path);
77  static set<string> getNodeClassNamesFromCompositionString(const string &composition);
78  vector<VuoNode *> getNodes(void);
79  vector<VuoCable *> getCables(void);
80  vector<VuoComment *> getComments(void);
81  vector<VuoPublishedPort *> getPublishedInputPorts(void);
82  vector<VuoPublishedPort *> getPublishedOutputPorts(void);
86 };