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