X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FMEDLoader%2FMEDFileUtilities.cxx;h=4aaf594477c7db0a43230999a8bf5c3601af1c4b;hb=c523c06a8b0426af2deea99a4d136df097eea1f7;hp=7d529b4135c8c612bac166888c7598a5cb302e41;hpb=de8da643a7f441fb2154818cde04b7b24ca76bb4;p=tools%2Fmedcoupling.git diff --git a/src/MEDLoader/MEDFileUtilities.cxx b/src/MEDLoader/MEDFileUtilities.cxx index 7d529b413..4aaf59447 100644 --- a/src/MEDLoader/MEDFileUtilities.cxx +++ b/src/MEDLoader/MEDFileUtilities.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D +// Copyright (C) 2007-2015 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. +// 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 @@ -23,10 +23,10 @@ #include -med_access_mode MEDFileUtilities::TraduceWriteMode(int medloaderwritemode) throw(INTERP_KERNEL::Exception) +med_access_mode MEDFileUtilities::TraduceWriteMode(int medloaderwritemode) { switch(medloaderwritemode) - { + { case 2: return MED_ACC_CREAT; case 1: @@ -35,16 +35,16 @@ med_access_mode MEDFileUtilities::TraduceWriteMode(int medloaderwritemode) throw return MED_ACC_RDWR; default: throw INTERP_KERNEL::Exception("Invalid write mode specified ! must be 0(write with no question), 1(append) or 2(creation)"); - } + } } -const char *MEDFileUtilities::GetReadableMEDFieldType(med_field_type ft) throw(INTERP_KERNEL::Exception) +const char *MEDFileUtilities::GetReadableMEDFieldType(med_field_type ft) { static const char medFloat64[]="MED_FLOAT64"; static const char medInt32[]="MED_INT32"; static const char medInt64[]="MED_INT64"; switch(ft) - { + { case MED_FLOAT64: return medFloat64; case MED_INT32: @@ -53,10 +53,10 @@ const char *MEDFileUtilities::GetReadableMEDFieldType(med_field_type ft) throw(I return medInt64; default: throw INTERP_KERNEL::Exception("Non supported field type ! Should be FLOAT64, INT32 or INT64 !"); - } + } } -void MEDFileUtilities::CheckMEDCode(int code, med_idt fid, const char *msg) throw(INTERP_KERNEL::Exception) +void MEDFileUtilities::CheckMEDCode(int code, med_idt fid, const std::string& msg) { if(code<0) { @@ -66,13 +66,13 @@ void MEDFileUtilities::CheckMEDCode(int code, med_idt fid, const char *msg) thro } } -void MEDFileUtilities::CheckFileForRead(const char *fileName) throw(INTERP_KERNEL::Exception) +void MEDFileUtilities::CheckFileForRead(const std::string& fileName) { int status=MEDLoaderBase::getStatusOfFile(fileName); std::ostringstream oss; oss << " File : \"" << fileName << "\""; switch(status) - { + { case MEDLoaderBase::DIR_LOCKED: { oss << " has been detected as unreadable : impossible to read anything !"; @@ -88,8 +88,8 @@ void MEDFileUtilities::CheckFileForRead(const char *fileName) throw(INTERP_KERNE oss << " has been detected as WRITE ONLY : impossible to read anything !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - } - AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY); + } + AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); if(fid<0) { oss << " has been detected as unreadable by MED file : impossible to read anything !"; @@ -109,44 +109,39 @@ MEDFileUtilities::AutoFid::AutoFid(med_idt fid):_fid(fid) { } -MEDFileUtilities::AutoFid::operator med_idt() const -{ - return _fid; -} - MEDFileUtilities::AutoFid::~AutoFid() { MEDfileClose(_fid); } -ParaMEDMEM::MEDFileWritable::MEDFileWritable():_too_long_str(0),_zipconn_pol(2) +MEDCoupling::MEDFileWritable::MEDFileWritable():_too_long_str(0),_zipconn_pol(2) { } -void ParaMEDMEM::MEDFileWritable::copyOptionsFrom(const MEDFileWritable& other) const +void MEDCoupling::MEDFileWritable::copyOptionsFrom(const MEDFileWritable& other) const { _too_long_str=other._too_long_str; _zipconn_pol=other._zipconn_pol; } -int ParaMEDMEM::MEDFileWritable::getTooLongStrPolicy() const throw(INTERP_KERNEL::Exception) +int MEDCoupling::MEDFileWritable::getTooLongStrPolicy() const { return _too_long_str; } -void ParaMEDMEM::MEDFileWritable::setTooLongStrPolicy(int newVal) throw(INTERP_KERNEL::Exception) +void MEDCoupling::MEDFileWritable::setTooLongStrPolicy(int newVal) { if(newVal!=2 && newVal!=1 && newVal!=0) throw INTERP_KERNEL::Exception("MEDFileWritable::setTooLongStrPolicy : invalid policy should be in 0,1 or 2 !"); _too_long_str=newVal; } -int ParaMEDMEM::MEDFileWritable::getZipConnPolicy() throw(INTERP_KERNEL::Exception) +int MEDCoupling::MEDFileWritable::getZipConnPolicy() { return _zipconn_pol; } -void ParaMEDMEM::MEDFileWritable::setZipConnPolicy(int newVal) throw(INTERP_KERNEL::Exception) +void MEDCoupling::MEDFileWritable::setZipConnPolicy(int newVal) { _zipconn_pol=newVal; }