]> SALOME platform Git repositories - modules/yacs.git/commitdiff
Salome HOME
Deal with outputports with type different from int/double in evalyfx.
authorAnthony Geay <anthony.geay@edf.fr>
Fri, 16 Oct 2015 16:02:03 +0000 (18:02 +0200)
committerAnthony Geay <anthony.geay@edf.fr>
Fri, 16 Oct 2015 16:02:03 +0000 (18:02 +0200)
src/evalyfx/YACSEvalPort.cxx
src/evalyfx/YACSEvalPort.hxx
src/evalyfx/YACSEvalYFXPattern.cxx

index 8cc95f235079170c2f4a93f6874b62417f6f10e1..190fa1ef2d636850dc50072ca72ee2707e9a483f 100644 (file)
@@ -81,6 +81,14 @@ bool YACSEvalPort::IsInputPortPublishable(const YACS::ENGINE::InputPort *port)
   return true;
 }
 
+bool YACSEvalPort::IsOutputPortPublishable(const YACS::ENGINE::OutputPort *port)
+{
+  YACS::ENGINE::TypeCode *tc(port->edGetType());
+  if(!tc)
+    throw YACS::Exception("YACSEvalPort::IsOutputPortPublishable : null type code !");
+  return tc->kind()==YACS::ENGINE::Double || tc->kind()==YACS::ENGINE::Int;
+}
+
 std::string YACSEvalPort::GetTypeOfData(const YACS::ENGINE::DataPort *port)
 {
   YACS::ENGINE::TypeCode *tc(port->edGetType());
index 20985f0bbd8b9ab6109ea0a27d7caeb700d802f7..eeb4ecf990063481581a5dbe27e0ab60b32ff789 100644 (file)
@@ -86,6 +86,7 @@ public:
   YACSEVALYFX_EXPORT virtual ~YACSEvalPort() { }
 public:
   YACSEVALYFX_EXPORT static bool IsInputPortPublishable(const YACS::ENGINE::InputPort *port);
+  YACSEVALYFX_EXPORT static bool IsOutputPortPublishable(const YACS::ENGINE::OutputPort *port);
 protected:
   YACSEVALYFX_EXPORT static std::string GetTypeOfData(const YACS::ENGINE::DataPort *port);
 };
index 19064f8c95503c96eef0819359b1b9376698b8bf..1feacd39c947341bf59309a20ef94ec95ffdb97a 100644 (file)
@@ -548,17 +548,20 @@ void YACSEvalYFXRunOnlyPattern::buildOutputPorts()
   for(std::list< YACS::ENGINE::OutputPort *>::const_iterator it=allOutputPorts.begin();it!=allOutputPorts.end();it++)
     {
       YACS::ENGINE::OutputPort *elt(*it);
-      if(!elt)
-        throw YACS::Exception("YACSEvalYFXRunOnlyPattern::buildOutputPorts : presence of null output !");
-      std::string outpName(elt->getName());
-      if(outpName.empty())
-        throw YACS::Exception("YACSEvalYFXRunOnlyPattern::buildOutputPorts : an output has empty name ! Should not !");
-      if(std::find(allNames.begin(),allNames.end(),outpName)!=allNames.end())
+      if(YACSEvalPort::IsOutputPortPublishable(elt))
         {
-          std::ostringstream oss; oss << "YACSEvalYFXRunOnlyPattern::buildOutputPorts : output name \"" << outpName << "\" appears more than once !";
-          throw YACS::Exception(oss.str());
+          if(!elt)
+            throw YACS::Exception("YACSEvalYFXRunOnlyPattern::buildOutputPorts : presence of null output !");
+          std::string outpName(elt->getName());
+          if(outpName.empty())
+            throw YACS::Exception("YACSEvalYFXRunOnlyPattern::buildOutputPorts : an output has empty name ! Should not !");
+          if(std::find(allNames.begin(),allNames.end(),outpName)!=allNames.end())
+            {
+              std::ostringstream oss; oss << "YACSEvalYFXRunOnlyPattern::buildOutputPorts : output name \"" << outpName << "\" appears more than once !";
+              throw YACS::Exception(oss.str());
+            }
+          _outputs.push_back(YACSEvalOutputPort(*it));
         }
-      _outputs.push_back(YACSEvalOutputPort(*it));
     }
 }