Vuo  2.3.2
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;
24 class VuoCompilerPort;
25 class VuoCompilerType;
26 
27 typedef struct Agraph_s Agraph_t;
28 typedef struct Agnode_s Agnode_t;
29 
30 #include "VuoHeap.h"
31 
36 {
37 private:
38  static dispatch_queue_t graphvizQueue;
39  VuoCompiler *compiler;
40  Agraph_t *graph;
41  map<string, VuoNodeClass *> dummyNodeClassForName;
42  map<string, VuoNodeClass *> nodeClassForName;
43  map<string, VuoNode *> nodeForName;
44  map<string, VuoComment *> commentForName;
45  vector<VuoNode *> orderedNodes;
46  vector<VuoCable *> orderedCables;
47  vector<VuoComment *> orderedComments;
48  map<string, string> typeForPublishedInputPort;
49  map<string, string> typeForPublishedOutputPort;
50  vector<VuoPublishedPort *> publishedInputPorts;
51  vector<VuoPublishedPort *> publishedOutputPorts;
52  VuoNode *publishedInputNode;
53  VuoNode *publishedOutputNode;
54  map< size_t, pair< VuoCompilerCable *, pair<string, string> > > publishedCablesInProgress;
55  VuoNode *manuallyFirableInputNode;
56  VuoPort *manuallyFirableInputPort;
57  VuoCompositionMetadata *metadata;
58 
59  map<string, VuoCompilerNodeClass *> compilerNodeClasses;
60  map<string, VuoCompilerType *> compilerTypes;
61  set<string> compilerProNodeClassNames;
62 
64  VuoCompilerGraphvizParser(VuoCompiler *compiler, const map<string, VuoCompilerNodeClass *> &compilerNodeClasses, const map<string, VuoCompilerType *> &compilerTypes, const set<string> &compilerProNodeClassNames);
65  void init(void);
66  void parse(const string &compositionAsStringOrig);
67  void makeDummyNodeClasses(void);
68  void makeNodeClasses(void);
69  void makeNodes(void);
70  void makeCables(void);
71  void makeComments(void);
72  void parsePublishedPortTypes(void);
73  void makePublishedPorts(void);
74  void setInputPortConstantValues(void);
75  void setPublishedPortDetails(void);
76  void setTriggerPortEventThrottling(void);
77  void setManuallyFirableInputPort(void);
78  map<string, string> parsePortConstantValues(Agnode_t *n);
79  bool parseAttributeOfPort(Agnode_t *n, string portName, string suffix, string &attributeValue);
80  void checkPortClasses(string nodeClassName, vector<VuoPortClass *> dummy, vector<VuoPortClass *> actual);
81  void saveNodeDeclarations(const string &compositionAsString);
82  static VuoType * inferTypeForPublishedPort(string name, const set<VuoCompilerPort *> &connectedPorts);
83 
84 public:
85  static VuoCompilerGraphvizParser * newParserFromCompositionFile(const string &path, VuoCompiler *compiler);
86  static VuoCompilerGraphvizParser * newParserFromCompositionString(const string &composition, VuoCompiler *compiler);
87  static set<string> getNodeClassNamesFromCompositionFile(const string &path);
88  vector<VuoNode *> getNodes(void);
89  vector<VuoCable *> getCables(void);
90  vector<VuoComment *> getComments(void);
91  vector<VuoPublishedPort *> getPublishedInputPorts(void);
92  vector<VuoPublishedPort *> getPublishedOutputPorts(void);
96 };