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.
This commit is contained in:
eap 2008-05-30 09:26:48 +00:00
parent ce5a49c530
commit e8ee05e869
2 changed files with 17 additions and 16 deletions

View File

@ -258,9 +258,18 @@ SMESH_Mesh_i::ImportMEDFile( const char* theFileName, const char* theMeshName )
THROW_SALOME_CORBA_EXCEPTION("ImportMEDFile(): unknown exception", SALOME::BAD_PARAM); THROW_SALOME_CORBA_EXCEPTION("ImportMEDFile(): unknown exception", SALOME::BAD_PARAM);
} }
myFile = theFileName;
CreateGroupServants(); 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); return ConvertDriverMEDReadStatus(status);
} }
@ -2504,22 +2513,14 @@ SMESH::ListOfGroups* SMESH_Mesh_i::GetGroups(const list<int>& groupIDs) const
* \brief Return information about imported file * \brief Return information about imported file
*/ */
//============================================================================= //=============================================================================
SALOME_MED::MedFileInfo* SMESH_Mesh_i::GetMEDFileInfo() SALOME_MED::MedFileInfo* SMESH_Mesh_i::GetMEDFileInfo()
{ {
SALOME_MED::MedFileInfo_var res = new SALOME_MED::MedFileInfo(); SALOME_MED::MedFileInfo_var res( myFileInfo );
if ( !res.operator->() ) {
const char* name = myFile.c_str(); res = new SALOME_MED::MedFileInfo;
res->fileName = name; res->fileName = "";
res->fileSize = 0;//myFileInfo.size(); res->fileSize = res->major = res->minor = res->release = -1;
int major, minor, release;
if( !MED::getMEDVersion( name, major, minor, release ) )
{
major = -1;
minor = -1;
release = -1;
} }
res->major = major;
res->minor = minor;
res->release = release;
return res._retn(); return res._retn();
} }

View File

@ -459,7 +459,7 @@ private:
map<int, SMESH::SMESH_subMesh_ptr> _mapSubMeshIor; map<int, SMESH::SMESH_subMesh_ptr> _mapSubMeshIor;
map<int, SMESH::SMESH_GroupBase_ptr> _mapGroups; map<int, SMESH::SMESH_GroupBase_ptr> _mapGroups;
map<int, SMESH::SMESH_Hypothesis_ptr> _mapHypo; map<int, SMESH::SMESH_Hypothesis_ptr> _mapHypo;
string myFile; SALOME_MED::MedFileInfo_var myFileInfo;
}; };
#endif #endif