-// Copyright (C) 2006-2014 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2015 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
return StaticDefinedComposedNode::getNumberOfInputPorts()+1;
}
+int Switch::getMaxLevelOfParallelism() const
+{
+ int ret(0);
+ for(std::map< int , Node * >::const_iterator it=_mapOfNode.begin();it!=_mapOfNode.end();it++)
+ ret=std::max(ret,((*it).second)->getMaxLevelOfParallelism());
+ return ret;
+}
+
void Switch::edRemoveChild(Node *node) throw(YACS::Exception)
{
map< int , Node * >::iterator iter=_mapOfNode.begin();
return aCase;
}
+//! Get the progress weight of the graph
+/*!
+ * Only elementary nodes have weight. If the switch node is not done, we add the weight of all his descendants,
+ * otherwise only the weight of the used case count.
+ */
+list<ProgressWeight> Switch::getProgressWeight() const
+{
+ list<ProgressWeight> ret;
+ list<Node *> setOfNode=edGetDirectDescendants();
+ if (getState() == YACS::DONE)
+ {
+ for(list<Node *>::const_iterator iter=setOfNode.begin();iter!=setOfNode.end();iter++)
+ {
+ if (getEffectiveState(*iter) == YACS::DONE)
+ ret=(*iter)->getProgressWeight();
+ }
+ }
+ else
+ {
+ for(list<Node *>::const_iterator iter=setOfNode.begin();iter!=setOfNode.end();iter++)
+ {
+ list<ProgressWeight> myCurrentSet=(*iter)->getProgressWeight();
+ ret.insert(ret.end(),myCurrentSet.begin(),myCurrentSet.end());
+ }
+ }
+ return ret;
+}
+
bool Switch::edAddChild(Node *node) throw(YACS::Exception)
{
int aCase = getMaxCase() + 1;