Vuo  2.3.2
VuoRendererReadOnlyDictionary.cc
Go to the documentation of this file.
1 
11 #include "VuoNodeClass.hh"
12 #include "VuoPort.hh"
13 #include "VuoStringUtilities.hh"
14 
19  : VuoRendererHiddenInputAttachment(baseNode, signaler)
20 {
21 }
22 
28 {
29  const string makeDictionaryNodeClassNamePrefix = "vuo.dictionary.make.";
30  if (!VuoStringUtilities::beginsWith(baseNode->getNodeClass()->getClassName(), makeDictionaryNodeClassNamePrefix))
31  return false;
32 
33  VuoPort *hostPort = getUnderlyingHostPortForNode(baseNode);
34  VuoNode *hostNode = getUnderlyingHostNodeForNode(baseNode);
35  bool isInputToCalculateNode = ((hostPort &&
36  (hostPort->getClass()->getName() == "values") &&
37  VuoStringUtilities::beginsWith(hostNode->getNodeClass()->getClassName(), "vuo.math.calculate")));
38  return isInputToCalculateNode;
39 }
40 
44 VuoNode * VuoRendererReadOnlyDictionary::getValueListNode()
45 {
46  VuoPort *valueListInputPort = getBase()->getInputPortWithName("values");
47  if (!valueListInputPort)
48  return NULL;
49 
50  VuoNode *makeValueListNode = getListNodeConnectedToInputPort(valueListInputPort);
51  return makeValueListNode;
52 }
53 
57 VuoNode * VuoRendererReadOnlyDictionary::getKeyListNode()
58 {
59  VuoPort *valueListInputPort = getBase()->getInputPortWithName("keys");
60  return getListNodeConnectedToInputPort(valueListInputPort);
61 }
62 
68 {
69  VuoNode *keyListNode = getKeyListNode();
70  VuoNode *valueListNode = getValueListNode();
71 
72  set<VuoNode *> coattachments;
73  if (keyListNode)
74  coattachments.insert(keyListNode);
75  if (valueListNode)
76  coattachments.insert(valueListNode);
77  return coattachments;
78 }