1 // Copyright (C) 2012-2015 CEA/DEN, EDF R&D
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // Author : Anthony Geay (EDF R&D)
21 #ifndef __YACSEVALYFXPATTERN_HXX__
22 #define __YACSEVALYFXPATTERN_HXX__
24 #include "YACSEvalPort.hxx"
39 class YACSEvalListOfResources;
40 class ResourcesManager_cpp;
42 class YACSEvalYFXPattern
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(const std::vector<YACSEvalOutputPort *>& outputs) = 0;
56 virtual void resetOutputsOfInterest() = 0;
57 virtual void generateGraph() = 0;
58 virtual void resetGeneratedGraph() = 0;
59 virtual void assignRandomVarsInputs() = 0;
60 virtual int assignNbOfBranches() = 0;
61 virtual bool isLocked() const = 0;
62 virtual YACSEvalListOfResources *giveResources() = 0;
63 virtual YACS::ENGINE::Proc *getUndergroundGeneratedGraph() const = 0;
64 virtual std::vector<YACSEvalSeqAny *> getResults() const = 0;
66 static const char DFT_PROC_NAME[];
68 YACSEvalYFXPattern(YACS::ENGINE::Proc *scheme, bool ownScheme);
69 YACS::ENGINE::TypeCode *createSeqTypeCodeFrom(YACS::ENGINE::Proc *scheme, const std::string& zeType);
70 void setResources(YACSEvalListOfResources *res);
71 void resetResources();
72 YACSEvalListOfResources *getResourcesInternal() const { return _res; }
73 ResourcesManager_cpp *getCatalogInAppli() const { return _rm; }
74 static YACSEvalSeqAny *BuildValueInPort(YACS::ENGINE::InputPyPort *port);
79 YACS::ENGINE::Proc *_scheme;
80 ResourcesManager_cpp *_rm;
81 YACSEvalListOfResources *_res;
83 std::vector< YACSEvalInputPort > _inputs;
84 std::vector< YACSEvalOutputPort > _outputs;
87 class YACSEvalYFXRunOnlyPattern : public YACSEvalYFXPattern
90 YACSEvalYFXRunOnlyPattern(YACS::ENGINE::Proc *scheme, bool ownScheme, YACS::ENGINE::ComposedNode *runNode);
91 void setOutPortsOfInterestForEvaluation(const std::vector<YACSEvalOutputPort *>& outputsOfInterest);
92 void resetOutputsOfInterest();
94 void resetGeneratedGraph();
95 int assignNbOfBranches();
96 void assignRandomVarsInputs();
97 bool isLocked() const;
98 YACSEvalListOfResources *giveResources();
99 YACS::ENGINE::Proc *getUndergroundGeneratedGraph() const;
100 std::vector<YACSEvalSeqAny *> getResults() const;
101 static bool IsMatching(YACS::ENGINE::Proc *scheme, YACS::ENGINE::ComposedNode *& runNode);
103 static const char GATHER_NODE_NAME[];
105 void buildInputPorts();
106 void buildOutputPorts();
108 YACS::ENGINE::ComposedNode *_runNode;
109 std::vector<YACSEvalOutputPort *> _outputsOfInterest;
110 YACS::ENGINE::Proc *_generatedGraph;