Salome HOME
Fix missing returns.
[modules/yacs.git] / src / engine / Pool.cxx
index b49fa937e105b819208480929a2a62daf6b58103..53d1465acbee2061d67a8659fab39931b9e9bfb5 100644 (file)
@@ -1,21 +1,22 @@
-//  Copyright (C) 2006-2008  CEA/DEN, EDF R&D
+// Copyright (C) 2006-2021  CEA/DEN, EDF R&D
 //
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
 //
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
 //
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
+
 #include "Pool.hxx"
 #include "Any.hxx"
 
@@ -74,6 +75,42 @@ bool Pool::ExpData::isLaunchable() const
   return _out==NOT_USED_NOR_COMPUTED;
 }
 
+int Pool::getCurrentId() const 
+{ 
+  if(empty())
+    throw YACS::Exception("no current case set in pool");
+  else
+    return _currentCase->first; 
+}
+Any *Pool::getCurrentInSample() const 
+{ 
+  if(empty())
+    throw YACS::Exception("no current case set in pool");
+  else
+    return (*_currentCase).second.inValue(); 
+}
+
+Any *Pool::getCurrentOutSample() const 
+{ 
+  if(empty())
+    throw YACS::Exception("no current case set in pool");
+  else
+    return (*_currentCase).second.outValue(); 
+}
+
+Any *Pool::getOutSample(int id)
+{
+  if(empty())
+    throw YACS::Exception("no current case set in pool");
+
+  std::list< std::pair<int, ExpData> >::iterator iter;
+  for(iter=_container.begin();iter!=_container.end();iter++)
+    if((*iter).first==id)
+        return (*iter).second.outValue();
+  throw YACS::Exception("no current case set in pool");
+}
+
+
 //! Push a sample. \b WARNING inSample ownership is released to current Pool instance (this) !
 void Pool::pushInSample(int id, Any *inSample, unsigned char priority)
 {
@@ -99,7 +136,7 @@ void Pool::destroyCurrentCase()
  * corrupted 'this'.
  *
  */
-void Pool::checkConsistency() throw(Exception)
+void Pool::checkConsistency()
 {
   // First check unicity of ids.
   std::set<int> ids;
@@ -119,7 +156,7 @@ void Pool::checkConsistency() throw(Exception)
 /*!
  * \throw See the \b throw case of pushOutSampleAt method.
  */
-void Pool::setCurrentId(int id) throw(Exception)
+void Pool::setCurrentId(int id)
 {
   std::list< std::pair<int, ExpData> >::iterator iter;
   for(iter=_container.begin();iter!=_container.end();iter++)
@@ -140,7 +177,7 @@ void Pool::setCurrentId(int id) throw(Exception)
  *        has destroyed a case id different from its id.
  *
  */
-void Pool::putOutSampleAt(int id, Any *outValue) throw(Exception)
+void Pool::putOutSampleAt(int id, Any *outValue)
 {
   std::list< std::pair<int, ExpData> >::iterator iter;
   for(iter=_container.begin();iter!=_container.end();iter++)