]> SALOME platform Git repositories - modules/yacs.git/blobdiff - src/py2yacs/py2yacs.cxx
Salome HOME
Merge master branch into V9_dev
[modules/yacs.git] / src / py2yacs / py2yacs.cxx
index 253a7be5409ddb28fc05fe2c7900b0545fd65a45..02a03ac6b9d7a4e90e14063307831f7f30b7b6c2 100644 (file)
@@ -381,4 +381,76 @@ YACS::ENGINE::Proc* Py2yacs::createProc(const std::string& python_function)const
   node->setExecutionMode(YACS::ENGINE::InlineNode::REMOTE_STR);
   node->setContainer(schema->containerMap["DefaultContainer"]);
   return schema;
+}
+
+std::string Py2yacs::getAllErrors()const
+{
+  std::stringstream buffer;
+  buffer.clear();
+  if(! _global_errors.empty())
+  {
+    buffer << "Global errors:" << std::endl;
+    std::list<std::string>::const_iterator it;
+    for(it=_global_errors.begin(); it!=_global_errors.end(); it++)
+    {
+      buffer << *it << std::endl;
+    }
+    buffer << "-----------------------------------------" << std::endl;
+  }
+
+  std::list<FunctionProperties>::const_iterator it_fp;
+  for(it_fp=_functions.begin();it_fp!=_functions.end();it_fp++)
+  {
+    if(! it_fp->_errors.empty())
+    {
+      buffer << "Function " << it_fp->_name << " has errors:" << std::endl;
+      std::list<std::string>::const_iterator it;
+      buffer << "Errors :" ;
+      for(it=it_fp->_errors.begin();it!=it_fp->_errors.end();it++)
+        buffer << *it << std::endl;
+      buffer << "-----------------------------------------" << std::endl;
+    }
+  }
+  return buffer.str();
+}
+
+std::string Py2yacs::getFunctionErrors(const std::string& functionName)const
+{
+  std::stringstream buffer;
+  buffer.clear();
+  if(! _global_errors.empty())
+  {
+    buffer << "Global errors:" << std::endl;
+    std::list<std::string>::const_iterator it;
+    for(it=_global_errors.begin(); it!=_global_errors.end(); it++)
+    {
+      buffer << *it << std::endl;
+    }
+    buffer << "-----------------------------------------" << std::endl;
+  }
+
+  bool nameFound = false;
+  std::list<FunctionProperties>::const_iterator it_fp;
+  for(it_fp=_functions.begin(); it_fp!=_functions.end() && !nameFound; it_fp++)
+  {
+    if(it_fp->_name == functionName)
+    {
+      nameFound = true;
+      if(! it_fp->_errors.empty())
+      {
+        buffer << "Function " << it_fp->_name << " has errors:" << std::endl;
+        std::list<std::string>::const_iterator it;
+        buffer << "Errors :" ;
+        for(it=it_fp->_errors.begin();it!=it_fp->_errors.end();it++)
+          buffer << *it << std::endl;
+        buffer << "-----------------------------------------" << std::endl;
+      }
+    }
+  }
+
+  if(!nameFound)
+  {
+    buffer << "Function " << functionName << " not found." << std::endl;
+  }
+  return buffer.str();
 }
\ No newline at end of file