From: eap Date: Wed, 6 Dec 2006 15:36:30 +0000 (+0000) Subject: PAL13473 (Build repetitive mesh): X-Git-Tag: V3_2_4pre1~23 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=5b836386bb3fa599499837b59454778b5a9b932b;p=modules%2Fsmesh.git PAL13473 (Build repetitive mesh): add a) int GetObjectId(CORBA::Object_ptr), b) TInterface::_var_type GetObjectByOldId( const int oldID ) --- diff --git a/src/SMESH_I/SMESH_Gen_i.hxx b/src/SMESH_I/SMESH_Gen_i.hxx index e0a316c05..de1e50e0c 100644 --- a/src/SMESH_I/SMESH_Gen_i.hxx +++ b/src/SMESH_I/SMESH_Gen_i.hxx @@ -104,6 +104,15 @@ public: void mapOldToNew( const int oldId, const int newId ) { mapIdToId[ oldId ] = newId; } + // get old id by a new one + int getOldId( const int newId ) { + map::iterator imap; + for ( imap = mapIdToId.begin(); imap != mapIdToId.end(); ++imap ) { + if ( imap->second == newId ) + return imap->first; + } + return 0; + } private: // get next free object identifier @@ -399,6 +408,21 @@ public: // Register an object in a StudyContext; return object id int RegisterObject(CORBA::Object_ptr theObject); + // Return id of registered object + int GetObjectId(CORBA::Object_ptr theObject); + + // Return an object that previously had an oldID + template + typename TInterface::_var_type GetObjectByOldId( const int oldID ) + { + if ( StudyContext* myStudyContext = GetCurrentStudyContext() ) { + string ior = myStudyContext->getIORbyOldId( oldID ); + if ( !ior.empty() ) + return TInterface::_narrow(GetORB()->string_to_object( ior.c_str() )); + } + return TInterface::_nil(); + } + // Get current study ID int GetCurrentStudyID() { return myCurrentStudy->_is_nil() ? -1 : myCurrentStudy->StudyId(); }