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 __YACSEVALPORT_HXX__
22 #define __YACSEVALPORT_HXX__
24 #include "YACSEvalYFXExport.hxx"
45 YACSEVALYFX_EXPORT virtual ~YACSEvalAny() { }
46 YACSEVALYFX_EXPORT virtual std::string getTypeOfData() const = 0;
47 YACSEVALYFX_EXPORT virtual int toInt() const = 0;
48 YACSEVALYFX_EXPORT virtual double toDouble() const = 0;
49 YACSEVALYFX_EXPORT virtual YACSEvalAny *deepCpy() const = 0;
52 class YACSEvalAnyDouble : public YACSEvalAny
55 YACSEVALYFX_EXPORT YACSEvalAnyDouble(double val):_v(val) { }
56 YACSEVALYFX_EXPORT std::string getTypeOfData() const { return std::string(TYPE_REPR); }
57 YACSEVALYFX_EXPORT int toInt() const;
58 YACSEVALYFX_EXPORT double toDouble() const;
59 YACSEVALYFX_EXPORT YACSEvalAnyDouble *deepCpy() const;
60 YACSEVALYFX_EXPORT ~YACSEvalAnyDouble() { }
64 static const char TYPE_REPR[];
67 class YACSEvalAnyInt : public YACSEvalAny
70 YACSEVALYFX_EXPORT YACSEvalAnyInt(int val):_v(val) { }
71 YACSEVALYFX_EXPORT std::string getTypeOfData() const { return std::string(TYPE_REPR); }
72 YACSEVALYFX_EXPORT int toInt() const;
73 YACSEVALYFX_EXPORT double toDouble() const;
74 YACSEVALYFX_EXPORT YACSEvalAnyInt *deepCpy() const;
75 YACSEVALYFX_EXPORT ~YACSEvalAnyInt() { }
79 static const char TYPE_REPR[];
85 YACSEVALYFX_EXPORT virtual std::string getTypeOfData() const = 0;
86 YACSEVALYFX_EXPORT virtual ~YACSEvalPort() { }
88 YACSEVALYFX_EXPORT static std::string GetTypeOfData(const YACS::ENGINE::DataPort *port);
91 class YACSEvalInputPort : public YACSEvalPort
94 YACSEVALYFX_EXPORT YACSEvalInputPort(YACS::ENGINE::InputPort *ptr);
95 YACSEVALYFX_EXPORT std::string getName() const;
96 YACSEVALYFX_EXPORT std::string getTypeOfData() const;
97 YACSEVALYFX_EXPORT bool isOKForLock() const;
99 YACSEVALYFX_EXPORT bool hasDefaultValueDefined() const;
100 YACSEVALYFX_EXPORT YACSEvalAny *getDefaultValueDefined() const;
101 YACSEVALYFX_EXPORT void setDefaultValue(const YACSEvalAny *parameter);
102 YACSEVALYFX_EXPORT void setSequenceOfValuesToEval(const YACSEvalSeqAny* vals);
103 YACSEVALYFX_EXPORT bool hasSequenceOfValuesToEval() const;
104 YACSEVALYFX_EXPORT bool isRandomVar() const { return _isRandom; }
105 YACSEVALYFX_EXPORT void declareRandomnessStatus(bool isRandom);
107 YACSEVALYFX_EXPORT YACS::ENGINE::InputPort *getUndergroundPtr() const { return _ptr; }
108 YACSEVALYFX_EXPORT std::size_t initializeUndergroundWithSeq() const;
110 YACSEVALYFX_EXPORT virtual ~YACSEvalInputPort();
111 void lock() const { _isLocked=true; }
112 void unlock() const { _isLocked=false; _isRandom=false; }
113 void setUndergroundPortToBeSet(YACS::ENGINE::InputPyPort *p) const;
115 YACSEvalAny *convertFromInternalAnyToExternal(YACS::ENGINE::Any *data) const;
116 void checkForNonConstMethod() const;
118 YACS::ENGINE::InputPort * _ptr;
119 YACSEvalSeqAny *_mySeq;
120 mutable bool _isRandom;
121 mutable bool _isLocked;
122 mutable YACS::ENGINE::InputPyPort *_undergroundPort;
125 class YACSEvalOutputPort : public YACSEvalPort
128 YACSEVALYFX_EXPORT YACSEvalOutputPort(YACS::ENGINE::OutputPort *ptr);
129 YACSEVALYFX_EXPORT std::string getName() const;
130 YACSEVALYFX_EXPORT std::string getTypeOfData() const;
132 YACSEVALYFX_EXPORT YACS::ENGINE::OutputPort *getUndergroundPtr() const { return _ptr; }
135 YACS::ENGINE::OutputPort * _ptr;