MCPcopy Create free account
hub / github.com/chigraph/chigraph / removeNode

Method removeNode

libchigraph/src/GraphFunction.cpp:114–154  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

112}
113
114Result GraphFunction::removeNode(NodeInstance& nodeToRemove) {
115 // invalidate the cache
116 module().updateLastEditTime();
117
118 Result res;
119
120 // disconnect it's connections
121
122 // disconnect input exec
123 for (const auto& execSlot : nodeToRemove.inputExecConnections) {
124 for (const auto& pair : execSlot) {
125 if (pair.first != nullptr) { res += disconnectExec(*pair.first, pair.second); }
126 }
127 }
128 // disconnect output exec
129 auto ID = 0ull;
130 for (const auto& pair : nodeToRemove.outputExecConnections) {
131 if (pair.first != nullptr) { res += disconnectExec(nodeToRemove, ID); }
132 ++ID;
133 }
134
135 // disconnect input data
136 for (const auto& pair : nodeToRemove.inputDataConnections) {
137 if (pair.first != nullptr) {
138 res += disconnectData(*pair.first, pair.second, nodeToRemove);
139 }
140 }
141
142 // disconnect output data
143 ID = 0ull;
144 for (const auto& dataSlot : nodeToRemove.outputDataConnections) {
145 for (const auto& pair : dataSlot) {
146 if (pair.first != nullptr) { disconnectData(nodeToRemove, ID, *pair.first); }
147 }
148 ++ID;
149 }
150 // then delete the node
151 nodes().erase(nodeToRemove.id());
152
153 return res;
154}
155
156Result GraphFunction::createEntryNodeType(std::unique_ptr<NodeType>* toFill) const {
157 Result res;

Callers 2

removeFunctionMethod · 0.80

Calls 4

disconnectExecFunction · 0.85
disconnectDataFunction · 0.85
updateLastEditTimeMethod · 0.80
idMethod · 0.80

Tested by

no test coverage detected