X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FStdMeshers_I%2FStdMeshers_ObjRefUlils.hxx;h=c4a342b46e8aa6249385ff836e8a08bdd186e653;hp=4556810cfe75cd43982a5149db512e0a775dd61d;hb=d9f4b53e489dd5857db264ede6acded7b076c9f1;hpb=0635c9fc80f67d1e5dc0e94ec85f487286a92070 diff --git a/src/StdMeshers_I/StdMeshers_ObjRefUlils.hxx b/src/StdMeshers_I/StdMeshers_ObjRefUlils.hxx index 4556810cf..c4a342b46 100644 --- a/src/StdMeshers_I/StdMeshers_ObjRefUlils.hxx +++ b/src/StdMeshers_I/StdMeshers_ObjRefUlils.hxx @@ -1,25 +1,26 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2022 CEA/DEN, EDF R&D, OPEN CASCADE // -// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// 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 // -// SMESH SMESH : implementaion of SMESH idl descriptions + +// SMESH SMESH : implementation of SMESH idl descriptions // File : StdMeshers_ObjRefUlils.hxx // Created : Wed Oct 18 15:15:27 2006 // Author : Edward AGAPOV (eap) @@ -28,6 +29,7 @@ #define StdMeshers_ObjRefUlils_HeaderFile #include "SMESH_Gen_i.hxx" +#include "SMESH_StdMeshers_I.hxx" /*! * \brief Class encapsulates methods @@ -41,7 +43,7 @@ class StdMeshers_ObjRefUlils { public: /*! - * \brief Return GEOM Object correspoding to TopoDS_Shape + * \brief Return GEOM Object corresponding to TopoDS_Shape * \param theShape - input TopoDS_Shape * \retval GEOM::GEOM_Object_ptr - result object */ @@ -53,7 +55,7 @@ public: } /*! - * \brief Return TopoDS_Shape correspoding to GEOM_Object + * \brief Return TopoDS_Shape corresponding to GEOM_Object * \param theGeomObject - input object * \retval TopoDS_Shape - result TopoDS_Shape */ @@ -64,6 +66,25 @@ public: return TopoDS_Shape(); } + /*! + * \brief Return TopoDS_Shape by a study entry + * \param theEntry - study entry + * \retval TopoDS_Shape - result TopoDS_Shape + */ + STDMESHERS_I_EXPORT static TopoDS_Shape EntryToShape(const std::string theEntry); + + /*! + * \brief Return study entry of GEOM Object + */ + static std::string GeomObjectToEntry(GEOM::GEOM_Object_ptr theGeomObject); + + /*! + * \brief Return GEOM Object by its study entry or TopoDS_Shape + */ + static GEOM::GEOM_Object_ptr EntryOrShapeToGeomObject (const std::string& theEntry, + const TopoDS_Shape& theShape); + + /*! * \brief Store the shape in the stream * \param theShape - shape to store @@ -76,14 +97,14 @@ public: * \param stream - the stream * \retval TopoDS_Shape - resulting shape */ - static TopoDS_Shape LoadFromStream( std::istream & stream); + static TopoDS_Shape LoadFromStream( std::istream & stream, std::string* entry=NULL ); /*! * \brief Store the CORBA object in the stream * \param obj - object to store * \param stream - the stream */ - static void SaveToStream( CORBA::Object_ptr obj, std::ostream & stream); + static void SaveToStream( CORBA::Object_ptr obj, std::ostream & stream ); /*! * \brief Retrieve a CORBA object from the stream @@ -97,8 +118,8 @@ public: if (SMESH_Gen_i* gen = SMESH_Gen_i::GetSMESHGen()) { std::string str; if (stream >> str) { - if ( StudyContext* myStudyContext = gen->GetCurrentStudyContext() ) { - string ior = myStudyContext->getIORbyOldId( atoi( str.c_str() )); + if ( StudyContext* myStudyContext = gen->GetStudyContext() ) { + std::string ior = myStudyContext->getIORbyOldId( atoi( str.c_str() )); if ( !ior.empty() ) return TInterface::_narrow(gen->GetORB()->string_to_object( ior.c_str() )); } @@ -106,6 +127,14 @@ public: } return TInterface::_nil(); } + + /*! + * \brief Store the study entry of object in the stream + * \param studyEntry - the study entry + * \param stream - the stream + */ + static void SaveToStream( const std::string& studyEntry, std::ostream & stream); + }; #endif