MAJ_version.c
Aller à la documentation de ce fichier.
/* This file is part of MED.
*
* COPYRIGHT (C) 1999 - 2021 EDF R&D, CEA/DEN
* MED 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 3 of the License, or
* (at your option) any later version.
*
* MED 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 MED. If not, see <http://www.gnu.org/licenses/>.
*/
#include "med_config.h"
#include <med.h>
#include <med_outils.h>
#include "MAJ_version.h"
void MAJ_version_num(med_idt fid, const int majeur, const int mineur, const int release )
{
static med_file_version _fileversion = MED_FILE_VERSION_INIT;
_fileversion.majeur = majeur ;
_fileversion.mineur = mineur ;
_fileversion.release = release;
_MEDfileVersionSetCache(fid,_fileversion);
}
void MAJ_write_version_num(med_idt fid, const int majeur, const int mineur, const int release )
{
med_err ret;
med_idt gid;
med_int _majeur=majeur, _mineur=mineur, _release=release;
gid = _MEDdatagroupOuvrir(fid,MED_INFOS);
if (gid < 0)
gid = _MEDdatagroupCreer(fid,MED_INFOS);
ret = _MEDattributeIntWr(gid,MED_NOM_MAJEUR,&_majeur);
EXIT_IF(ret < 0,"Ecriture du numéro majeur",NULL);
ret = _MEDattributeIntWr(gid,MED_NOM_MINEUR,&_mineur);
EXIT_IF(ret < 0,"Ecriture du numéro mineur",NULL);
ret = _MEDattributeIntWr(gid,MED_NOM_RELEASE,&_release);
EXIT_IF(ret < 0,"Ecrriture du numéro de release",NULL);
ret = _MEDdatagroupFermer(gid);
EXIT_IF(ret < 0,"Fermeture du groupe HDF MED_INFOS",NULL);
}
void MAJ_version(med_idt fid)
{
med_err ret;
med_idt gid;
med_int majeur, mineur, release;
/* On ecrit le bon numero de version */
majeur = MED_NUM_MAJEUR ;
mineur = MED_NUM_MINEUR ;
release = MED_NUM_RELEASE;
MAJ_version_num(fid, majeur, mineur, release );
}
MED_NOM_MAJEUR
#define MED_NOM_MAJEUR
Definition: med_outils.h:30
_MEDdatagroupFermer
MEDC_EXPORT med_err _MEDdatagroupFermer(med_idt id)
MAJ_version_num
void MAJ_version_num(med_idt fid, const int majeur, const int mineur, const int release)
Definition: MAJ_version.c:23
med_idt
hid_t med_idt
Definition: med.h:331
_MEDattributeIntWr
#define _MEDattributeIntWr(w, x, y)
Definition: med_hdfi.h:45
med_err
herr_t med_err
Definition: med.h:332
MED_FILE_VERSION_INIT
#define MED_FILE_VERSION_INIT
Definition: med.h:388
MED_NUM_RELEASE
#define MED_NUM_RELEASE
Definition: med.h:67
med_file_version::majeur
med_int majeur
Definition: med.h:386
MAJ_version
void MAJ_version(med_idt fid)
Definition: MAJ_version.c:60
med_file_version
Structure d'acceuil du numéro de version MED d'un fichier.
Definition: med.h:385
MED_NOM_RELEASE
#define MED_NOM_RELEASE
Definition: med_outils.h:32
med_int
int med_int
Definition: med.h:342
med.h
MED_NOM_MINEUR
#define MED_NOM_MINEUR
Definition: med_outils.h:31
_MEDdatagroupCreer
MEDC_EXPORT med_idt _MEDdatagroupCreer(med_idt pid, const char *const nom)
_MEDfileVersionSetCache
MEDC_EXPORT med_err _MEDfileVersionSetCache(const med_idt oid, const med_file_version v)
med_file_version::release
med_int release
Definition: med.h:386
MED_INFOS
#define MED_INFOS
Definition: med_outils.h:256
med_outils.h
med_config.h
EXIT_IF
#define EXIT_IF(expression, message, arg)
Definition: med_utils.h:343
MAJ_version.h
MAJ_write_version_num
void MAJ_write_version_num(med_idt fid, const int majeur, const int mineur, const int release)
Definition: MAJ_version.c:36
med_file_version::mineur
med_int mineur
Definition: med.h:386
MED_NUM_MINEUR
#define MED_NUM_MINEUR
Definition: med.h:66
_MEDdatagroupOuvrir
MEDC_EXPORT med_idt _MEDdatagroupOuvrir(med_idt pid, const char *const nom)
MED_NUM_MAJEUR
#define MED_NUM_MAJEUR
Definition: med.h:65