Salome HOME
Remove c++11 warnings about throw specification.
[modules/yacs.git] / src / yacsloader / LoadState.hxx
index ed82bf675c44082993a2f06f7b6566b5d7eb89fa..e671c4672e3deac50d15d14bc071084e9b0e2fe3 100644 (file)
@@ -1,28 +1,33 @@
-//  Copyright (C) 2006-2008  CEA/DEN, EDF R&D
+// Copyright (C) 2006-2019  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 __LOADSTATE_HXX_
 #define __LOADSTATE_HXX_
 
+#include "YACSloaderExport.hxx"
 #include "xmlParserBase.hxx"
+#include "InputPort.hxx"
 
 #include "define.hxx"
 #include "Exception.hxx"
+#include <vector>
+#include <list>
 
 namespace YACS
 {
@@ -30,19 +35,22 @@ namespace YACS
   {
     class Proc;
     class Runtime;
+    class SequenceAny;
+    class Any;
+    class TypeCode;
 
     //! Load state from a file into a Proc
     /*!
      * \param p: the Proc
      * \param xmlStateFile: the file name
      */
-    void loadState(YACS::ENGINE::Proc *p,const std::string& xmlStateFile);
+    YACSLOADER_EXPORT void loadState(YACS::ENGINE::Proc *p,const std::string& xmlStateFile);
 
     /*! \brief class for parse an xml file, use a dedicated parser, to load a
      *  saved state of a SALOME execution.
      */
 
-    class stateLoader: public xmlReader
+    class YACSLOADER_EXPORT stateLoader: public xmlReader
     {
     public:
       stateLoader(xmlParserBase* parser,
@@ -69,7 +77,7 @@ namespace YACS
      *  defined in the xml file
      */
 
-    class stateParser: public xmlParserBase
+    class YACSLOADER_EXPORT stateParser: public xmlParserBase
     {
     public:
       static XMLReadState _state;
@@ -94,7 +102,8 @@ namespace YACS
       static std::map<std::string, YACS::StatesForNode> _nodeStates;
     };
 
-    class graphParser: public stateParser
+#ifndef SWIG
+    class YACSLOADER_EXPORT graphParser: public stateParser
     {
     public:
       virtual void init(const xmlChar** p, xmlParserBase* father=0);
@@ -103,17 +112,21 @@ namespace YACS
     };
 
 
-    class nodeParser: public stateParser
+    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 attrParser: public stateParser
+    class YACSLOADER_EXPORT attrParser: public stateParser
     {
     public:
       virtual void init(const xmlChar** p, xmlParserBase* father=0);
@@ -124,7 +137,7 @@ namespace YACS
     };
 
 
-    class portParser: public stateParser
+    class YACSLOADER_EXPORT portParser: public stateParser
     {
     public:
       virtual void init(const xmlChar** p, xmlParserBase* father=0);
@@ -133,7 +146,7 @@ namespace YACS
       virtual void addData(std::string value);
     };
 
-    class valueParser: public stateParser
+    class YACSLOADER_EXPORT valueParser: public stateParser
     {
     public:
       virtual void init(const xmlChar** p, xmlParserBase* father=0);
@@ -142,7 +155,7 @@ namespace YACS
       virtual void addData(std::string value);
     };
 
-    class arrayParser: public stateParser
+    class YACSLOADER_EXPORT arrayParser: public stateParser
     {
     public:
       virtual void init(const xmlChar** p, xmlParserBase* father=0);
@@ -151,7 +164,7 @@ namespace YACS
       virtual void addData(std::string value);
     };
 
-    class dataParser: public stateParser
+    class YACSLOADER_EXPORT dataParser: public stateParser
     {
     public:
       virtual void init(const xmlChar** p, xmlParserBase* father=0);
@@ -161,15 +174,46 @@ namespace YACS
       std::list<std::string> _dataList;
     };
 
-    class simpleTypeParser: public stateParser
+    class YACSLOADER_EXPORT simpleTypeParser: 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);
+    };
+
+    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