X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2Fengine%2FNode.hxx;h=0a85d294b4eaa0a49690e2c2d0e7b219462fed2b;hb=89f536fa20e516d2de5339f741956dd1473f46a4;hp=c23e8f8c3dbad9a9b6722071a0c25b1c928cf343;hpb=f4c10bf1781a76534bb1fa293aef541aef56148b;p=modules%2Fyacs.git diff --git a/src/engine/Node.hxx b/src/engine/Node.hxx index c23e8f8c3..0a85d294b 100644 --- a/src/engine/Node.hxx +++ b/src/engine/Node.hxx @@ -1,24 +1,26 @@ -// Copyright (C) 2006-2008 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 -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #ifndef __NODE_HXX__ #define __NODE_HXX__ +#include "YACSlibEngineExport.hxx" #include "InGate.hxx" #include "OutGate.hxx" #include "Exception.hxx" @@ -33,34 +35,43 @@ namespace YACS { namespace ENGINE { - void StateLoader(Node* node, YACS::StatesForNode state); + void YACSLIBENGINE_EXPORT StateLoader(Node* node, YACS::StatesForNode state); class Task; class InPort; class OutPort; class InputPort; class OutputPort; + class InPropertyPort; class DynParaLoop; class ForEachLoop; class ComposedNode; + class Proc; class ElementaryNode; class Switch; class InputDataStreamPort; class OutputDataStreamPort; class Visitor; - -/*! \brief Base class for all nodes - * - * \ingroup Nodes - * - * - */ - class Node + + struct ProgressWeight + { + int weightDone; + int weightTotal; + }; + + class YACSLIBENGINE_EXPORT NodeStateNameMap : public std::map + { + public: + NodeStateNameMap(); + }; + + class YACSLIBENGINE_EXPORT Node { friend class Bloc; friend class Loop; friend class Switch; friend class InputPort; friend class OutputPort; + friend class InPropertyPort; friend class DynParaLoop; friend class ForEachLoop; friend class ComposedNode; @@ -72,6 +83,7 @@ namespace YACS protected: InGate _inGate; OutGate _outGate; + InPropertyPort * _inPropertyPort; std::string _name; ComposedNode *_father; YACS::StatesForNode _state; @@ -85,13 +97,20 @@ namespace YACS protected: Node(const std::string& name); Node(const Node& other, ComposedNode *father); + //! performs a duplication of placement using clone method of containers and components. clone behaviour is driven by attachOnCloning attribute. virtual void performDuplicationOfPlacement(const Node& other) = 0; + //! performs a also duplication of placement but here containers and components are not copied at all whatever the value of attachedOnCloning. + virtual void performShallowDuplicationOfPlacement(const Node& other) = 0; virtual Node *simpleClone(ComposedNode *father, bool editionOnly=true) const = 0; public: virtual ~Node(); virtual void init(bool start=true); + virtual void shutdown(int level); + virtual void resetState(int level); //! \b This method \b MUST \b NEVER \b BE \b VIRTUAL Node *clone(ComposedNode *father, bool editionOnly=true) const; + //! \b This method \b MUST \b NEVER \b BE \b VIRTUAL + Node *cloneWithoutCompAndContDeepCpy(ComposedNode *father, bool editionOnly=true) const; void setState(YACS::StatesForNode theState); // To centralize state changes virtual YACS::StatesForNode getState() const { return _state; } virtual YACS::StatesForNode getEffectiveState() const; @@ -105,13 +124,14 @@ namespace YACS ComposedNode * getFather() const { return _father; } const std::string getId() const; bool exIsControlReady() const; - std::set getOutNodes() const; + std::list getOutNodes() const; virtual void writeDot(std::ostream &os) const; virtual void exUpdateState(); virtual void exFailedState(); virtual void exDisabledState(); virtual void getReadyTasks(std::vector& tasks) = 0; virtual std::list getRecursiveConstituents() const = 0; + virtual std::list getProgressWeight() const = 0; virtual int getNumberOfInputPorts() const = 0; virtual int getNumberOfOutputPorts() const = 0; std::list getSetOfInPort() const; @@ -127,12 +147,13 @@ namespace YACS virtual std::list getSetOfInputDataStreamPort() const = 0; virtual std::list getSetOfOutputDataStreamPort() const = 0; InPort *getInPort(const std::string& name) const throw(Exception); + InPropertyPort *getInPropertyPort() const throw(Exception); virtual OutPort *getOutPort(const std::string& name) const throw(Exception); virtual std::set getAllOutPortsLeavingCurrentScope() const = 0; virtual std::set getAllInPortsComingFromOutsideOfCurrentScope() const = 0; virtual std::vector< std::pair > getSetOfLinksLeavingCurrentScope() const = 0; virtual std::vector< std::pair > getSetOfLinksComingInCurrentScope() const =0; - virtual InputPort *getInputPort(const std::string& name) const throw(Exception) = 0; + virtual InputPort *getInputPort(const std::string& name) const throw(Exception); virtual OutputPort *getOutputPort(const std::string& name) const throw(Exception) = 0; virtual InputDataStreamPort *getInputDataStreamPort(const std::string& name) const throw(Exception) = 0; virtual OutputDataStreamPort *getOutputDataStreamPort(const std::string& name) const throw(Exception) = 0; @@ -142,29 +163,39 @@ namespace YACS std::string getImplementation() const; virtual ComposedNode *getRootNode() const throw(Exception); virtual void setProperty(const std::string& name,const std::string& value); + virtual std::string getProperty(const std::string& name); + std::map getProperties() ; + std::map getPropertyMap() { return _propertyMap; } + virtual void setProperties(std::map properties); virtual Node *getChildByName(const std::string& name) const throw(Exception) = 0; + virtual Proc *getProc(); + virtual const Proc *getProc() const; virtual void accept(Visitor *visitor) = 0; + virtual int getMaxLevelOfParallelism() const = 0; std::string getQualifiedName() const; int getNumId(); + std::vector > getDPLScopeInfo(ComposedNode *gfn); + virtual void applyDPLScope(ComposedNode *gfn); virtual void sendEvent(const std::string& event); static std::map idMap; - virtual std::string typeName() {return "YACS__ENGINE__Node";} - virtual std::string getErrorDetails(){return _errorDetails;}; - virtual void setErrorDetails(const std::string& error){_errorDetails=error;}; + virtual std::string typeName() { return "YACS__ENGINE__Node"; } + virtual std::string getErrorDetails() const { return _errorDetails; } + virtual void setErrorDetails(const std::string& error) { _errorDetails=error; } virtual void modified(); - virtual int isModified(){return _modified;} + virtual int isModified() { return _modified; } virtual int isValid(); virtual void edUpdateState(); virtual std::string getErrorReport(); virtual std::string getContainerLog(); virtual void ensureLoading(); + virtual void getCoupledNodes(std::set& coupledNodes) { } + virtual void cleanNodes(); protected: virtual void exForwardFailed(); virtual void exForwardFinished(); virtual void edDisconnectAllLinksWithMe(); static void checkValidityOfPortName(const std::string& name) throw(Exception); static ComposedNode *checkHavingCommonFather(Node *node1, Node *node2) throw(Exception); - static std::map _nodeStateName; }; }