MED fichier
MEDfieldChecked.cxx
Aller à la documentation de ce fichier.
1 /* This file is part of MED.
2  *
3  * COPYRIGHT (C) 1999 - 2016 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 #include "MEDfieldChecked.hxx"
18 #include "med_config.h"
19 #include "med_outils.h"
20 #include <iostream>
21 
22 using namespace std;
23 
25 
27  static MED_FIELD_CHECKED obj;
28  return obj;
29 }
30 
32 
33 extern "C" med_bool _MEDfieldChecked(const med_idt oid,const char * const fieldname) {
34 
35  med_err _ret=-1;
36  map<keyType, valueType >::const_iterator it;
37  fileNo key1=0;
38  keyType key;
39 
40  if ( _MEDfichierNo(oid,&key1) < 0 ) {
42  ISCRUTE_int(oid);
43  return MED_FALSE;
44  }
45 
46  key.first =key1;
47  key.second=fieldname;;
48 
49  it = MedFieldChecked.find(key);
50 
51  if (it != MedFieldChecked.end() ) return (*it).second;
52 
53  return MED_FALSE;
54 
55 }
56 
58  const char * const fieldname,
59  const med_bool ischecked) {
60 
61  med_err _ret=-1;
62 
63  map<keyType, valueType >::const_iterator it;
64  fileNo key1=0;
65  keyType key;
66 
67  if ( _MEDfichierNo(oid,&key1) < 0 ) {
69  ISCRUTE_int(oid);
70  goto ERROR;
71  }
72  key.first =key1;
73  key.second=fieldname;
74 
75  MedFieldChecked[key]=ischecked;
76 // std::cout << "key.first : " << key.first << " key.second : " << key.second << std::endl;
77  _ret=0;
78  ERROR:
79  return _ret;
80 }
#define MED_ERR_FILE
Definition: med_err.h:81
herr_t med_err
Definition: med.h:310
unsigned long fileNo
#define ISCRUTE_int(entier)
Definition: med_utils.h:307
STL namespace.
med_bool _MEDfieldChecked(const med_idt oid, const char *const fieldname)
#define MED_ERR_UNRECOGNIZED
Definition: med_err.h:36
med_err _MEDfieldCheckedSetCache(const med_idt oid, const char *const fieldname, const med_bool ischecked)
Definition: med.h:240
static MED_FIELD_CHECKED & Instance()
hid_t med_idt
Definition: med.h:309
med_bool
Definition: med.h:240
MEDC_EXPORT med_err _MEDfichierNo(med_idt id, unsigned long *fileno)
Definition: MEDfichierNo.c:33
static MED_FIELD_CHECKED & MedFieldChecked
#define MED_ERR_(rt, r1, r2, r3)
Definition: med_utils.h:158