Vuo  2.0.0
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  vector<VuoCable *> targetCables;
47  for (vector<VuoCable *>::iterator cable = connectedCables.begin(); cable != connectedCables.end(); ++cable)
48  {
49  if (includePublishedCables || (! (*cable)->isPublished()))
50  targetCables.push_back(*cable);
51  }
52 
53  return targetCables;
54 }
55 
61 {
62  for (vector<VuoCable *>::iterator cable = connectedCables.begin(); cable != connectedCables.end(); ++cable)
63  {
64  if (((*cable)->getFromPort() == otherPort) || ((*cable)->getToPort() == otherPort))
65  return (*cable);
66  }
67 
68  return NULL;
69 }
70 
78 {
79  connectedCables.push_back(cable);
80 }
81 
88 {
89  connectedCables.erase(std::remove(connectedCables.begin(), connectedCables.end(), cable), connectedCables.end());
90 }
91 
96 {
97  return eventThrottling;
98 }
99 
104 {
105  this->eventThrottling = eventThrottling;
106 }
107 
111 void VuoPort::setRawInitialValue(const string &rawInitialValue)
112 {
113  this->rawInitialValue = rawInitialValue;
114 }
115 
123 {
124  return rawInitialValue;
125 }
126 
130 void VuoPort::print(void)
131 {
132  printf("VuoPort(%p,\"%s\")",this,portClass->getName().c_str());
133  if (hasCompiler())
134  printf(" VuoCompilerPort(%p)",getCompiler());
135  if (hasRenderer())
136  printf(" VuoRendererPort(%p)",getRenderer());
137  printf("\n");
138 }