source: XIOS/trunk/src/attribute_map.cpp @ 593

Last change on this file since 593 was 591, checked in by rlacroix, 9 years ago

Remove leftovers from the XMLIO age.

  • Property copyright set to
    Software name : XIOS (Xml I/O Server)
    http://forge.ipsl.jussieu.fr/ioserver
    Creation date : January 2009
    Licence : CeCCIL version2
    see license file in root directory : Licence_CeCILL_V2-en.txt
    or http://www.cecill.info/licences/Licence_CeCILL_V2-en.html
    Holder : CEA/LSCE (Laboratoire des Sciences du CLimat et de l'Environnement)
    CNRS/IPSL (Institut Pierre Simon Laplace)
    Project Manager : Yann Meurdesoif
    yann.meurdesoif@cea.fr
File size: 24.2 KB
Line 
1#include "attribute_map.hpp"
2#include "indent.hpp"
3
4namespace xios
5{
6      /// ////////////////////// Définitions ////////////////////// ///
7      CAttributeMap* CAttributeMap::Current = NULL;
8
9      CAttributeMap::CAttributeMap(void)
10         : xios_map<StdString, CAttribute*>()
11      { CAttributeMap::Current = this; }
12
13      CAttributeMap::~CAttributeMap(void)
14      { /* Ne rien faire de plus */ }
15
16      ///--------------------------------------------------------------
17
18      void CAttributeMap::clearAllAttributes(void)
19      {
20         typedef std::pair<StdString, CAttribute*> StdStrAttPair;
21         SuperClassMap::const_iterator it = SuperClassMap::begin(), end = SuperClassMap::end();
22         for (; it != end; it++)
23         {
24            const StdStrAttPair& att = *it;
25            att.second->reset();
26         }
27      }
28
29      //---------------------------------------------------------------
30
31      bool CAttributeMap::hasAttribute(const StdString& key) const
32      {
33         return (this->find(key) != this->end());
34      }
35
36      void CAttributeMap::clearAttribute(const StdString& key)
37      {
38        if (hasAttribute(key)) this->find(key)->second->reset();
39      }
40
41      //---------------------------------------------------------------
42
43      void CAttributeMap::setAttribute(const StdString& key, CAttribute* const attr)
44      {
45         if (!this->hasAttribute(key))
46            ERROR("CAttributeMap::setAttribute(key, attr)",
47                   << "[ key = " << key << "] key not found !");
48         if (attr == NULL)
49            ERROR("CAttributeMap::setAttribute(key, attr)",
50                   << "[ key = " << key << "] attr is null !");
51         this->find(key)->second->set(*attr);
52//       this->find(key)->second->setAnyValue(attr->getAnyValue());
53      }
54
55      //---------------------------------------------------------------
56
57      CAttribute* CAttributeMap::operator[](const StdString& key)
58      {
59         if (!this->hasAttribute(key))
60            ERROR("CAttributeMap::operator[](const StdString& key)",
61                  << "[ key = " << key << "] key not found !");
62         return SuperClassMap::operator[](key);
63      }
64
65      //---------------------------------------------------------------
66
67      StdString CAttributeMap::toString(void) const
68      {
69         typedef std::pair<StdString, CAttribute*> StdStrAttPair;
70         StdOStringStream oss;
71
72         SuperClassMap::const_iterator it = SuperClassMap::begin(), end = SuperClassMap::end();
73         for (; it != end; it++)
74         {
75            const StdStrAttPair& att = *it;
76            if (!att.second->isEmpty())
77               oss << *att.second << " ";
78         }
79         return oss.str();
80      }
81
82      //---------------------------------------------------------------
83
84      void CAttributeMap::fromString(const StdString& str)
85      {
86         ERROR("CAttributeMap::fromString(const StdString& str)",
87               << "[ str = " << str << "] Not implemented yet !");
88      }
89
90      //---------------------------------------------------------------
91
92      //StdOStream& operator << (StdOStream& os, const CAttributeMap& attributmap)
93      //{ os << attributmap.toString(); return (os); }
94
95      //---------------------------------------------------------------
96
97      void CAttributeMap::setAttributes(const xml::THashAttributes& attributes)
98      {
99         for (xml::THashAttributes::const_iterator it  = attributes.begin();
100                                                   it != attributes.end();
101                                                   it++)
102         {
103            if ((*it).first.compare(StdString("id")) != 0 && (*it).first.compare(StdString("src")) != 0)
104            {
105               //if (CAttributeMap::operator[]((*it).first)->isEmpty())
106               CAttributeMap::operator[]((*it).first)->fromString((*it).second);
107            }
108         }
109      }
110
111      //---------------------------------------------------------------
112
113      /*!
114      \brief Set attributes from a specific attributemap, considered parent.
115         The child attribute map will insert the attributes of its parent into its current attribute map.
116      The existing attributes can be filled with the values of the parent map if they are empty or
117      simply replaced by these values depending on choice of user.
118      \param [in] _parent Attribute map from which the current map gets attributes.
119      \param [in] apply Specify if current attribute map is replaced by the attributes of parent (false)
120                    or filled in in case of emptyp (true)
121      */
122      void CAttributeMap::setAttributes(const CAttributeMap* const _parent, bool apply)
123      {
124         typedef std::pair<StdString, CAttribute*> StdStrAttPair;
125
126         SuperClassMap::const_iterator it = _parent->begin(), end = _parent->end();
127         for (; it != end; it++)
128         {
129            const StdStrAttPair& el = *it;
130            if (this->hasAttribute(el.first))
131            {
132               CAttribute* currentAtt = CAttributeMap::operator[](el.first);
133               CAttribute* parentAtt = el.second;
134               if (apply)
135               {
136                 if (currentAtt->isEmpty() && !el.second->isEmpty())
137                 {
138                    this->setAttribute(el.first, el.second);
139                 }
140               }
141               else currentAtt->setInheritedValue(*parentAtt);
142            }
143         }
144      }
145
146      //---------------------------------------------------------------
147/*
148      void CAttributeMap::toBinary(StdOStream& os) const
149      {
150         typedef std::pair<StdString, CAttribute*> StdStrAttPair;
151         SuperClassMap::const_iterator it = this->begin(), end = this->end();
152
153         const StdSize nbatt = SuperClassMap::size();
154         os.write (reinterpret_cast<const char*>(&nbatt) , sizeof(StdSize));
155
156         for (; it != end; it++)
157         {
158            const StdString& key   = it->first;
159            const CAttribute* value = it->second;
160            const StdSize size = key.size();
161
162            os.write (reinterpret_cast<const char*>(&size) , sizeof(StdSize));
163            os.write (key.data(), size* sizeof(char));
164
165            if (!value->isEmpty())
166            {
167               bool b = true;
168               os.write (reinterpret_cast<const char*>(&b) , sizeof(bool));
169               value->toBinary(os);
170            }
171            else
172            {
173               bool b = false;
174               os.write (reinterpret_cast<const char*>(&b) , sizeof(bool));
175            }
176         }
177      }
178
179      //---------------------------------------------------------------
180
181      void CAttributeMap::fromBinary(StdIStream& is)
182      {
183         StdSize nbatt = 0;
184         is.read (reinterpret_cast<char*>(&nbatt), sizeof(StdSize));
185
186         for (StdSize i = 0; i < nbatt; i++)
187         {
188            bool hasValue = false;
189            StdSize size  = 0;
190            is.read (reinterpret_cast<char*>(&size), sizeof(StdSize));
191            StdString key(size, ' ');
192            is.read (const_cast<char *>(key.data()), size* sizeof(char));
193
194            if (!this->hasAttribute(key))
195               ERROR("CAttributeMap::fromBinary(StdIStream& is)",
196                     << "[ key = " << key << "] key not found !");
197
198            is.read (reinterpret_cast<char*>(&hasValue), sizeof(bool));
199
200            if (hasValue)
201               this->operator[](key)->fromBinary(is);
202         }
203      }
204 */
205      void CAttributeMap::generateCInterface(ostream& oss, const string& className)
206      {
207         SuperClassMap::const_iterator it = SuperClassMap::begin(), end = SuperClassMap::end();
208         for (; it != end; it++)
209         {
210           oss << std::endl << iendl;
211           it->second->generateCInterface(oss, className);
212           oss << iendl;
213           it->second->generateCInterfaceIsDefined(oss, className);
214         }
215      }
216
217      void CAttributeMap::generateFortran2003Interface(ostream& oss, const string& className)
218      {
219         SuperClassMap::const_iterator it = SuperClassMap::begin(), end = SuperClassMap::end();
220         for (; it != end; it++)
221         {
222           oss << std::endl << iendl;
223           it->second->generateFortran2003Interface(oss, className);
224           oss << iendl;
225           it->second->generateFortran2003InterfaceIsDefined(oss, className);
226         }
227      }
228
229      ///--------------------------------------------------------------
230
231      void CAttributeMap::generateFortranInterface_hdl_(ostream& oss, const string& className)
232      {
233         oss << "SUBROUTINE xios(set_" << className << "_attr_hdl_)   &" << iendl++;
234         ostringstream* oss2;
235         SuperClassMap::const_iterator it;
236         SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end();
237
238         oss2 = new ostringstream;
239
240         *oss2 << "( " << className << "_hdl" ;
241
242         for (it = begin; it != end; it++)
243         {
244           *oss2 << ", " << it->second->getName() << "_";
245           if (oss2->str().size() > 90)
246           {
247             oss << oss2->str() << "  &" << iendl;
248             delete oss2;
249             oss2 = new ostringstream;
250           }
251         }
252         *oss2 << " )";
253         oss << oss2->str() << std::endl;
254         oss << iendl;
255         delete oss2;
256
257         oss << "IMPLICIT NONE" << iendl++;
258         oss << "TYPE(txios(" << className << ")) , INTENT(IN) :: " << className << "_hdl";
259
260         for (it = begin; it != end; it++)
261         {
262           oss << iendl;
263           it->second->generateFortranInterfaceDeclaration_(oss, className);
264         }
265
266         for (it = begin; it != end; it++)
267         {
268           oss << std::endl << iendl;
269           it->second->generateFortranInterfaceBody_(oss, className);
270         }
271
272         oss << std::endl << (iendl -= 2);
273         oss << "END SUBROUTINE xios(set_" << className << "_attr_hdl_)" << std::endl;
274      }
275
276      void CAttributeMap::generateFortranInterfaceGet_hdl_(ostream& oss, const string& className)
277      {
278         oss << "SUBROUTINE xios(get_" << className << "_attr_hdl_)   &" << iendl++;
279         ostringstream* oss2;
280         SuperClassMap::const_iterator it;
281         SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end();
282
283         oss2 = new ostringstream;
284
285         *oss2 << "( " << className << "_hdl" ;
286
287         for (it = begin; it != end; it++)
288         {
289           *oss2 << ", " << it->second->getName() << "_";
290           if (oss2->str().size() > 90)
291           {
292             oss << oss2->str() << "  &" << iendl;
293             delete oss2;
294             oss2 = new ostringstream;
295           }
296         }
297         *oss2 << " )";
298         oss << oss2->str() << std::endl;
299         oss << iendl;
300         delete oss2;
301
302         oss << "IMPLICIT NONE" << iendl++;
303         oss << "TYPE(txios(" << className << ")) , INTENT(IN) :: " << className << "_hdl";
304
305         for (it = begin; it != end; it++)
306         {
307           oss << iendl;
308           it->second->generateFortranInterfaceGetDeclaration_(oss, className);
309         }
310
311         for (it = begin; it != end; it++)
312         {
313           oss << std::endl << iendl;
314           it->second->generateFortranInterfaceGetBody_(oss, className);
315         }
316
317         oss << std::endl << (iendl -= 2);
318         oss << "END SUBROUTINE xios(get_" << className << "_attr_hdl_)" << std::endl;
319      }
320
321      void CAttributeMap::generateFortranInterfaceIsDefined_hdl_(ostream& oss, const string& className)
322      {
323         oss << "SUBROUTINE xios(is_defined_" << className << "_attr_hdl_)   &" << iendl++;
324         ostringstream* oss2;
325         SuperClassMap::const_iterator it;
326         SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end();
327
328         oss2 = new ostringstream;
329
330         *oss2 << "( " << className << "_hdl" ;
331
332         for (it = begin; it != end; it++)
333         {
334           *oss2 << ", " << it->second->getName() << "_";
335           if (oss2->str().size() > 90)
336           {
337             oss << oss2->str() << "  &" << iendl;
338             delete oss2;
339             oss2 = new ostringstream;
340           }
341         }
342         *oss2 << " )";
343         oss << oss2->str() << std::endl;
344         oss << iendl;
345         delete oss2;
346
347         oss << "IMPLICIT NONE" << iendl++;
348         oss << "TYPE(txios(" << className << ")) , INTENT(IN) :: " << className << "_hdl";
349
350         for (it = begin; it != end; it++)
351         {
352           oss << iendl;
353           it->second->generateFortranInterfaceIsDefinedDeclaration_(oss, className);
354         }
355
356         for (it = begin; it != end; it++)
357         {
358           oss << std::endl << iendl;
359           it->second->generateFortranInterfaceIsDefinedBody_(oss, className);
360         }
361
362         oss << std::endl << (iendl -= 2);
363         oss << "END SUBROUTINE xios(is_defined_" << className << "_attr_hdl_)" << std::endl;
364      }
365
366      void CAttributeMap::generateFortranInterface_hdl(ostream& oss, const string& className)
367      {
368         oss << "SUBROUTINE xios(set_" << className << "_attr_hdl)  &" << iendl++;
369         ostringstream* oss2;
370         SuperClassMap::const_iterator it;
371         SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end();
372
373         oss2 = new ostringstream;
374         *oss2 << "( " << className << "_hdl" ;
375         for (it = begin; it != end; it++)
376         {
377           *oss2 << ", " << it->second->getName();
378           if (oss2->str().size() > 90)
379           {
380             oss << oss2->str() << "  &" << iendl;
381             delete oss2;
382             oss2 = new ostringstream;
383           }
384         }
385         *oss2 << " )";
386         oss << oss2->str() << std::endl;
387         oss << iendl;
388         delete oss2;
389         oss2 = new ostringstream;
390
391         oss << "IMPLICIT NONE" << iendl++;
392         oss << "TYPE(txios(" << className << ")) , INTENT(IN) :: " << className << "_hdl";
393
394         for (it = begin; it != end; it++)
395         {
396           oss << iendl;
397           it->second->generateFortranInterfaceDeclaration(oss, className);
398         }
399
400         oss << std::endl << iendl;
401
402         oss << "CALL xios(set_" << className << "_attr_hdl_)  &" << iendl;
403
404         *oss2 << "( " << className << "_hdl" ;
405         for (it = begin; it != end; it++)
406         {
407           *oss2 << ", " << it->second->getName();
408           if (oss2->str().size() > 90)
409           {
410             oss << oss2->str() << "  &" << iendl;
411             delete oss2;
412             oss2 = new ostringstream;
413           }
414         }
415         *oss2 << " )";
416         oss << oss2->str();
417         delete oss2;
418
419         oss << std::endl << (iendl -= 2);
420         oss << "END SUBROUTINE xios(set_" << className << "_attr_hdl)" << std::endl;
421      }
422
423      void CAttributeMap::generateFortranInterfaceGet_hdl(ostream& oss, const string& className)
424      {
425         oss << "SUBROUTINE xios(get_" << className << "_attr_hdl)  &" << iendl++;
426         ostringstream* oss2;
427         SuperClassMap::const_iterator it;
428         SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end();
429
430         oss2 = new ostringstream;
431         *oss2 << "( " << className << "_hdl" ;
432         for (it = begin; it != end; it++)
433         {
434           *oss2 << ", " << it->second->getName();
435           if (oss2->str().size() > 90)
436           {
437             oss << oss2->str() << "  &" << iendl;
438             delete oss2;
439             oss2 = new ostringstream;
440           }
441         }
442         *oss2 << " )";
443         oss << oss2->str() << std::endl;
444         oss << iendl;
445         delete oss2;
446         oss2 = new ostringstream;
447
448         oss << "IMPLICIT NONE" << iendl++;
449         oss << "TYPE(txios(" << className << ")) , INTENT(IN) :: " << className << "_hdl";
450
451         for (it = begin; it != end; it++)
452         {
453           oss << iendl;
454           it->second->generateFortranInterfaceGetDeclaration(oss, className);
455         }
456
457         oss << std::endl << iendl;
458
459         oss << "CALL xios(get_" << className << "_attr_hdl_)  &" << iendl;
460
461         *oss2 << "( " << className << "_hdl" ;
462         for (it = begin; it != end; it++)
463         {
464           *oss2 << ", " << it->second->getName();
465           if (oss2->str().size() > 90)
466           {
467             oss << oss2->str() << "  &" << iendl;
468             delete oss2;
469             oss2 = new ostringstream;
470           }
471         }
472         *oss2 << " )";
473         oss << oss2->str();
474         delete oss2;
475
476         oss << std::endl << (iendl -= 2);
477         oss << "END SUBROUTINE xios(get_" << className << "_attr_hdl)" << std::endl;
478      }
479
480      void CAttributeMap::generateFortranInterfaceIsDefined_hdl(ostream& oss, const string& className)
481      {
482         oss << "SUBROUTINE xios(is_defined_" << className << "_attr_hdl)  &" << iendl++;
483         ostringstream* oss2;
484         SuperClassMap::const_iterator it;
485         SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end();
486
487         oss2 = new ostringstream;
488         *oss2 << "( " << className << "_hdl" ;
489         for (it = begin; it != end; it++)
490         {
491           *oss2 << ", " << it->second->getName();
492           if (oss2->str().size() > 90)
493           {
494             oss << oss2->str() << "  &" << iendl;
495             delete oss2;
496             oss2 = new ostringstream;
497           }
498         }
499         *oss2 << " )";
500         oss << oss2->str() << std::endl;
501         oss << iendl;
502         delete oss2;
503         oss2 = new ostringstream;
504
505         oss << "IMPLICIT NONE" << iendl++;
506         oss << "TYPE(txios(" << className << ")) , INTENT(IN) :: " << className << "_hdl";
507
508         for (it = begin; it != end; it++)
509         {
510           oss << iendl;
511           it->second->generateFortranInterfaceIsDefinedDeclaration(oss, className);
512         }
513
514         oss << std::endl << iendl;
515
516         oss << "CALL xios(is_defined_" << className << "_attr_hdl_)  &" << iendl;
517
518         *oss2 << "( " << className << "_hdl" ;
519         for (it = begin; it != end; it++)
520         {
521           *oss2 << ", " << it->second->getName();
522           if (oss2->str().size() > 90)
523           {
524             oss << oss2->str() << "  &" << iendl;
525             delete oss2;
526             oss2 = new ostringstream;
527           }
528         }
529         *oss2 << " )";
530         oss << oss2->str();
531         delete oss2;
532
533         oss << std::endl << (iendl -= 2);
534         oss << "END SUBROUTINE xios(is_defined_" << className << "_attr_hdl)" << std::endl;
535      }
536
537      void CAttributeMap::generateFortranInterface_id(ostream& oss, const string& className)
538      {
539         oss << "SUBROUTINE xios(set_" << className << "_attr)  &" << iendl++;
540         ostringstream* oss2;
541         SuperClassMap::const_iterator it;
542         SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end();
543
544         oss2 = new ostringstream;
545         *oss2 << "( " << className << "_id" ;
546         for (it = begin; it != end; it++)
547         {
548           *oss2 << ", " << it->second->getName();
549           if (oss2->str().size() > 90)
550           {
551             oss << oss2->str() << "  &" << iendl;
552             delete oss2;
553             oss2 = new ostringstream;
554           }
555         }
556         *oss2 << " )";
557         oss << oss2->str() << std::endl;
558         oss << iendl;
559         delete oss2;
560         oss2 = new ostringstream;
561
562         oss << "IMPLICIT NONE" << iendl++;
563
564         oss << "TYPE(txios(" << className << "))  :: " << className << "_hdl" << iendl;
565         oss << "CHARACTER(LEN=*), INTENT(IN) ::" << className << "_id";
566
567         for (it = begin; it != end; it++)
568         {
569           oss << iendl;
570           it->second->generateFortranInterfaceDeclaration(oss, className);
571         }
572
573         oss << std::endl << iendl;
574         oss << "CALL xios(get_" << className << "_handle)(" << className << "_id," << className << "_hdl)" << iendl;
575         oss << "CALL xios(set_" << className << "_attr_hdl_)   &" << iendl;
576         *oss2 << "( " << className << "_hdl" ;
577         for (it = begin; it != end; it++)
578         {
579           *oss2 << ", " << it->second->getName();
580           if (oss2->str().size() > 90)
581           {
582             oss << oss2->str() << "  &" << iendl;
583             delete oss2;
584             oss2 = new ostringstream;
585           }
586         }
587         *oss2 << " )";
588         oss << oss2->str();
589         delete oss2;
590
591         oss << std::endl << (iendl -= 2);
592         oss << "END SUBROUTINE xios(set_" << className << "_attr)" << std::endl;
593      }
594
595      void CAttributeMap::generateFortranInterfaceGet_id(ostream& oss, const string& className)
596      {
597         oss << "SUBROUTINE xios(get_" << className << "_attr)  &" << iendl++;
598         ostringstream* oss2;
599         SuperClassMap::const_iterator it;
600         SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end();
601
602         oss2 = new ostringstream;
603         *oss2 << "( " << className << "_id" ;
604         for (it = begin; it != end; it++)
605         {
606           *oss2 << ", " << it->second->getName();
607           if (oss2->str().size() > 90)
608           {
609             oss << oss2->str() << "  &" << iendl;
610             delete oss2;
611             oss2 = new ostringstream;
612           }
613         }
614         *oss2 << " )";
615         oss << oss2->str() << std::endl;
616         oss << iendl;
617         delete oss2;
618         oss2 = new ostringstream;
619
620         oss << "IMPLICIT NONE" << iendl++;
621
622         oss << "TYPE(txios(" << className << "))  :: " << className << "_hdl" << iendl;
623         oss << "CHARACTER(LEN=*), INTENT(IN) ::" << className << "_id";
624
625         for (it = begin; it != end; it++)
626         {
627           oss << iendl;
628           it->second->generateFortranInterfaceGetDeclaration(oss, className);
629         }
630
631         oss << std::endl << iendl;
632         oss << "CALL xios(get_" << className << "_handle)(" << className << "_id," << className << "_hdl)" << iendl;
633         oss << "CALL xios(get_" << className << "_attr_hdl_)   &" << iendl;
634         *oss2 << "( " << className << "_hdl" ;
635         for (it = begin; it != end; it++)
636         {
637           *oss2 << ", " << it->second->getName();
638           if (oss2->str().size() > 90)
639           {
640             oss << oss2->str() << "  &" << iendl;
641             delete oss2;
642             oss2 = new ostringstream;
643           }
644         }
645         *oss2 << " )";
646         oss << oss2->str();
647         delete oss2;
648
649         oss << std::endl << (iendl -= 2);
650         oss << "END SUBROUTINE xios(get_" << className << "_attr)" << std::endl;
651      }
652
653      void CAttributeMap::generateFortranInterfaceIsDefined_id(ostream& oss, const string& className)
654      {
655         oss << "SUBROUTINE xios(is_defined_" << className << "_attr)  &" << iendl++;
656         ostringstream* oss2;
657         SuperClassMap::const_iterator it;
658         SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end();
659
660         oss2 = new ostringstream;
661         *oss2 << "( " << className << "_id" ;
662         for (it = begin; it != end; it++)
663         {
664           *oss2 << ", " << it->second->getName();
665           if (oss2->str().size() > 90)
666           {
667             oss << oss2->str() << "  &" << iendl;
668             delete oss2;
669             oss2 = new ostringstream;
670           }
671         }
672         *oss2 << " )";
673         oss << oss2->str() << std::endl;
674         oss << iendl;
675         delete oss2;
676         oss2 = new ostringstream;
677
678         oss << "IMPLICIT NONE" << iendl++;
679
680         oss << "TYPE(txios(" << className << "))  :: " << className << "_hdl" << iendl;
681         oss << "CHARACTER(LEN=*), INTENT(IN) ::" << className << "_id";
682
683         for (it = begin; it != end; it++)
684         {
685           oss << iendl;
686           it->second->generateFortranInterfaceIsDefinedDeclaration(oss, className);
687         }
688
689         oss << std::endl << iendl;
690         oss << "CALL xios(get_" << className << "_handle)(" << className << "_id," << className << "_hdl)" << iendl;
691         oss << "CALL xios(is_defined_" << className << "_attr_hdl_)   &" << iendl;
692         *oss2 << "( " << className << "_hdl" ;
693         for (it = begin; it != end; it++)
694         {
695           *oss2 << ", " << it->second->getName();
696           if (oss2->str().size() > 90)
697           {
698             oss << oss2->str() << "  &" << iendl;
699             delete oss2;
700             oss2 = new ostringstream;
701           }
702         }
703         *oss2 << " )";
704         oss << oss2->str();
705         delete oss2;
706
707         oss << std::endl << (iendl -= 2);
708         oss << "END SUBROUTINE xios(is_defined_" << className << "_attr)" << std::endl;
709      }
710} // namespace xios
Note: See TracBrowser for help on using the repository browser.