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

Last change on this file since 631 was 623, checked in by mhnguyen, 9 years ago

Implementing transformation algorithm: zoom axis (local commit)

+) Implement zoom axis: zoomed points are points not masked
+) Correct some minor bugs

Test
+) Ok with normal cases: zoom in the last of transformation list
+) There is still a bug in case of zoom then inverse

  • 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.7 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           oss << std::endl << iendl;
229           it->second->generateCInterface(oss, className);
230           oss << iendl;
231           it->second->generateCInterfaceIsDefined(oss, className);
232         }
233      }
234
235      void CAttributeMap::generateFortran2003Interface(ostream& oss, const string& className)
236      {
237         SuperClassMap::const_iterator it = SuperClassMap::begin(), end = SuperClassMap::end();
238         for (; it != end; it++)
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      void CAttributeMap::generateFortranInterface_hdl_(ostream& oss, const string& className)
250      {
251         oss << "SUBROUTINE xios(set_" << className << "_attr_hdl_)   &" << iendl++;
252         ostringstream* oss2;
253         SuperClassMap::const_iterator it;
254         SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end();
255
256         oss2 = new ostringstream;
257
258         *oss2 << "( " << className << "_hdl" ;
259
260         for (it = begin; it != end; it++)
261         {
262           *oss2 << ", " << it->second->getName() << "_";
263           if (oss2->str().size() > 90)
264           {
265             oss << oss2->str() << "  &" << iendl;
266             delete oss2;
267             oss2 = new ostringstream;
268           }
269         }
270         *oss2 << " )";
271         oss << oss2->str() << std::endl;
272         oss << iendl;
273         delete oss2;
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           oss << iendl;
281           it->second->generateFortranInterfaceDeclaration_(oss, className);
282         }
283
284         for (it = begin; it != end; it++)
285         {
286           oss << std::endl << iendl;
287           it->second->generateFortranInterfaceBody_(oss, className);
288         }
289
290         oss << std::endl << (iendl -= 2);
291         oss << "END SUBROUTINE xios(set_" << className << "_attr_hdl_)" << std::endl;
292      }
293
294      void CAttributeMap::generateFortranInterfaceGet_hdl_(ostream& oss, const string& className)
295      {
296         oss << "SUBROUTINE xios(get_" << className << "_attr_hdl_)   &" << iendl++;
297         ostringstream* oss2;
298         SuperClassMap::const_iterator it;
299         SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end();
300
301         oss2 = new ostringstream;
302
303         *oss2 << "( " << className << "_hdl" ;
304
305         for (it = begin; it != end; it++)
306         {
307           *oss2 << ", " << it->second->getName() << "_";
308           if (oss2->str().size() > 90)
309           {
310             oss << oss2->str() << "  &" << iendl;
311             delete oss2;
312             oss2 = new ostringstream;
313           }
314         }
315         *oss2 << " )";
316         oss << oss2->str() << std::endl;
317         oss << iendl;
318         delete oss2;
319
320         oss << "IMPLICIT NONE" << iendl++;
321         oss << "TYPE(txios(" << className << ")) , INTENT(IN) :: " << className << "_hdl";
322
323         for (it = begin; it != end; it++)
324         {
325           oss << iendl;
326           it->second->generateFortranInterfaceGetDeclaration_(oss, className);
327         }
328
329         for (it = begin; it != end; it++)
330         {
331           oss << std::endl << iendl;
332           it->second->generateFortranInterfaceGetBody_(oss, className);
333         }
334
335         oss << std::endl << (iendl -= 2);
336         oss << "END SUBROUTINE xios(get_" << className << "_attr_hdl_)" << std::endl;
337      }
338
339      void CAttributeMap::generateFortranInterfaceIsDefined_hdl_(ostream& oss, const string& className)
340      {
341         oss << "SUBROUTINE xios(is_defined_" << className << "_attr_hdl_)   &" << iendl++;
342         ostringstream* oss2;
343         SuperClassMap::const_iterator it;
344         SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end();
345
346         oss2 = new ostringstream;
347
348         *oss2 << "( " << className << "_hdl" ;
349
350         for (it = begin; it != end; it++)
351         {
352           *oss2 << ", " << it->second->getName() << "_";
353           if (oss2->str().size() > 90)
354           {
355             oss << oss2->str() << "  &" << iendl;
356             delete oss2;
357             oss2 = new ostringstream;
358           }
359         }
360         *oss2 << " )";
361         oss << oss2->str() << std::endl;
362         oss << iendl;
363         delete oss2;
364
365         oss << "IMPLICIT NONE" << iendl++;
366         oss << "TYPE(txios(" << className << ")) , INTENT(IN) :: " << className << "_hdl";
367
368         for (it = begin; it != end; it++)
369         {
370           oss << iendl;
371           it->second->generateFortranInterfaceIsDefinedDeclaration_(oss, className);
372         }
373
374         for (it = begin; it != end; it++)
375         {
376           oss << std::endl << iendl;
377           it->second->generateFortranInterfaceIsDefinedBody_(oss, className);
378         }
379
380         oss << std::endl << (iendl -= 2);
381         oss << "END SUBROUTINE xios(is_defined_" << className << "_attr_hdl_)" << std::endl;
382      }
383
384      void CAttributeMap::generateFortranInterface_hdl(ostream& oss, const string& className)
385      {
386         oss << "SUBROUTINE xios(set_" << className << "_attr_hdl)  &" << iendl++;
387         ostringstream* oss2;
388         SuperClassMap::const_iterator it;
389         SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end();
390
391         oss2 = new ostringstream;
392         *oss2 << "( " << className << "_hdl" ;
393         for (it = begin; it != end; it++)
394         {
395           *oss2 << ", " << it->second->getName();
396           if (oss2->str().size() > 90)
397           {
398             oss << oss2->str() << "  &" << iendl;
399             delete oss2;
400             oss2 = new ostringstream;
401           }
402         }
403         *oss2 << " )";
404         oss << oss2->str() << std::endl;
405         oss << iendl;
406         delete oss2;
407         oss2 = new ostringstream;
408
409         oss << "IMPLICIT NONE" << iendl++;
410         oss << "TYPE(txios(" << className << ")) , INTENT(IN) :: " << className << "_hdl";
411
412         for (it = begin; it != end; it++)
413         {
414           oss << iendl;
415           it->second->generateFortranInterfaceDeclaration(oss, className);
416         }
417
418         oss << std::endl << iendl;
419
420         oss << "CALL xios(set_" << className << "_attr_hdl_)  &" << iendl;
421
422         *oss2 << "( " << className << "_hdl" ;
423         for (it = begin; it != end; it++)
424         {
425           *oss2 << ", " << it->second->getName();
426           if (oss2->str().size() > 90)
427           {
428             oss << oss2->str() << "  &" << iendl;
429             delete oss2;
430             oss2 = new ostringstream;
431           }
432         }
433         *oss2 << " )";
434         oss << oss2->str();
435         delete oss2;
436
437         oss << std::endl << (iendl -= 2);
438         oss << "END SUBROUTINE xios(set_" << className << "_attr_hdl)" << std::endl;
439      }
440
441      void CAttributeMap::generateFortranInterfaceGet_hdl(ostream& oss, const string& className)
442      {
443         oss << "SUBROUTINE xios(get_" << className << "_attr_hdl)  &" << iendl++;
444         ostringstream* oss2;
445         SuperClassMap::const_iterator it;
446         SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end();
447
448         oss2 = new ostringstream;
449         *oss2 << "( " << className << "_hdl" ;
450         for (it = begin; it != end; it++)
451         {
452           *oss2 << ", " << it->second->getName();
453           if (oss2->str().size() > 90)
454           {
455             oss << oss2->str() << "  &" << iendl;
456             delete oss2;
457             oss2 = new ostringstream;
458           }
459         }
460         *oss2 << " )";
461         oss << oss2->str() << std::endl;
462         oss << iendl;
463         delete oss2;
464         oss2 = new ostringstream;
465
466         oss << "IMPLICIT NONE" << iendl++;
467         oss << "TYPE(txios(" << className << ")) , INTENT(IN) :: " << className << "_hdl";
468
469         for (it = begin; it != end; it++)
470         {
471           oss << iendl;
472           it->second->generateFortranInterfaceGetDeclaration(oss, className);
473         }
474
475         oss << std::endl << iendl;
476
477         oss << "CALL xios(get_" << className << "_attr_hdl_)  &" << iendl;
478
479         *oss2 << "( " << className << "_hdl" ;
480         for (it = begin; it != end; it++)
481         {
482           *oss2 << ", " << it->second->getName();
483           if (oss2->str().size() > 90)
484           {
485             oss << oss2->str() << "  &" << iendl;
486             delete oss2;
487             oss2 = new ostringstream;
488           }
489         }
490         *oss2 << " )";
491         oss << oss2->str();
492         delete oss2;
493
494         oss << std::endl << (iendl -= 2);
495         oss << "END SUBROUTINE xios(get_" << className << "_attr_hdl)" << std::endl;
496      }
497
498      void CAttributeMap::generateFortranInterfaceIsDefined_hdl(ostream& oss, const string& className)
499      {
500         oss << "SUBROUTINE xios(is_defined_" << className << "_attr_hdl)  &" << iendl++;
501         ostringstream* oss2;
502         SuperClassMap::const_iterator it;
503         SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end();
504
505         oss2 = new ostringstream;
506         *oss2 << "( " << className << "_hdl" ;
507         for (it = begin; it != end; it++)
508         {
509           *oss2 << ", " << it->second->getName();
510           if (oss2->str().size() > 90)
511           {
512             oss << oss2->str() << "  &" << iendl;
513             delete oss2;
514             oss2 = new ostringstream;
515           }
516         }
517         *oss2 << " )";
518         oss << oss2->str() << std::endl;
519         oss << iendl;
520         delete oss2;
521         oss2 = new ostringstream;
522
523         oss << "IMPLICIT NONE" << iendl++;
524         oss << "TYPE(txios(" << className << ")) , INTENT(IN) :: " << className << "_hdl";
525
526         for (it = begin; it != end; it++)
527         {
528           oss << iendl;
529           it->second->generateFortranInterfaceIsDefinedDeclaration(oss, className);
530         }
531
532         oss << std::endl << iendl;
533
534         oss << "CALL xios(is_defined_" << className << "_attr_hdl_)  &" << iendl;
535
536         *oss2 << "( " << className << "_hdl" ;
537         for (it = begin; it != end; it++)
538         {
539           *oss2 << ", " << it->second->getName();
540           if (oss2->str().size() > 90)
541           {
542             oss << oss2->str() << "  &" << iendl;
543             delete oss2;
544             oss2 = new ostringstream;
545           }
546         }
547         *oss2 << " )";
548         oss << oss2->str();
549         delete oss2;
550
551         oss << std::endl << (iendl -= 2);
552         oss << "END SUBROUTINE xios(is_defined_" << className << "_attr_hdl)" << std::endl;
553      }
554
555      void CAttributeMap::generateFortranInterface_id(ostream& oss, const string& className)
556      {
557         oss << "SUBROUTINE xios(set_" << className << "_attr)  &" << iendl++;
558         ostringstream* oss2;
559         SuperClassMap::const_iterator it;
560         SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end();
561
562         oss2 = new ostringstream;
563         *oss2 << "( " << className << "_id" ;
564         for (it = begin; it != end; it++)
565         {
566           *oss2 << ", " << it->second->getName();
567           if (oss2->str().size() > 90)
568           {
569             oss << oss2->str() << "  &" << iendl;
570             delete oss2;
571             oss2 = new ostringstream;
572           }
573         }
574         *oss2 << " )";
575         oss << oss2->str() << std::endl;
576         oss << iendl;
577         delete oss2;
578         oss2 = new ostringstream;
579
580         oss << "IMPLICIT NONE" << iendl++;
581
582         oss << "TYPE(txios(" << className << "))  :: " << className << "_hdl" << iendl;
583         oss << "CHARACTER(LEN=*), INTENT(IN) ::" << className << "_id";
584
585         for (it = begin; it != end; it++)
586         {
587           oss << iendl;
588           it->second->generateFortranInterfaceDeclaration(oss, className);
589         }
590
591         oss << std::endl << iendl;
592         oss << "CALL xios(get_" << className << "_handle)(" << className << "_id," << className << "_hdl)" << iendl;
593         oss << "CALL xios(set_" << className << "_attr_hdl_)   &" << iendl;
594         *oss2 << "( " << className << "_hdl" ;
595         for (it = begin; it != end; it++)
596         {
597           *oss2 << ", " << it->second->getName();
598           if (oss2->str().size() > 90)
599           {
600             oss << oss2->str() << "  &" << iendl;
601             delete oss2;
602             oss2 = new ostringstream;
603           }
604         }
605         *oss2 << " )";
606         oss << oss2->str();
607         delete oss2;
608
609         oss << std::endl << (iendl -= 2);
610         oss << "END SUBROUTINE xios(set_" << className << "_attr)" << std::endl;
611      }
612
613      void CAttributeMap::generateFortranInterfaceGet_id(ostream& oss, const string& className)
614      {
615         oss << "SUBROUTINE xios(get_" << className << "_attr)  &" << iendl++;
616         ostringstream* oss2;
617         SuperClassMap::const_iterator it;
618         SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end();
619
620         oss2 = new ostringstream;
621         *oss2 << "( " << className << "_id" ;
622         for (it = begin; it != end; it++)
623         {
624           *oss2 << ", " << it->second->getName();
625           if (oss2->str().size() > 90)
626           {
627             oss << oss2->str() << "  &" << iendl;
628             delete oss2;
629             oss2 = new ostringstream;
630           }
631         }
632         *oss2 << " )";
633         oss << oss2->str() << std::endl;
634         oss << iendl;
635         delete oss2;
636         oss2 = new ostringstream;
637
638         oss << "IMPLICIT NONE" << iendl++;
639
640         oss << "TYPE(txios(" << className << "))  :: " << className << "_hdl" << iendl;
641         oss << "CHARACTER(LEN=*), INTENT(IN) ::" << className << "_id";
642
643         for (it = begin; it != end; it++)
644         {
645           oss << iendl;
646           it->second->generateFortranInterfaceGetDeclaration(oss, className);
647         }
648
649         oss << std::endl << iendl;
650         oss << "CALL xios(get_" << className << "_handle)(" << className << "_id," << className << "_hdl)" << iendl;
651         oss << "CALL xios(get_" << className << "_attr_hdl_)   &" << iendl;
652         *oss2 << "( " << className << "_hdl" ;
653         for (it = begin; it != end; it++)
654         {
655           *oss2 << ", " << it->second->getName();
656           if (oss2->str().size() > 90)
657           {
658             oss << oss2->str() << "  &" << iendl;
659             delete oss2;
660             oss2 = new ostringstream;
661           }
662         }
663         *oss2 << " )";
664         oss << oss2->str();
665         delete oss2;
666
667         oss << std::endl << (iendl -= 2);
668         oss << "END SUBROUTINE xios(get_" << className << "_attr)" << std::endl;
669      }
670
671      void CAttributeMap::generateFortranInterfaceIsDefined_id(ostream& oss, const string& className)
672      {
673         oss << "SUBROUTINE xios(is_defined_" << className << "_attr)  &" << iendl++;
674         ostringstream* oss2;
675         SuperClassMap::const_iterator it;
676         SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end();
677
678         oss2 = new ostringstream;
679         *oss2 << "( " << className << "_id" ;
680         for (it = begin; it != end; it++)
681         {
682           *oss2 << ", " << it->second->getName();
683           if (oss2->str().size() > 90)
684           {
685             oss << oss2->str() << "  &" << iendl;
686             delete oss2;
687             oss2 = new ostringstream;
688           }
689         }
690         *oss2 << " )";
691         oss << oss2->str() << std::endl;
692         oss << iendl;
693         delete oss2;
694         oss2 = new ostringstream;
695
696         oss << "IMPLICIT NONE" << iendl++;
697
698         oss << "TYPE(txios(" << className << "))  :: " << className << "_hdl" << iendl;
699         oss << "CHARACTER(LEN=*), INTENT(IN) ::" << className << "_id";
700
701         for (it = begin; it != end; it++)
702         {
703           oss << iendl;
704           it->second->generateFortranInterfaceIsDefinedDeclaration(oss, className);
705         }
706
707         oss << std::endl << iendl;
708         oss << "CALL xios(get_" << className << "_handle)(" << className << "_id," << className << "_hdl)" << iendl;
709         oss << "CALL xios(is_defined_" << className << "_attr_hdl_)   &" << iendl;
710         *oss2 << "( " << className << "_hdl" ;
711         for (it = begin; it != end; it++)
712         {
713           *oss2 << ", " << it->second->getName();
714           if (oss2->str().size() > 90)
715           {
716             oss << oss2->str() << "  &" << iendl;
717             delete oss2;
718             oss2 = new ostringstream;
719           }
720         }
721         *oss2 << " )";
722         oss << oss2->str();
723         delete oss2;
724
725         oss << std::endl << (iendl -= 2);
726         oss << "END SUBROUTINE xios(is_defined_" << className << "_attr)" << std::endl;
727      }
728} // namespace xios
Note: See TracBrowser for help on using the repository browser.