Salome HOME
bos #26594 Failed KERNEL test: fix typemap for swig 4x
[modules/yacs.git] / src / yacsloader / LoadState.hxx
index 865256c32ebe84d98600c317e7a3ec40a8fe01e6..633589eca1347c414b1999cc1d585258a7cd3f71 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2006-2014  CEA/DEN, EDF R&D
+// Copyright (C) 2006-2021  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
 
 #include "YACSloaderExport.hxx"
 #include "xmlParserBase.hxx"
+#include "InputPort.hxx"
 
 #include "define.hxx"
 #include "Exception.hxx"
+#include <vector>
+#include <list>
 
 namespace YACS
 {
@@ -32,6 +35,9 @@ namespace YACS
   {
     class Proc;
     class Runtime;
+    class SequenceAny;
+    class Any;
+    class TypeCode;
 
     //! Load state from a file into a Proc
     /*!
@@ -96,6 +102,7 @@ namespace YACS
       static std::map<std::string, YACS::StatesForNode> _nodeStates;
     };
 
+#ifndef SWIG
     class YACSLOADER_EXPORT graphParser: public stateParser
     {
     public:
@@ -105,14 +112,18 @@ namespace YACS
     };
 
 
+    class loopPortParser;
     class YACSLOADER_EXPORT nodeParser: public stateParser
     {
     public:
       virtual void init(const xmlChar** p, xmlParserBase* father=0);
       virtual void onStart (const XML_Char* elem, const xmlChar** p);
       virtual void onEnd   (const XML_Char* name);
+      Any* xmlToAny(const std::string& data, const TypeCode* tc)const;
       std::string _nodeName;
       std::string _nodeState;
+    private:
+      std::list<loopPortParser*> _loopSamples;
     };
 
     class YACSLOADER_EXPORT attrParser: public stateParser
@@ -172,6 +183,37 @@ namespace YACS
       virtual void charData(std::string data);
     };
 
+    class YACSLOADER_EXPORT loopPortParser: public stateParser
+    {
+    public:
+      virtual void init(const xmlChar** p, xmlParserBase* father=0);
+      virtual void onStart (const XML_Char* elem, const xmlChar** p);
+      virtual void onEnd   (const XML_Char* name);
+      virtual void charData(std::string data);
+      void addSample(int index, const std::string data);
+      unsigned int getNbSamples()const;
+      unsigned int getSampleId(unsigned int i)const;
+      const std::string& getSampleData(unsigned int i)const;
+      const std::string& getPortName()const;
+    private:
+      std::vector<unsigned int> _ids;
+      std::vector<std::string> _sampleData;
+    };
+
+    class YACSLOADER_EXPORT sampleParser: public stateParser
+    {
+    public:
+      sampleParser(loopPortParser* father);
+      virtual void init(const xmlChar** p, xmlParserBase* father=0);
+      virtual void onStart (const XML_Char* elem, const xmlChar** p);
+      virtual void onEnd   (const XML_Char* name);
+      virtual void charData(std::string data);
+    //protected:
+    //  Any* xmlToAny()throw(ConversionException);
+    private:
+      loopPortParser* _sampleFather;
+    };
+#endif
   }
 }
 #endif