Salome HOME
merge from branch DEV tag mergeto_trunk_04apr08
[modules/yacs.git] / src / engine / Node.hxx
index 7f72ee2a09c6e8b683bb79bc8a20897af591f30a..4daf597b06899404687da9bb345b03296749208c 100644 (file)
@@ -15,6 +15,7 @@ namespace YACS
 {
   namespace ENGINE
   {
+    void StateLoader(Node* node, YACS::StatesForNode state);
     class Task;
     class InPort;
     class OutPort;
@@ -56,6 +57,8 @@ namespace YACS
       std::string _name;
       ComposedNode *_father;
       YACS::StatesForNode _state;
+      int _modified;
+      std::string _errorDetails;
       static const char SEP_CHAR_IN_PORT[];
       static int _total;
       int _numId;
@@ -73,22 +76,23 @@ namespace YACS
       Node *clone(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();
-      virtual YACS::StatesForNode getEffectiveState(Node*);
-      std::string getColorState(YACS::StatesForNode state);
+      virtual YACS::StatesForNode getEffectiveState() const;
+      virtual YACS::StatesForNode getEffectiveState(const Node*) const;
+      std::string getColorState(YACS::StatesForNode state) const;
       InGate *getInGate() { return &_inGate; }
       OutGate *getOutGate() { return &_outGate; }
       const std::string& getName() const { return _name; }
+      void setName(const std::string& name);
       ComposedNode * getFather() const { return _father; }
-      const std::string getId();
+      const std::string getId() const;
       bool exIsControlReady() const;
       std::set<Node *> getOutNodes() const;
-      virtual void writeDot(std::ostream &os);
+      virtual void writeDot(std::ostream &os) const;
       virtual void exUpdateState();
       virtual void exFailedState();
       virtual void exDisabledState();
       virtual void getReadyTasks(std::vector<Task *>& tasks) = 0;
-      virtual std::set<ElementaryNode *> getRecursiveConstituents() const = 0;
+      virtual std::list<ElementaryNode *> getRecursiveConstituents() const = 0;
       virtual int getNumberOfInputPorts() const = 0;
       virtual int getNumberOfOutputPorts() const = 0;
       std::list<InPort *> getSetOfInPort() const;
@@ -107,13 +111,17 @@ namespace YACS
       virtual OutPort *getOutPort(const std::string& name) const throw(Exception);
       virtual std::set<OutPort *> getAllOutPortsLeavingCurrentScope() const = 0;
       virtual std::set<InPort *> getAllInPortsComingFromOutsideOfCurrentScope() const = 0;
+      virtual std::vector< std::pair<OutPort *, InPort *> > getSetOfLinksLeavingCurrentScope() const = 0;
+      virtual std::vector< std::pair<InPort *, OutPort *> > getSetOfLinksComingInCurrentScope() const =0;
       virtual InputPort *getInputPort(const std::string& name) const throw(Exception) = 0;
       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;
-      std::set<ComposedNode *> getAllAscendanceOf(ComposedNode *levelToStop = 0);
-      std::string getImplementation();
-      virtual ComposedNode *getRootNode() throw(Exception);
+      std::list<ComposedNode *> getAllAscendanceOf(ComposedNode *levelToStop = 0) const;
+      bool operator>(const Node& other) const;
+      bool operator<(const Node& other) const;
+      std::string getImplementation() const;
+      virtual ComposedNode *getRootNode() const throw(Exception);
       virtual void setProperty(const std::string& name,const std::string& value);
       virtual Node *getChildByName(const std::string& name) const throw(Exception) = 0;
       virtual void accept(Visitor *visitor) = 0;
@@ -121,6 +129,16 @@ namespace YACS
       int getNumId();
       virtual void sendEvent(const std::string& event);
       static std::map<int,Node *> 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 void modified();
+      virtual int isModified(){return _modified;}
+      virtual int isValid();
+      virtual void edUpdateState();
+      virtual std::string getErrorReport();
+      virtual std::string getContainerLog();
+      virtual void ensureLoading();
     protected:
       virtual void exForwardFailed();
       virtual void exForwardFinished();
@@ -129,7 +147,6 @@ namespace YACS
       static ComposedNode *checkHavingCommonFather(Node *node1, Node *node2) throw(Exception);
     };
 
-    void StateLoader(Node* node, YACS::StatesForNode state);
   }
 }