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

Last change on this file since 829 was 778, checked in by rlacroix, 8 years ago

Fix the generation of the Fortran interface to support private attributes.

  • 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: 25.3 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      void CAttributeMap::duplicateAttributes(const CAttributeMap* const srcAttr)
147      {
148         typedef std::pair<StdString, CAttribute*> StdStrAttPair;
149
150         SuperClassMap::const_iterator it = srcAttr->begin(), end = srcAttr->end();
151         for (; it != end; it++)
152         {
153            const StdStrAttPair& el = *it;
154            if (this->hasAttribute(el.first))
155            {
156               if (!el.second->isEmpty())
157               {
158                 this->setAttribute(el.first, el.second);
159               }
160            }
161         }
162      }
163
164      //---------------------------------------------------------------
165/*
166      void CAttributeMap::toBinary(StdOStream& os) const
167      {
168         typedef std::pair<StdString, CAttribute*> StdStrAttPair;
169         SuperClassMap::const_iterator it = this->begin(), end = this->end();
170
171         const StdSize nbatt = SuperClassMap::size();
172         os.write (reinterpret_cast<const char*>(&nbatt) , sizeof(StdSize));
173
174         for (; it != end; it++)
175         {
176            const StdString& key   = it->first;
177            const CAttribute* value = it->second;
178            const StdSize size = key.size();
179
180            os.write (reinterpret_cast<const char*>(&size) , sizeof(StdSize));
181            os.write (key.data(), size* sizeof(char));
182
183            if (!value->isEmpty())
184            {
185               bool b = true;
186               os.write (reinterpret_cast<const char*>(&b) , sizeof(bool));
187               value->toBinary(os);
188            }
189            else
190            {
191               bool b = false;
192               os.write (reinterpret_cast<const char*>(&b) , sizeof(bool));
193            }
194         }
195      }
196
197      //---------------------------------------------------------------
198
199      void CAttributeMap::fromBinary(StdIStream& is)
200      {
201         StdSize nbatt = 0;
202         is.read (reinterpret_cast<char*>(&nbatt), sizeof(StdSize));
203
204         for (StdSize i = 0; i < nbatt; i++)
205         {
206            bool hasValue = false;
207            StdSize size  = 0;
208            is.read (reinterpret_cast<char*>(&size), sizeof(StdSize));
209            StdString key(size, ' ');
210            is.read (const_cast<char *>(key.data()), size* sizeof(char));
211
212            if (!this->hasAttribute(key))
213               ERROR("CAttributeMap::fromBinary(StdIStream& is)",
214                     << "[ key = " << key << "] key not found !");
215
216            is.read (reinterpret_cast<char*>(&hasValue), sizeof(bool));
217
218            if (hasValue)
219               this->operator[](key)->fromBinary(is);
220         }
221      }
222 */
223      void CAttributeMap::generateCInterface(ostream& oss, const string& className)
224      {
225         SuperClassMap::const_iterator it = SuperClassMap::begin(), end = SuperClassMap::end();
226         for (; it != end; it++)
227         {
228           if (it->second->isPublic())
229           {
230             oss << std::endl << iendl;
231             it->second->generateCInterface(oss, className);
232             oss << iendl;
233             it->second->generateCInterfaceIsDefined(oss, className);
234           }
235         }
236      }
237
238      void CAttributeMap::generateFortran2003Interface(ostream& oss, const string& className)
239      {
240         SuperClassMap::const_iterator it = SuperClassMap::begin(), end = SuperClassMap::end();
241         for (; it != end; it++)
242         {
243           if (it->second->isPublic())
244           {
245             oss << std::endl << iendl;
246             it->second->generateFortran2003Interface(oss, className);
247             oss << iendl;
248             it->second->generateFortran2003InterfaceIsDefined(oss, className);
249           }
250         }
251      }
252
253      ///--------------------------------------------------------------
254
255      void CAttributeMap::generateFortranInterface_hdl_(ostream& oss, const string& className)
256      {
257         oss << "SUBROUTINE xios(set_" << className << "_attr_hdl_)   &" << iendl++;
258         SuperClassMap::const_iterator it;
259         SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end();
260
261         long startPos = oss.tellp();
262
263         oss << "( " << className << "_hdl";
264         for (it = begin; it != end; it++)
265         {
266           if (it->second->isPublic())
267           {
268             oss << ", " << it->second->getName() << "_";
269             if (oss.tellp() - startPos > 90)
270             {
271               oss << "  &" << iendl;
272               startPos = oss.tellp();
273             }
274           }
275         }
276         oss << " )";
277         oss << std::endl;
278         oss << iendl;
279
280         oss << "IMPLICIT NONE" << iendl++;
281         oss << "TYPE(txios(" << className << ")) , INTENT(IN) :: " << className << "_hdl";
282
283         for (it = begin; it != end; it++)
284         {
285           if (it->second->isPublic())
286           {
287             oss << iendl;
288             it->second->generateFortranInterfaceDeclaration_(oss, className);
289           }
290         }
291
292         for (it = begin; it != end; it++)
293         {
294           if (it->second->isPublic())
295           {
296             oss << std::endl << iendl;
297             it->second->generateFortranInterfaceBody_(oss, className);
298           }
299         }
300
301         oss << std::endl << (iendl -= 2);
302         oss << "END SUBROUTINE xios(set_" << className << "_attr_hdl_)" << std::endl;
303      }
304
305      void CAttributeMap::generateFortranInterfaceGet_hdl_(ostream& oss, const string& className)
306      {
307         oss << "SUBROUTINE xios(get_" << className << "_attr_hdl_)   &" << iendl++;
308         SuperClassMap::const_iterator it;
309         SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end();
310
311         long startPos = oss.tellp();
312
313         oss << "( " << className << "_hdl";
314         for (it = begin; it != end; it++)
315         {
316           if (it->second->isPublic())
317           {
318             oss << ", " << it->second->getName() << "_";
319             if (oss.tellp() - startPos > 90)
320             {
321               oss << "  &" << iendl;
322               startPos = oss.tellp();
323             }
324           }
325         }
326         oss << " )";
327         oss << std::endl;
328         oss << iendl;
329
330         oss << "IMPLICIT NONE" << iendl++;
331         oss << "TYPE(txios(" << className << ")) , INTENT(IN) :: " << className << "_hdl";
332
333         for (it = begin; it != end; it++)
334         {
335           if (it->second->isPublic())
336           {
337             oss << iendl;
338             it->second->generateFortranInterfaceGetDeclaration_(oss, className);
339           }
340         }
341
342         for (it = begin; it != end; it++)
343         {
344           if (it->second->isPublic())
345           {
346             oss << std::endl << iendl;
347             it->second->generateFortranInterfaceGetBody_(oss, className);
348           }
349         }
350
351         oss << std::endl << (iendl -= 2);
352         oss << "END SUBROUTINE xios(get_" << className << "_attr_hdl_)" << std::endl;
353      }
354
355      void CAttributeMap::generateFortranInterfaceIsDefined_hdl_(ostream& oss, const string& className)
356      {
357         oss << "SUBROUTINE xios(is_defined_" << className << "_attr_hdl_)   &" << iendl++;
358         SuperClassMap::const_iterator it;
359         SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end();
360
361         long startPos = oss.tellp();
362
363         oss << "( " << className << "_hdl";
364         for (it = begin; it != end; it++)
365         {
366           if (it->second->isPublic())
367           {
368             oss << ", " << it->second->getName() << "_";
369             if (oss.tellp() - startPos > 90)
370             {
371               oss << "  &" << iendl;
372               startPos = oss.tellp();
373             }
374           }
375         }
376         oss << " )";
377         oss << std::endl;
378         oss << iendl;
379
380         oss << "IMPLICIT NONE" << iendl++;
381         oss << "TYPE(txios(" << className << ")) , INTENT(IN) :: " << className << "_hdl";
382
383         for (it = begin; it != end; it++)
384         {
385           if (it->second->isPublic())
386           {
387             oss << iendl;
388             it->second->generateFortranInterfaceIsDefinedDeclaration_(oss, className);
389           }
390         }
391
392         for (it = begin; it != end; it++)
393         {
394           if (it->second->isPublic())
395           {
396             oss << std::endl << iendl;
397             it->second->generateFortranInterfaceIsDefinedBody_(oss, className);
398           }
399         }
400
401         oss << std::endl << (iendl -= 2);
402         oss << "END SUBROUTINE xios(is_defined_" << className << "_attr_hdl_)" << std::endl;
403      }
404
405      void CAttributeMap::generateFortranInterface_hdl(ostream& oss, const string& className)
406      {
407         oss << "SUBROUTINE xios(set_" << className << "_attr_hdl)  &" << iendl++;
408         SuperClassMap::const_iterator it;
409         SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end();
410
411         long startPos = oss.tellp();
412
413         oss << "( " << className << "_hdl";
414         for (it = begin; it != end; it++)
415         {
416           if (it->second->isPublic())
417           {
418             oss << ", " << it->second->getName();
419             if (oss.tellp() - startPos > 90)
420             {
421               oss << "  &" << iendl;
422               startPos = oss.tellp();
423             }
424           }
425         }
426         oss << " )";
427         oss << std::endl;
428         oss << iendl;
429
430         oss << "IMPLICIT NONE" << iendl++;
431         oss << "TYPE(txios(" << className << ")) , INTENT(IN) :: " << className << "_hdl";
432
433         for (it = begin; it != end; it++)
434         {
435           if (it->second->isPublic())
436           {
437             oss << iendl;
438             it->second->generateFortranInterfaceDeclaration(oss, className);
439           }
440         }
441
442         oss << std::endl << iendl;
443
444         oss << "CALL xios(set_" << className << "_attr_hdl_)  &" << iendl;
445
446         startPos = oss.tellp();
447
448         oss << "( " << className << "_hdl";
449         for (it = begin; it != end; it++)
450         {
451           if (it->second->isPublic())
452           {
453             oss << ", " << it->second->getName();
454             if (oss.tellp() - startPos > 90)
455             {
456               oss << "  &" << iendl;
457               startPos = oss.tellp();
458             }
459           }
460         }
461         oss << " )";
462
463         oss << std::endl << (iendl -= 2);
464         oss << "END SUBROUTINE xios(set_" << className << "_attr_hdl)" << std::endl;
465      }
466
467      void CAttributeMap::generateFortranInterfaceGet_hdl(ostream& oss, const string& className)
468      {
469         oss << "SUBROUTINE xios(get_" << className << "_attr_hdl)  &" << iendl++;
470         SuperClassMap::const_iterator it;
471         SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end();
472
473         long startPos = oss.tellp();
474
475         oss << "( " << className << "_hdl";
476         for (it = begin; it != end; it++)
477         {
478           if (it->second->isPublic())
479           {
480             oss << ", " << it->second->getName();
481             if (oss.tellp() - startPos > 90)
482             {
483               oss << "  &" << iendl;
484               startPos = oss.tellp();
485             }
486           }
487         }
488         oss << " )";
489         oss << std::endl;
490         oss << iendl;
491
492         oss << "IMPLICIT NONE" << iendl++;
493         oss << "TYPE(txios(" << className << ")) , INTENT(IN) :: " << className << "_hdl";
494
495         for (it = begin; it != end; it++)
496         {
497           if (it->second->isPublic())
498           {
499             oss << iendl;
500             it->second->generateFortranInterfaceGetDeclaration(oss, className);
501           }
502         }
503
504         oss << std::endl << iendl;
505
506         oss << "CALL xios(get_" << className << "_attr_hdl_)  &" << iendl;
507
508         startPos = oss.tellp();
509
510         oss << "( " << className << "_hdl";
511         for (it = begin; it != end; it++)
512         {
513           if (it->second->isPublic())
514           {
515             oss << ", " << it->second->getName();
516             if (oss.tellp() - startPos > 90)
517             {
518               oss << "  &" << iendl;
519               startPos = oss.tellp();
520             }
521           }
522         }
523         oss << " )";
524
525         oss << std::endl << (iendl -= 2);
526         oss << "END SUBROUTINE xios(get_" << className << "_attr_hdl)" << std::endl;
527      }
528
529      void CAttributeMap::generateFortranInterfaceIsDefined_hdl(ostream& oss, const string& className)
530      {
531         oss << "SUBROUTINE xios(is_defined_" << className << "_attr_hdl)  &" << iendl++;
532         SuperClassMap::const_iterator it;
533         SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end();
534
535         long startPos = oss.tellp();
536
537         oss << "( " << className << "_hdl";
538         for (it = begin; it != end; it++)
539         {
540           if (it->second->isPublic())
541           {
542             oss << ", " << it->second->getName();
543             if (oss.tellp() - startPos > 90)
544             {
545               oss << "  &" << iendl;
546               startPos = oss.tellp();
547             }
548           }
549         }
550         oss << " )";
551         oss << std::endl;
552         oss << iendl;
553
554         oss << "IMPLICIT NONE" << iendl++;
555         oss << "TYPE(txios(" << className << ")) , INTENT(IN) :: " << className << "_hdl";
556
557         for (it = begin; it != end; it++)
558         {
559           if (it->second->isPublic())
560           {
561             oss << iendl;
562             it->second->generateFortranInterfaceIsDefinedDeclaration(oss, className);
563           }
564         }
565
566         oss << std::endl << iendl;
567
568         oss << "CALL xios(is_defined_" << className << "_attr_hdl_)  &" << iendl;
569
570         startPos = oss.tellp();
571
572         oss << "( " << className << "_hdl";
573         for (it = begin; it != end; it++)
574         {
575           if (it->second->isPublic())
576           {
577             oss << ", " << it->second->getName();
578             if (oss.tellp() - startPos > 90)
579             {
580               oss << "  &" << iendl;
581               startPos = oss.tellp();
582             }
583           }
584         }
585         oss << " )";
586
587         oss << std::endl << (iendl -= 2);
588         oss << "END SUBROUTINE xios(is_defined_" << className << "_attr_hdl)" << std::endl;
589      }
590
591      void CAttributeMap::generateFortranInterface_id(ostream& oss, const string& className)
592      {
593         oss << "SUBROUTINE xios(set_" << className << "_attr)  &" << iendl++;
594         SuperClassMap::const_iterator it;
595         SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end();
596
597         long startPos = oss.tellp();
598
599         oss << "( " << className << "_id";
600         for (it = begin; it != end; it++)
601         {
602           if (it->second->isPublic())
603           {
604             oss << ", " << it->second->getName();
605             if (oss.tellp() - startPos > 90)
606             {
607               oss << "  &" << iendl;
608               startPos = oss.tellp();
609             }
610           }
611         }
612         oss << " )";
613         oss << std::endl;
614         oss << iendl;
615
616         oss << "IMPLICIT NONE" << iendl++;
617
618         oss << "TYPE(txios(" << className << "))  :: " << className << "_hdl" << iendl;
619         oss << "CHARACTER(LEN=*), INTENT(IN) ::" << className << "_id";
620
621         for (it = begin; it != end; it++)
622         {
623           if (it->second->isPublic())
624           {
625             oss << iendl;
626             it->second->generateFortranInterfaceDeclaration(oss, className);
627           }
628         }
629
630         oss << std::endl << iendl;
631         oss << "CALL xios(get_" << className << "_handle)(" << className << "_id," << className << "_hdl)" << iendl;
632         oss << "CALL xios(set_" << className << "_attr_hdl_)   &" << iendl;
633
634         startPos = oss.tellp();
635
636         oss << "( " << className << "_hdl";
637         for (it = begin; it != end; it++)
638         {
639           if (it->second->isPublic())
640           {
641             oss << ", " << it->second->getName();
642             if (oss.tellp() - startPos > 90)
643             {
644               oss << "  &" << iendl;
645               startPos = oss.tellp();
646             }
647           }
648         }
649         oss << " )";
650
651         oss << std::endl << (iendl -= 2);
652         oss << "END SUBROUTINE xios(set_" << className << "_attr)" << std::endl;
653      }
654
655      void CAttributeMap::generateFortranInterfaceGet_id(ostream& oss, const string& className)
656      {
657         oss << "SUBROUTINE xios(get_" << className << "_attr)  &" << iendl++;
658         SuperClassMap::const_iterator it;
659         SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end();
660
661         long startPos = oss.tellp();
662
663         oss << "( " << className << "_id";
664         for (it = begin; it != end; it++)
665         {
666           if (it->second->isPublic())
667           {
668             oss << ", " << it->second->getName();
669             if (oss.tellp() - startPos > 90)
670             {
671               oss << "  &" << iendl;
672               startPos = oss.tellp();
673             }
674           }
675         }
676         oss << " )";
677         oss << std::endl;
678         oss << iendl;
679
680         oss << "IMPLICIT NONE" << iendl++;
681
682         oss << "TYPE(txios(" << className << "))  :: " << className << "_hdl" << iendl;
683         oss << "CHARACTER(LEN=*), INTENT(IN) ::" << className << "_id";
684
685         for (it = begin; it != end; it++)
686         {
687           if (it->second->isPublic())
688           {
689             oss << iendl;
690             it->second->generateFortranInterfaceGetDeclaration(oss, className);
691           }
692         }
693
694         oss << std::endl << iendl;
695         oss << "CALL xios(get_" << className << "_handle)(" << className << "_id," << className << "_hdl)" << iendl;
696         oss << "CALL xios(get_" << className << "_attr_hdl_)   &" << iendl;
697
698         startPos = oss.tellp();
699
700         oss << "( " << className << "_hdl";
701         for (it = begin; it != end; it++)
702         {
703           if (it->second->isPublic())
704           {
705             oss << ", " << it->second->getName();
706             if (oss.tellp() - startPos > 90)
707             {
708               oss << "  &" << iendl;
709               startPos = oss.tellp();
710             }
711           }
712         }
713         oss << " )";
714
715         oss << std::endl << (iendl -= 2);
716         oss << "END SUBROUTINE xios(get_" << className << "_attr)" << std::endl;
717      }
718
719      void CAttributeMap::generateFortranInterfaceIsDefined_id(ostream& oss, const string& className)
720      {
721         oss << "SUBROUTINE xios(is_defined_" << className << "_attr)  &" << iendl++;
722         SuperClassMap::const_iterator it;
723         SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end();
724
725         long startPos = oss.tellp();
726
727         oss << "( " << className << "_id";
728         for (it = begin; it != end; it++)
729         {
730           if (it->second->isPublic())
731           {
732             oss << ", " << it->second->getName();
733             if (oss.tellp() - startPos > 90)
734             {
735               oss << "  &" << iendl;
736               startPos = oss.tellp();
737             }
738           }
739         }
740         oss << " )";
741         oss << std::endl;
742         oss << iendl;
743
744         oss << "IMPLICIT NONE" << iendl++;
745
746         oss << "TYPE(txios(" << className << "))  :: " << className << "_hdl" << iendl;
747         oss << "CHARACTER(LEN=*), INTENT(IN) ::" << className << "_id";
748
749         for (it = begin; it != end; it++)
750         {
751           if (it->second->isPublic())
752           {
753             oss << iendl;
754             it->second->generateFortranInterfaceIsDefinedDeclaration(oss, className);
755           }
756         }
757
758         oss << std::endl << iendl;
759         oss << "CALL xios(get_" << className << "_handle)(" << className << "_id," << className << "_hdl)" << iendl;
760         oss << "CALL xios(is_defined_" << className << "_attr_hdl_)   &" << iendl;
761
762         startPos = oss.tellp();
763
764         oss << "( " << className << "_hdl";
765         for (it = begin; it != end; it++)
766         {
767           if (it->second->isPublic())
768           {
769             oss << ", " << it->second->getName();
770             if (oss.tellp() - startPos > 90)
771             {
772               oss << "  &" << iendl;
773               startPos = oss.tellp();
774             }
775           }
776         }
777         oss << " )";
778
779         oss << std::endl << (iendl -= 2);
780         oss << "END SUBROUTINE xios(is_defined_" << className << "_attr)" << std::endl;
781      }
782} // namespace xios
Note: See TracBrowser for help on using the repository browser.