Debian Codegraph @

src/node.cpp

raw symbols SCIP
1 /*
2 Copyright (C) 2008, 2009 Andres Cabrera
3 [email protected]
4
5 This file is part of CsoundQt.
6
7 CsoundQt is free software; you can redistribute it
8 and/or modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or (at your option) any later version.
11
12 CsoundQt is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public
18 License along with Csound; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
20 02111-1307 USA
21 */
22
23 #include "node.h"
24
25 Node::Node()
26 {
27 }
28
29
30 Node::~Node()
31 {
32 }
33
34 void Node::clear()
35 {
36 m_inputs.clear();
37 m_outputs.clear();
38 m_name = "";
39 }
40
41 void Node::setName(QString name)
42 {
43 m_name = name;
44 }
45
46 QString Node::getName()
47 {
48 return m_name;
49 }
50
51 void Node::setComment(QString comment)
52 {
53 m_comment = comment;
54 }
55
56 QString Node::getComment()
57 {
58 return m_comment;
59 }
60
61 void Node::newInput(Port input)
62 {
63 m_inputs.append(input);
64 }
65
66 void Node::newOutput(Port output)
67 {
68 m_outputs.append(output);
69 }
70
71 QVector<Port> Node::getInputs()
72 {
73 return m_inputs;
74 }
75
76 QVector<Port> Node::getOutputs()
77 {
78 return m_outputs;
79 }
80
81 void Node::setInputs(QVector<Port> inputs)
82 {
83 m_inputs = inputs;
84 }
85
86 void Node::setOutputs(QVector<Port> outputs)
87 {
88 m_outputs = outputs;
89 }
90
91 bool Node::inputPortConnected(int portIndex)
92 {
93 if (portIndex >= m_inputs.size())
94 return false;
95 return m_inputs[portIndex].connected;
96 }
97
98 void Node::setInputPortConnected(bool connected, int portIndex)
99 {
100 if (portIndex >= m_inputs.size()) {
101 qDebug("Node::setInputPortConnected port out of range");
102 return;
103 }
104 m_inputs[portIndex].connected = connected;
105 }
106
107 bool Node::outputPortConnected(int portIndex)
108 {
109 if (portIndex >= m_outputs.size())
110 return false;
111 return m_outputs[portIndex].connected;
112 }
113
114 void Node::setOutputPortConnected(bool connected, int portIndex)
115 {
116 if (portIndex >= m_outputs.size()) {
117 qDebug("Node::setOutputPortConnected port out of range");
118 return;
119 }
120 m_outputs[portIndex].connected = connected;
121 }