Vuo  2.3.2
VuoPort.cc
Go to the documentation of this file.
1 
10 #include "VuoPort.hh"
11 #include "VuoCable.hh"
12 
13 #include <stdio.h>
14 
15 
21 {
22  this->portClass = portClass;
23  this->eventThrottling = getClass()->getDefaultEventThrottling();
24 }
25 
27 {
28 }
29 
34 {
35  return portClass;
36 }
37 
44 vector<VuoCable *> VuoPort::getConnectedCables(bool includePublishedCables)
45 {
46  if (includePublishedCables)
47  return connectedCables;
48 
49  vector<VuoCable *> targetCables;
50  for (vector<VuoCable *>::iterator cable = connectedCables.begin(); cable != connectedCables.end(); ++cable)
51  {
52  if (! (*cable)->isPublished())
53  targetCables.push_back(*cable);
54  }
55 
56  return targetCables;
57 }
58 
64 {
65  for (vector<VuoCable *>::iterator cable = connectedCables.begin(); cable != connectedCables.end(); ++cable)
66  {
67  if (((*cable)->getFromPort() == otherPort) || ((*cable)->getToPort() == otherPort))
68  return (*cable);
69  }
70 
71  return NULL;
72 }
73 
81 {
82  connectedCables.push_back(cable);
83 }
84 
91 {
92  connectedCables.erase(std::remove(connectedCables.begin(), connectedCables.end(), cable), connectedCables.end());
93 }
94 
99 {
100  return eventThrottling;
101 }
102 
107 {
108  this->eventThrottling = eventThrottling;
109 }
110 
114 void VuoPort::setRawInitialValue(const string &rawInitialValue)
115 {
116  this->rawInitialValue = rawInitialValue;
117 }
118 
126 {
127  return rawInitialValue;
128 }
129 
133 void VuoPort::print(void)
134 {
135  printf("VuoPort(%p,\"%s\")",this,portClass->getName().c_str());
136  if (hasCompiler())
137  printf(" VuoCompilerPort(%p)",getCompiler());
138  if (hasRenderer())
139  printf(" VuoRendererPort(%p)",getRenderer());
140  printf("\n");
141 }