]> SALOME platform Git repositories - modules/yacs.git/blob - src/evalyfx/YACSEvalYFXPattern.hxx
Salome HOME
d3d018e7b63c43d3f4f076f5e2758dcd754954a6
[modules/yacs.git] / src / evalyfx / YACSEvalYFXPattern.hxx
1 // Copyright (C) 2012-2015  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 // 
19 // Author : Anthony Geay (EDF R&D)
20
21 #ifndef __YACSEVALYFXPATTERN_HXX__
22 #define __YACSEVALYFXPATTERN_HXX__
23
24 #include "YACSEvalPort.hxx"
25
26 #include <vector>
27
28 namespace YACS
29 {
30   namespace ENGINE
31   {
32     class Proc;
33     class TypeCode;
34     class ComposedNode;
35     class InputPyPort;
36   }
37 }
38
39 class YACSEvalListOfResources;
40 class ResourcesManager_cpp;
41
42 class YACSEvalYFXPattern
43 {
44 public:
45   virtual ~YACSEvalYFXPattern();
46   std::vector< YACSEvalInputPort *> getFreeInputPorts() const;
47   std::vector< YACSEvalOutputPort *> getFreeOutputPorts() const;
48   static YACSEvalYFXPattern *FindPatternFrom(YACS::ENGINE::Proc *scheme, bool ownScheme);
49   bool isAlreadyComputedResources() const;
50   void checkNonAlreadyComputedResources() const;
51   void checkAlreadyComputedResources() const;
52   void checkLocked() const;
53   void checkNonLocked() const;
54   static void CheckNodeIsOK(YACS::ENGINE::ComposedNode *node);
55   virtual void setOutPortsOfInterestForEvaluation(std::size_t commonSize, const std::vector<YACSEvalOutputPort *>& outputs) = 0;
56   virtual void resetOutputsOfInterest() = 0;
57   virtual void generateGraph() = 0;
58   virtual void resetGeneratedGraph() = 0;
59   virtual int assignNbOfBranches() = 0;
60   virtual bool isLocked() const = 0;
61   virtual YACSEvalListOfResources *giveResources() = 0;
62   virtual YACS::ENGINE::Proc *getUndergroundGeneratedGraph() const = 0;
63   virtual std::vector<YACSEvalSeqAny *> getResults() const = 0;
64 public:
65   static const char DFT_PROC_NAME[];
66 protected:
67   YACSEvalYFXPattern(YACS::ENGINE::Proc *scheme, bool ownScheme);
68   YACS::ENGINE::TypeCode *createSeqTypeCodeFrom(YACS::ENGINE::Proc *scheme, const std::string& zeType);
69   void setResources(YACSEvalListOfResources *res);
70   void resetResources();
71   YACSEvalListOfResources *getResourcesInternal() const { return _res; }
72   ResourcesManager_cpp *getCatalogInAppli() const { return _rm; }
73   static YACSEvalSeqAny *BuildValueInPort(YACS::ENGINE::InputPyPort *port);
74 private:
75   void cleanScheme();
76 private:
77   bool _ownScheme;
78   YACS::ENGINE::Proc *_scheme;
79   ResourcesManager_cpp *_rm;
80   YACSEvalListOfResources *_res;
81 protected:
82   std::vector< YACSEvalInputPort > _inputs;
83   std::vector< YACSEvalOutputPort > _outputs;
84 };
85
86 class YACSEvalYFXRunOnlyPattern : public YACSEvalYFXPattern
87 {
88 public:
89   YACSEvalYFXRunOnlyPattern(YACS::ENGINE::Proc *scheme, bool ownScheme, YACS::ENGINE::ComposedNode *runNode);
90   void setOutPortsOfInterestForEvaluation(std::size_t commonSize, const std::vector<YACSEvalOutputPort *>& outputsOfInterest);
91   void resetOutputsOfInterest();
92   void generateGraph();
93   void resetGeneratedGraph();
94   int assignNbOfBranches();
95   bool isLocked() const;
96   YACSEvalListOfResources *giveResources();
97   YACS::ENGINE::Proc *getUndergroundGeneratedGraph() const;
98   std::vector<YACSEvalSeqAny *> getResults() const;
99   static bool IsMatching(YACS::ENGINE::Proc *scheme, YACS::ENGINE::ComposedNode *& runNode);
100 public:
101   static const char GATHER_NODE_NAME[];
102 private:
103   void buildInputPorts();
104   void buildOutputPorts();
105 private:
106   YACS::ENGINE::ComposedNode *_runNode;
107   std::size_t _commonSz;
108   std::vector<YACSEvalOutputPort *> _outputsOfInterest;
109   YACS::ENGINE::Proc *_generatedGraph;
110 };
111
112 #endif