Skip to content
Snippets Groups Projects
Commit c6a2e4ba authored by Martin Christoph Hierholzer's avatar Martin Christoph Hierholzer
Browse files

Changed an exception into an assert, since the function is only internally...

Changed an exception into an assert, since the function is only internally used and the exception is never thrown. Clafiried the documentation about this.
parent 8c249397
No related branches found
Tags 00.05.00
No related merge requests found
......@@ -41,16 +41,16 @@ namespace ChimeraTK {
none ///< no trigger has yet been selected
};
/** Add an node to the network. */
/** Add an node to the network. The node must not yet be part of any network. */
void addNode(VariableNetworkNode &a);
/** Add a trigger receiver node */
/** Add a trigger receiver node. The node must not yet be part of any network. */
void addNodeToTrigger(VariableNetworkNode& nodeToTrigger);
/** Remove a node from the network */
/** Remove a node from the network. The node must be part of the given network. */
void removeNode(const VariableNetworkNode &a);
/** Remove a trigger receiver node from the network */
/** Remove a trigger receiver node from the network. The node must be part of the given network. */
void removeNodeToTrigger(const VariableNetworkNode &nodeToNoLongerTrigger);
/** Check if the network already has a feeding node connected to it. */
......
......@@ -34,10 +34,7 @@ namespace ChimeraTK {
/*********************************************************************************************************************/
void VariableNetwork::addNode(VariableNetworkNode &a) {
if(a.hasOwner()) { // already in the network
assert( &(a.getOwner()) == this ); /// @todo TODO merge networks?
return;
}
assert(!a.hasOwner());
// change owner of the node: erase from Application's unconnectedNodeList and set this as owner
a.setOwner(this);
......@@ -74,16 +71,7 @@ namespace ChimeraTK {
void VariableNetwork::removeNode(const VariableNetworkNode &a) {
auto nNodes = nodeList.size();
nodeList.remove(a);
// check if a node was actually removed, if not, throw exception
if(nodeList.size() == nNodes) {
std::stringstream msg;
msg << "Trying remove a VariableNetworkNode from the VariableNetwork which is not in the network." << std::endl;
msg << "The network you were trying to remove the node from:" << std::endl;
dump("", msg);
msg << "The node you were trying to remove:" << std::endl;
a.dump(msg);
throw ApplicationExceptionWithID<ApplicationExceptionID::illegalParameter>(msg.str());
}
assert(nodeList.size() != nNodes);
}
/*********************************************************************************************************************/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment