{
//internal graph update
int i;
- int nbOfBr(_nbOfBranches->getIntValue()),nbOfElts(_splitterNode.getNumberOfElements()),nbOfEltsDone(0);
+ int nbOfElts(_splitterNode.getNumberOfElements()),nbOfEltsDone(0);
+ int nbOfBr(_nbOfBranches->getNumberOfBranches(nbOfElts));
if(_passedData)
{
_passedData->checkCompatibilyWithNb(nbOfElts);
int ForEachLoop::getNbOfElementsToBeProcessed() const
{
- int nbBranches = _nbOfBranches->getIntValue();
- return _splitterNode.getNumberOfElements()
+ int nbOfElems(_splitterNode.getNumberOfElements());
+ int nbBranches = _nbOfBranches->getNumberOfBranches(nbOfElems);
+ return nbOfElems
+ (_initNode ? nbBranches:0)
+ (_finalizeNode ? nbBranches:0) ;
}
return std::unique_ptr<NbBranchesAbstract>(new NbBranches(*this,node));
}
+int NbBranches::getNumberOfBranches(int) const
+{
+ return this->getIntValue();
+}
+
bool NbBranches::isMyName(const std::string& name) const
{
return NbBranchesAbstract::IsBranchPortName(name);
return std::unique_ptr<NbBranchesAbstract>(new NoNbBranches);
}
+int NoNbBranches::getNumberOfBranches(int nbOfElems) const
+{
+ return nbOfElems;
+}
+
void NoNbBranches::exInit(bool start)
{
}
{
public:
virtual std::unique_ptr<NbBranchesAbstract> copy(Node *node) const = 0;
+ virtual int getNumberOfBranches(int nbOfElems) const = 0;
virtual bool isMyName(const std::string& name) const = 0;
virtual void exInit(bool start) = 0;
virtual InputPort *getPort() const = 0;
NbBranches(const NbBranches& other, Node *node):_nbOfBranches(other._nbOfBranches,node) { }
bool isMyName(const std::string& name) const override;
std::unique_ptr<NbBranchesAbstract> copy(Node *node) const override;
+ int getNumberOfBranches(int nbOfElems) const override;
void exInit(bool start) override;
InputPort *getPort() const override;
bool isMultiplicitySpecified(unsigned& value) const override;
public:
NoNbBranches() = default;
std::unique_ptr<NbBranchesAbstract> copy(Node *node) const override;
+ int getNumberOfBranches(int nbOfElems) const override;
bool isMyName(const std::string& name) const override { return false; }
void exInit(bool start) override;
InputPort *getPort() const override;