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

Last change on this file since 470 was 445, checked in by ymipsl, 11 years ago

Add possibility to make inheritance of attributes and reference before closing the context definition.
New fortran fonction : xios_solve inheritance()
After this call, the value of attribute have the inherited value of their parent.

YM

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