source: XIOS/dev/dev_olga/src/attribute_map.cpp @ 1021

Last change on this file since 1021 was 1009, checked in by oabramkina, 7 years ago

First working version with compression by secondary servers.

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