X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FSWIG%2FStudyData_Swig.i;h=f6121fbcd6839390709dc8748c3127c91048f7ac;hb=6a1ca8d833e9b3d06da192cc3e14704885a99098;hp=88a0b656fa11f979cb59bcfe5b37992ff77700ad;hpb=942bc17cb52885f016005115559687748891b64b;p=modules%2Fshaper_study.git diff --git a/src/SWIG/StudyData_Swig.i b/src/SWIG/StudyData_Swig.i index 88a0b65..f6121fb 100644 --- a/src/SWIG/StudyData_Swig.i +++ b/src/SWIG/StudyData_Swig.i @@ -1,13 +1,70 @@ - +// Copyright (C) 2019-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, 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. +// +// 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 +// %module StudyData_Swig %{ #include "StudyData_Object.h" +#include "StudyData_Operation.h" +#include "StudyData_XAO.h" + +#include +#include +#include + +static PyObject* setOCCException(Standard_Failure& ex) +{ + std::string msg(ex.DynamicType()->Name()); + if ( ex.GetMessageString() && strlen( ex.GetMessageString() )) { + msg += ": "; + msg += ex.GetMessageString(); + } + PyErr_SetString(PyExc_Exception, msg.c_str() ); + return NULL; +} %} -class StudyData_Object +%exception { -public: - StudyData_Object(const std::string theFile); -}; + try { + OCC_CATCH_SIGNALS; + $action } + catch (Standard_Failure& ex) { + return setOCCException(ex); + } + catch (std::exception& ex) { + PyErr_SetString(PyExc_Exception, ex.what() ); + return NULL; + } +} + +// standard definitions +%include "typemaps.i" +%include "std_string.i" +%include "std_list.i" + +#define StudyData_EXPORT + +%include "StudyData_Object.h" +%include "StudyData_Operation.h" +%include "StudyData_XAO.h" + +%template(LongList) std::list; +%template(PtrsList) std::list; +%template(DoublList) std::list;