MED fichier

MAJ_version.c
Aller à la documentation de ce fichier.
1 /* This file is part of MED.
2 *
3 * COPYRIGHT (C) 1999 - 2021 EDF R&D, CEA/DEN
4 * MED is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * MED is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with MED. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18 #include "med_config.h"
19 #include <med.h>
20 #include <med_outils.h>
21 #include "MAJ_version.h"
22
23 void MAJ_version_num(med_idt fid, const int majeur, const int mineur, const int release )
24 {
25
26 static med_file_version _fileversion = MED_FILE_VERSION_INIT;
27
28 _fileversion.majeur = majeur ;
29 _fileversion.mineur = mineur ;
30 _fileversion.release = release;
31
32 _MEDfileVersionSetCache(fid,_fileversion);
33
34 }
35
36 void MAJ_write_version_num(med_idt fid, const int majeur, const int mineur, const int release )
37 {
38 med_err ret;
39 med_idt gid;
40 med_int _majeur=majeur, _mineur=mineur, _release=release;
41
42
43 gid = _MEDdatagroupOuvrir(fid,MED_INFOS);
44 if (gid < 0)
45 gid = _MEDdatagroupCreer(fid,MED_INFOS);
46
47 ret = _MEDattributeIntWr(gid,MED_NOM_MAJEUR,&_majeur);
48 EXIT_IF(ret < 0,"Ecriture du numéro majeur",NULL);
49 ret = _MEDattributeIntWr(gid,MED_NOM_MINEUR,&_mineur);
50 EXIT_IF(ret < 0,"Ecriture du numéro mineur",NULL);
51 ret = _MEDattributeIntWr(gid,MED_NOM_RELEASE,&_release);
52 EXIT_IF(ret < 0,"Ecrriture du numéro de release",NULL);
53 ret = _MEDdatagroupFermer(gid);
54 EXIT_IF(ret < 0,"Fermeture du groupe HDF MED_INFOS",NULL);
55
56 }
57
58
59
60 void MAJ_version(med_idt fid)
61 {
62 med_err ret;
63 med_idt gid;
64 med_int majeur, mineur, release;
65
66 /* On ecrit le bon numero de version */
67 majeur = MED_NUM_MAJEUR ;
68 mineur = MED_NUM_MINEUR ;
69 release = MED_NUM_RELEASE;
70
71 MAJ_version_num(fid, majeur, mineur, release );
72
73 }
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