From e8ee05e869b6cc46fb487546928c68b20a30d205 Mon Sep 17 00:00:00 2001 From: eap Date: Fri, 30 May 2008 09:26:48 +0000 Subject: [PATCH] PAL16760 - MED file information store MedFileInfo instead of file name in order not to open med file every time GetMedFileInfo() is called, which happens at every invoking pop-up of mesh. --- src/SMESH_I/SMESH_Mesh_i.cxx | 31 ++++++++++++++++--------------- src/SMESH_I/SMESH_Mesh_i.hxx | 2 +- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/src/SMESH_I/SMESH_Mesh_i.cxx b/src/SMESH_I/SMESH_Mesh_i.cxx index e844e24ae..a58c5ad0e 100644 --- a/src/SMESH_I/SMESH_Mesh_i.cxx +++ b/src/SMESH_I/SMESH_Mesh_i.cxx @@ -258,9 +258,18 @@ SMESH_Mesh_i::ImportMEDFile( const char* theFileName, const char* theMeshName ) THROW_SALOME_CORBA_EXCEPTION("ImportMEDFile(): unknown exception", SALOME::BAD_PARAM); } - myFile = theFileName; CreateGroupServants(); + int major, minor, release; + if( !MED::getMEDVersion( theFileName, major, minor, release ) ) + major = minor = release = -1; + myFileInfo = new SALOME_MED::MedFileInfo(); + myFileInfo->fileName = theFileName; + myFileInfo->fileSize = 0; + myFileInfo->major = major; + myFileInfo->minor = minor; + myFileInfo->release = release; + return ConvertDriverMEDReadStatus(status); } @@ -2504,22 +2513,14 @@ SMESH::ListOfGroups* SMESH_Mesh_i::GetGroups(const list& groupIDs) const * \brief Return information about imported file */ //============================================================================= + SALOME_MED::MedFileInfo* SMESH_Mesh_i::GetMEDFileInfo() { - SALOME_MED::MedFileInfo_var res = new SALOME_MED::MedFileInfo(); - - const char* name = myFile.c_str(); - res->fileName = name; - res->fileSize = 0;//myFileInfo.size(); - int major, minor, release; - if( !MED::getMEDVersion( name, major, minor, release ) ) - { - major = -1; - minor = -1; - release = -1; + SALOME_MED::MedFileInfo_var res( myFileInfo ); + if ( !res.operator->() ) { + res = new SALOME_MED::MedFileInfo; + res->fileName = ""; + res->fileSize = res->major = res->minor = res->release = -1; } - res->major = major; - res->minor = minor; - res->release = release; return res._retn(); } diff --git a/src/SMESH_I/SMESH_Mesh_i.hxx b/src/SMESH_I/SMESH_Mesh_i.hxx index f149e0093..242548369 100644 --- a/src/SMESH_I/SMESH_Mesh_i.hxx +++ b/src/SMESH_I/SMESH_Mesh_i.hxx @@ -459,7 +459,7 @@ private: map _mapSubMeshIor; map _mapGroups; map _mapHypo; - string myFile; + SALOME_MED::MedFileInfo_var myFileInfo; }; #endif -- 2.39.2