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

Last change on this file since 439 was 432, checked in by ymipsl, 11 years ago

Enhancement : Add fortran interface to know if an attribute is set or not
ex : CALL xios_is_defined_field_attr("field_A",enabled=ok)

YM

File size: 23.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      //---------------------------------------------------------------
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 &&
99                (*it).first.compare(StdString("src"))!= 0)
100            {
101               //if (CAttributeMap::operator[]((*it).first)->isEmpty())
102               CAttributeMap::operator[]((*it).first)->fromString((*it).second);
103            }
104         }
105      }
106     
107      //---------------------------------------------------------------
108     
109      void CAttributeMap::setAttributes(const CAttributeMap * const _parent)
110      {
111         typedef std::pair<StdString, CAttribute*> StdStrAttPair;
112         
113         SuperClassMap::const_iterator it = _parent->begin(), end = _parent->end();
114         for (; it != end; it++)
115         {
116            const StdStrAttPair & el = *it;
117            if (this->hasAttribute(el.first))
118            {
119               CAttribute * currAtt = CAttributeMap::operator[](el.first);
120               if (currAtt->isEmpty() && !el.second->isEmpty())
121               {
122                  this->setAttribute(el.first, el.second);
123               }
124            }
125         }
126      }
127     
128      //---------------------------------------------------------------
129/*     
130      void CAttributeMap::toBinary(StdOStream & os) const
131      {
132         typedef std::pair<StdString, CAttribute*> StdStrAttPair;
133         SuperClassMap::const_iterator it = this->begin(), end = this->end();
134         
135         const StdSize nbatt = SuperClassMap::size();
136         os.write (reinterpret_cast<const char*>(&nbatt) , sizeof(StdSize));
137         
138         for (; it != end; it++)
139         {
140            const StdString & key   = it->first;
141            const CAttribute* value = it->second;           
142            const StdSize size = key.size();
143           
144            os.write (reinterpret_cast<const char*>(&size) , sizeof(StdSize));
145            os.write (key.data(), size * sizeof(char));
146           
147            if (!value->isEmpty())
148            {
149               bool b = true;
150               os.write (reinterpret_cast<const char*>(&b) , sizeof(bool));
151               value->toBinary(os);
152            }
153            else
154            {
155               bool b = false;
156               os.write (reinterpret_cast<const char*>(&b) , sizeof(bool));
157            }
158         }
159      }
160     
161      //---------------------------------------------------------------
162     
163      void CAttributeMap::fromBinary(StdIStream & is)
164      {
165         StdSize nbatt = 0;
166         is.read (reinterpret_cast<char*>(&nbatt), sizeof(StdSize));
167         
168         for (StdSize i = 0; i < nbatt; i++)
169         {
170            bool hasValue = false;
171            StdSize size  = 0;
172            is.read (reinterpret_cast<char*>(&size), sizeof(StdSize));
173            StdString key(size, ' ');
174            is.read (const_cast<char *>(key.data()), size * sizeof(char));
175           
176            if (!this->hasAttribute(key))
177               ERROR("CAttributeMap::fromBinary(StdIStream & is)",
178                     << "[ key = " << key << "] key not found !");
179                                       
180            is.read (reinterpret_cast<char*>(&hasValue), sizeof(bool));
181           
182            if (hasValue)         
183               this->operator[](key)->fromBinary(is);
184         }
185      }
186 */     
187      void CAttributeMap::generateCInterface(ostream& oss, const string& className)
188      {
189         SuperClassMap::const_iterator it = SuperClassMap::begin(), end = SuperClassMap::end();
190         for (; it != end; it++)
191         {
192           it->second->generateCInterface(oss,className) ;
193           it->second->generateCInterfaceIsDefined(oss,className) ;
194           oss<<iendl<<iendl ;
195         }
196      }
197
198      void CAttributeMap::generateFortran2003Interface(ostream& oss, const string& className)
199      {
200         SuperClassMap::const_iterator it = SuperClassMap::begin(), end = SuperClassMap::end();
201         for (; it != end; it++)
202         {
203           it->second->generateFortran2003Interface(oss,className) ;
204           it->second->generateFortran2003InterfaceIsDefined(oss,className) ;
205         
206           oss<<iendl<<iendl ;
207         }
208      }     
209 
210      ///--------------------------------------------------------------
211
212      void CAttributeMap::generateFortranInterface_hdl_(ostream& oss, const string& className)
213      {
214         oss<<"SUBROUTINE xios(set_"<<className<<"_attr_hdl_)   &"<<iendl++ ;
215         ostringstream* oss2 ;
216         SuperClassMap::const_iterator it ;
217         SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end();
218         
219         oss2=new ostringstream ;
220         
221         *oss2<<"( "<<className<<"_hdl"  ;
222         
223         for ( it=begin ; it != end; it++) 
224         {
225           *oss2<<", "<<it->second->getName()<<"_" ;
226           if (oss2->str().size()>90) 
227           {
228             oss<<oss2->str()<<"  &"<<iendl ;
229             delete oss2 ;
230             oss2=new ostringstream ;
231           }
232         }
233         *oss2<<" )" ;
234         oss<<oss2->str()<<iendl ;
235         oss<<iendl ;
236         delete oss2 ; 
237         
238         oss<<"IMPLICIT NONE"<<iendl++ ;
239         oss<<"TYPE(txios("<<className<<")) , INTENT(IN) :: "<<className<<"_hdl"<<iendl ;
240         
241         for (it=begin; it != end; it++)
242         {
243           it->second->generateFortranInterfaceDeclaration_(oss,className) ;
244         }
245         
246         oss<<iendl ;
247         
248         for (it=begin; it != end; it++)
249         {
250           it->second->generateFortranInterfaceBody_(oss,className) ;
251           oss<<iendl ;
252         }
253         
254         oss<<iendl--<<iendl-- ;
255         oss<<"END SUBROUTINE xios(set_"<<className<<"_attr_hdl_)"<<iendl ;
256         
257      }     
258
259      void CAttributeMap::generateFortranInterfaceGet_hdl_(ostream& oss, const string& className)
260      {
261         oss<<"SUBROUTINE xios(get_"<<className<<"_attr_hdl_)   &"<<iendl++ ;
262         ostringstream* oss2 ;
263         SuperClassMap::const_iterator it ;
264         SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end();
265         
266         oss2=new ostringstream ;
267         
268         *oss2<<"( "<<className<<"_hdl"  ;
269         
270         for ( it=begin ; it != end; it++) 
271         {
272           *oss2<<", "<<it->second->getName()<<"_" ;
273           if (oss2->str().size()>90) 
274           {
275             oss<<oss2->str()<<"  &"<<iendl ;
276             delete oss2 ;
277             oss2=new ostringstream ;
278           }
279         }
280         *oss2<<" )" ;
281         oss<<oss2->str()<<iendl ;
282         oss<<iendl ;
283         delete oss2 ; 
284         
285         oss<<"IMPLICIT NONE"<<iendl++ ;
286         oss<<"TYPE(txios("<<className<<")) , INTENT(IN) :: "<<className<<"_hdl"<<iendl ;
287         
288         for (it=begin; it != end; it++)
289         {
290           it->second->generateFortranInterfaceGetDeclaration_(oss,className) ;
291         }
292         
293         oss<<iendl ;
294         
295         for (it=begin; it != end; it++)
296         {
297           it->second->generateFortranInterfaceGetBody_(oss,className) ;
298           oss<<iendl ;
299         }
300         
301         oss<<iendl--<<iendl-- ;
302         oss<<"END SUBROUTINE xios(get_"<<className<<"_attr_hdl_)"<<iendl ;
303         
304      }     
305     
306
307      void CAttributeMap::generateFortranInterfaceIsDefined_hdl_(ostream& oss, const string& className)
308      {
309         oss<<"SUBROUTINE xios(is_defined_"<<className<<"_attr_hdl_)   &"<<iendl++ ;
310         ostringstream* oss2 ;
311         SuperClassMap::const_iterator it ;
312         SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end();
313         
314         oss2=new ostringstream ;
315         
316         *oss2<<"( "<<className<<"_hdl"  ;
317         
318         for ( it=begin ; it != end; it++) 
319         {
320           *oss2<<", "<<it->second->getName()<<"_" ;
321           if (oss2->str().size()>90) 
322           {
323             oss<<oss2->str()<<"  &"<<iendl ;
324             delete oss2 ;
325             oss2=new ostringstream ;
326           }
327         }
328         *oss2<<" )" ;
329         oss<<oss2->str()<<iendl ;
330         oss<<iendl ;
331         delete oss2 ; 
332         
333         oss<<"IMPLICIT NONE"<<iendl++ ;
334         oss<<"TYPE(txios("<<className<<")) , INTENT(IN) :: "<<className<<"_hdl"<<iendl ;
335         
336         for (it=begin; it != end; it++)
337         {
338           it->second->generateFortranInterfaceIsDefinedDeclaration_(oss,className) ;
339         }
340         
341         oss<<iendl ;
342         
343         for (it=begin; it != end; it++)
344         {
345           it->second->generateFortranInterfaceIsDefinedBody_(oss,className) ;
346           oss<<iendl ;
347         }
348         
349         oss<<iendl--<<iendl-- ;
350         oss<<"END SUBROUTINE xios(is_defined_"<<className<<"_attr_hdl_)"<<iendl ;
351         
352      }     
353       
354
355      void CAttributeMap::generateFortranInterface_hdl(ostream& oss, const string& className)
356      {
357         oss<<"SUBROUTINE xios(set_"<<className<<"_attr_hdl)  &"<<iendl++ ;
358         ostringstream* oss2 ;
359         SuperClassMap::const_iterator it ;
360         SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end();
361         
362         oss2=new ostringstream ;
363         *oss2<<"( "<<className<<"_hdl"  ;
364         for ( it=begin ; it != end; it++) 
365         {
366           *oss2<<", "<<it->second->getName() ;
367           if (oss2->str().size()>90) 
368           {
369             oss<<oss2->str()<<"  &"<<iendl ;
370             delete oss2 ;
371             oss2=new ostringstream ;
372           }
373         }
374         *oss2<<" )" ;
375         oss<<oss2->str()<<iendl ;
376         oss<<iendl ;
377         delete oss2 ; 
378         oss2=new ostringstream ;
379         
380         oss<<"IMPLICIT NONE"<<iendl++ ;
381         oss<<"TYPE(txios("<<className<<")) , INTENT(IN) :: "<<className<<"_hdl"<<iendl ;
382         
383         for (it=begin; it != end; it++)
384         {
385           it->second->generateFortranInterfaceDeclaration(oss,className) ;
386         }
387         
388         oss<<iendl ;
389         
390         oss<<"CALL xios(set_"<<className<<"_attr_hdl_)  &"<<iendl ;
391         
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() ;
405         delete oss2 ; 
406         
407         oss<<iendl--<<iendl-- ;
408         oss<<"END SUBROUTINE xios(set_"<<className<<"_attr_hdl)"<<iendl ;
409      }     
410     
411 
412      void CAttributeMap::generateFortranInterfaceGet_hdl(ostream& oss, const string& className)
413      {
414         oss<<"SUBROUTINE xios(get_"<<className<<"_attr_hdl)  &"<<iendl++ ;
415         ostringstream* oss2 ;
416         SuperClassMap::const_iterator it ;
417         SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end();
418         
419         oss2=new ostringstream ;
420         *oss2<<"( "<<className<<"_hdl"  ;
421         for ( it=begin ; it != end; it++) 
422         {
423           *oss2<<", "<<it->second->getName() ;
424           if (oss2->str().size()>90) 
425           {
426             oss<<oss2->str()<<"  &"<<iendl ;
427             delete oss2 ;
428             oss2=new ostringstream ;
429           }
430         }
431         *oss2<<" )" ;
432         oss<<oss2->str()<<iendl ;
433         oss<<iendl ;
434         delete oss2 ; 
435         oss2=new ostringstream ;
436         
437         oss<<"IMPLICIT NONE"<<iendl++ ;
438         oss<<"TYPE(txios("<<className<<")) , INTENT(IN) :: "<<className<<"_hdl"<<iendl ;
439         
440         for (it=begin; it != end; it++)
441         {
442           it->second->generateFortranInterfaceGetDeclaration(oss,className) ;
443         }
444         
445         oss<<iendl ;
446         
447         oss<<"CALL xios(get_"<<className<<"_attr_hdl_)  &"<<iendl ;
448         
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() ;
462         delete oss2 ; 
463         
464         oss<<iendl--<<iendl-- ;
465         oss<<"END SUBROUTINE xios(get_"<<className<<"_attr_hdl)"<<iendl ;
466      }     
467
468
469      void CAttributeMap::generateFortranInterfaceIsDefined_hdl(ostream& oss, const string& className)
470      {
471         oss<<"SUBROUTINE xios(is_defined_"<<className<<"_attr_hdl)  &"<<iendl++ ;
472         ostringstream* oss2 ;
473         SuperClassMap::const_iterator it ;
474         SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end();
475         
476         oss2=new ostringstream ;
477         *oss2<<"( "<<className<<"_hdl"  ;
478         for ( it=begin ; it != end; it++) 
479         {
480           *oss2<<", "<<it->second->getName() ;
481           if (oss2->str().size()>90) 
482           {
483             oss<<oss2->str()<<"  &"<<iendl ;
484             delete oss2 ;
485             oss2=new ostringstream ;
486           }
487         }
488         *oss2<<" )" ;
489         oss<<oss2->str()<<iendl ;
490         oss<<iendl ;
491         delete oss2 ; 
492         oss2=new ostringstream ;
493         
494         oss<<"IMPLICIT NONE"<<iendl++ ;
495         oss<<"TYPE(txios("<<className<<")) , INTENT(IN) :: "<<className<<"_hdl"<<iendl ;
496         
497         for (it=begin; it != end; it++)
498         {
499           it->second->generateFortranInterfaceIsDefinedDeclaration(oss,className) ;
500         }
501         
502         oss<<iendl ;
503         
504         oss<<"CALL xios(is_defined_"<<className<<"_attr_hdl_)  &"<<iendl ;
505         
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() ;
519         delete oss2 ; 
520         
521         oss<<iendl--<<iendl-- ;
522         oss<<"END SUBROUTINE xios(is_defined_"<<className<<"_attr_hdl)"<<iendl ;
523      }     
524
525     
526      void CAttributeMap::generateFortranInterface_id(ostream& oss, const string& className)
527      {
528         oss<<"SUBROUTINE xios(set_"<<className<<"_attr)  &"<<iendl++ ;
529         ostringstream* oss2 ;
530         SuperClassMap::const_iterator it ;
531         SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end();
532         
533         oss2=new ostringstream ;
534         *oss2<<"( "<<className<<"_id"  ;
535         for ( it=begin ; it != end; it++) 
536         {
537           *oss2<<", "<<it->second->getName() ;
538           if (oss2->str().size()>90) 
539           {
540             oss<<oss2->str()<<"  &"<<iendl ;
541             delete oss2 ;
542             oss2=new ostringstream ;
543           }
544         }
545         *oss2<<" )" ;
546         oss<<oss2->str()<<iendl ;
547         oss<<iendl ;
548         delete oss2 ; 
549         oss2=new ostringstream ;
550         
551         oss<<"IMPLICIT NONE"<<iendl++ ;
552
553         oss<<"TYPE(txios("<<className<<"))  :: "<<className<<"_hdl"<<iendl ;
554         oss<<"CHARACTER(LEN=*), INTENT(IN) ::"<<className<<"_id"<<iendl ;
555         
556         for (it=begin; it != end; it++)
557         {
558           it->second->generateFortranInterfaceDeclaration(oss,className) ;
559         }
560         
561         oss<<iendl ;
562         oss<<"CALL xios(get_"<<className<<"_handle)("<<className<<"_id,"<<className<<"_hdl)"<<iendl ; 
563         oss<<"CALL xios(set_"<<className<<"_attr_hdl_)   &"<<iendl ;
564         *oss2<<"( "<<className<<"_hdl"  ;
565         for ( it=begin ; it != end; it++) 
566         {
567           *oss2<<", "<<it->second->getName() ;
568           if (oss2->str().size()>90) 
569           {
570             oss<<oss2->str()<<"  &"<<iendl ;
571             delete oss2 ;
572             oss2=new ostringstream ;
573           }
574         }
575         *oss2<<" )" ;
576         oss<<oss2->str() ;
577         delete oss2 ; 
578         
579         oss<<iendl--<<iendl-- ;
580         oss<<"END SUBROUTINE xios(set_"<<className<<"_attr)"<<iendl ;
581         
582      }     
583     
584      void CAttributeMap::generateFortranInterfaceGet_id(ostream& oss, const string& className)
585      {
586         oss<<"SUBROUTINE xios(get_"<<className<<"_attr)  &"<<iendl++ ;
587         ostringstream* oss2 ;
588         SuperClassMap::const_iterator it ;
589         SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end();
590         
591         oss2=new ostringstream ;
592         *oss2<<"( "<<className<<"_id"  ;
593         for ( it=begin ; it != end; it++) 
594         {
595           *oss2<<", "<<it->second->getName() ;
596           if (oss2->str().size()>90) 
597           {
598             oss<<oss2->str()<<"  &"<<iendl ;
599             delete oss2 ;
600             oss2=new ostringstream ;
601           }
602         }
603         *oss2<<" )" ;
604         oss<<oss2->str()<<iendl ;
605         oss<<iendl ;
606         delete oss2 ; 
607         oss2=new ostringstream ;
608         
609         oss<<"IMPLICIT NONE"<<iendl++ ;
610
611         oss<<"TYPE(txios("<<className<<"))  :: "<<className<<"_hdl"<<iendl ;
612         oss<<"CHARACTER(LEN=*), INTENT(IN) ::"<<className<<"_id"<<iendl ;
613         
614         for (it=begin; it != end; it++)
615         {
616           it->second->generateFortranInterfaceGetDeclaration(oss,className) ;
617         }
618         
619         oss<<iendl ;
620         oss<<"CALL xios(get_"<<className<<"_handle)("<<className<<"_id,"<<className<<"_hdl)"<<iendl ; 
621         oss<<"CALL xios(get_"<<className<<"_attr_hdl_)   &"<<iendl ;
622         *oss2<<"( "<<className<<"_hdl"  ;
623         for ( it=begin ; it != end; it++) 
624         {
625           *oss2<<", "<<it->second->getName() ;
626           if (oss2->str().size()>90) 
627           {
628             oss<<oss2->str()<<"  &"<<iendl ;
629             delete oss2 ;
630             oss2=new ostringstream ;
631           }
632         }
633         *oss2<<" )" ;
634         oss<<oss2->str() ;
635         delete oss2 ; 
636         
637         oss<<iendl--<<iendl-- ;
638         oss<<"END SUBROUTINE xios(get_"<<className<<"_attr)"<<iendl ;
639         
640      }     
641     
642      void CAttributeMap::generateFortranInterfaceIsDefined_id(ostream& oss, const string& className)
643      {
644         oss<<"SUBROUTINE xios(is_defined_"<<className<<"_attr)  &"<<iendl++ ;
645         ostringstream* oss2 ;
646         SuperClassMap::const_iterator it ;
647         SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end();
648         
649         oss2=new ostringstream ;
650         *oss2<<"( "<<className<<"_id"  ;
651         for ( it=begin ; it != end; it++) 
652         {
653           *oss2<<", "<<it->second->getName() ;
654           if (oss2->str().size()>90) 
655           {
656             oss<<oss2->str()<<"  &"<<iendl ;
657             delete oss2 ;
658             oss2=new ostringstream ;
659           }
660         }
661         *oss2<<" )" ;
662         oss<<oss2->str()<<iendl ;
663         oss<<iendl ;
664         delete oss2 ; 
665         oss2=new ostringstream ;
666         
667         oss<<"IMPLICIT NONE"<<iendl++ ;
668
669         oss<<"TYPE(txios("<<className<<"))  :: "<<className<<"_hdl"<<iendl ;
670         oss<<"CHARACTER(LEN=*), INTENT(IN) ::"<<className<<"_id"<<iendl ;
671         
672         for (it=begin; it != end; it++)
673         {
674           it->second->generateFortranInterfaceIsDefinedDeclaration(oss,className) ;
675         }
676         
677         oss<<iendl ;
678         oss<<"CALL xios(get_"<<className<<"_handle)("<<className<<"_id,"<<className<<"_hdl)"<<iendl ; 
679         oss<<"CALL xios(is_defined_"<<className<<"_attr_hdl_)   &"<<iendl ;
680         *oss2<<"( "<<className<<"_hdl"  ;
681         for ( it=begin ; it != end; it++) 
682         {
683           *oss2<<", "<<it->second->getName() ;
684           if (oss2->str().size()>90) 
685           {
686             oss<<oss2->str()<<"  &"<<iendl ;
687             delete oss2 ;
688             oss2=new ostringstream ;
689           }
690         }
691         *oss2<<" )" ;
692         oss<<oss2->str() ;
693         delete oss2 ; 
694         
695         oss<<iendl--<<iendl-- ;
696         oss<<"END SUBROUTINE xios(is_defined_"<<className<<"_attr)"<<iendl ;
697         
698      }     
699      ///--------------------------------------------------------------
700 
701
702} // namespace xmlioser
Note: See TracBrowser for help on using the repository browser.