Changeset 313 for XIOS/trunk/src/attribute_map.cpp
- Timestamp:
- 02/18/12 22:43:24 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/attribute_map.cpp
r278 r313 1 1 #include "attribute_map.hpp" 2 #include "indent.hpp" 2 3 3 4 namespace xmlioserver … … 186 187 } 187 188 189 void CAttributeMap::generateCInterface(ostream& oss, const string& className) 190 { 191 SuperClassMap::const_iterator it = SuperClassMap::begin(), end = SuperClassMap::end(); 192 for (; it != end; it++) 193 { 194 it->second->generateCInterface(oss,className) ; 195 oss<<iendl<<iendl ; 196 } 197 } 198 199 void CAttributeMap::generateFortran2003Interface(ostream& oss, const string& className) 200 { 201 SuperClassMap::const_iterator it = SuperClassMap::begin(), end = SuperClassMap::end(); 202 for (; it != end; it++) 203 { 204 it->second->generateFortran2003Interface(oss,className) ; 205 oss<<iendl<<iendl ; 206 } 207 } 208 188 209 ///-------------------------------------------------------------- 210 211 void CAttributeMap::generateFortranInterface_hdl_(ostream& oss, const string& className) 212 { 213 oss<<"SUBROUTINE xios(set_"<<className<<"_attr_hdl_) &"<<iendl++ ; 214 ostringstream* oss2 ; 215 SuperClassMap::const_iterator it ; 216 SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end(); 217 218 oss2=new ostringstream ; 219 220 *oss2<<"( "<<className<<"_hdl" ; 221 222 for ( it=begin ; it != end; it++) 223 { 224 *oss2<<", "<<it->second->getName()<<"_" ; 225 if (oss2->str().size()>90) 226 { 227 oss<<oss2->str()<<" &"<<iendl ; 228 delete oss2 ; 229 oss2=new ostringstream ; 230 } 231 } 232 *oss2<<" )" ; 233 oss<<oss2->str()<<iendl ; 234 oss<<iendl ; 235 delete oss2 ; 236 237 oss<<"IMPLICIT NONE"<<iendl++ ; 238 oss<<"TYPE(txios("<<className<<")) , INTENT(IN) :: "<<className<<"_hdl"<<iendl ; 239 240 for (it=begin; it != end; it++) 241 { 242 it->second->generateFortranInterfaceDeclaration_(oss,className) ; 243 } 244 245 oss<<iendl ; 246 247 for (it=begin; it != end; it++) 248 { 249 it->second->generateFortranInterfaceBody_(oss,className) ; 250 oss<<iendl ; 251 } 252 253 oss<<iendl--<<iendl-- ; 254 oss<<"END SUBROUTINE xios(set_"<<className<<"_attr_hdl_)"<<iendl ; 255 256 } 257 258 void CAttributeMap::generateFortranInterfaceGet_hdl_(ostream& oss, const string& className) 259 { 260 oss<<"SUBROUTINE xios(get_"<<className<<"_attr_hdl_) &"<<iendl++ ; 261 ostringstream* oss2 ; 262 SuperClassMap::const_iterator it ; 263 SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end(); 264 265 oss2=new ostringstream ; 266 267 *oss2<<"( "<<className<<"_hdl" ; 268 269 for ( it=begin ; it != end; it++) 270 { 271 *oss2<<", "<<it->second->getName()<<"_" ; 272 if (oss2->str().size()>90) 273 { 274 oss<<oss2->str()<<" &"<<iendl ; 275 delete oss2 ; 276 oss2=new ostringstream ; 277 } 278 } 279 *oss2<<" )" ; 280 oss<<oss2->str()<<iendl ; 281 oss<<iendl ; 282 delete oss2 ; 283 284 oss<<"IMPLICIT NONE"<<iendl++ ; 285 oss<<"TYPE(txios("<<className<<")) , INTENT(IN) :: "<<className<<"_hdl"<<iendl ; 286 287 for (it=begin; it != end; it++) 288 { 289 it->second->generateFortranInterfaceGetDeclaration_(oss,className) ; 290 } 291 292 oss<<iendl ; 293 294 for (it=begin; it != end; it++) 295 { 296 it->second->generateFortranInterfaceGetBody_(oss,className) ; 297 oss<<iendl ; 298 } 299 300 oss<<iendl--<<iendl-- ; 301 oss<<"END SUBROUTINE xios(get_"<<className<<"_attr_hdl_)"<<iendl ; 302 303 } 304 305 void CAttributeMap::generateFortranInterface_hdl(ostream& oss, const string& className) 306 { 307 oss<<"SUBROUTINE xios(set_"<<className<<"_attr_hdl) &"<<iendl++ ; 308 ostringstream* oss2 ; 309 SuperClassMap::const_iterator it ; 310 SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end(); 311 312 oss2=new ostringstream ; 313 *oss2<<"( "<<className<<"_hdl" ; 314 for ( it=begin ; it != end; it++) 315 { 316 *oss2<<", "<<it->second->getName() ; 317 if (oss2->str().size()>90) 318 { 319 oss<<oss2->str()<<" &"<<iendl ; 320 delete oss2 ; 321 oss2=new ostringstream ; 322 } 323 } 324 *oss2<<" )" ; 325 oss<<oss2->str()<<iendl ; 326 oss<<iendl ; 327 delete oss2 ; 328 oss2=new ostringstream ; 329 330 oss<<"IMPLICIT NONE"<<iendl++ ; 331 oss<<"TYPE(txios("<<className<<")) , INTENT(IN) :: "<<className<<"_hdl"<<iendl ; 332 333 for (it=begin; it != end; it++) 334 { 335 it->second->generateFortranInterfaceDeclaration(oss,className) ; 336 } 337 338 oss<<iendl ; 339 340 oss<<"CALL xios(set_"<<className<<"_attr_hdl_) &"<<iendl ; 341 342 *oss2<<"( "<<className<<"_hdl" ; 343 for ( it=begin ; it != end; it++) 344 { 345 *oss2<<", "<<it->second->getName() ; 346 if (oss2->str().size()>90) 347 { 348 oss<<oss2->str()<<" &"<<iendl ; 349 delete oss2 ; 350 oss2=new ostringstream ; 351 } 352 } 353 *oss2<<" )" ; 354 oss<<oss2->str() ; 355 delete oss2 ; 356 357 oss<<iendl--<<iendl-- ; 358 oss<<"END SUBROUTINE xios(set_"<<className<<"_attr_hdl)"<<iendl ; 359 } 360 361 362 void CAttributeMap::generateFortranInterfaceGet_hdl(ostream& oss, const string& className) 363 { 364 oss<<"SUBROUTINE xios(get_"<<className<<"_attr_hdl) &"<<iendl++ ; 365 ostringstream* oss2 ; 366 SuperClassMap::const_iterator it ; 367 SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end(); 368 369 oss2=new ostringstream ; 370 *oss2<<"( "<<className<<"_hdl" ; 371 for ( it=begin ; it != end; it++) 372 { 373 *oss2<<", "<<it->second->getName() ; 374 if (oss2->str().size()>90) 375 { 376 oss<<oss2->str()<<" &"<<iendl ; 377 delete oss2 ; 378 oss2=new ostringstream ; 379 } 380 } 381 *oss2<<" )" ; 382 oss<<oss2->str()<<iendl ; 383 oss<<iendl ; 384 delete oss2 ; 385 oss2=new ostringstream ; 386 387 oss<<"IMPLICIT NONE"<<iendl++ ; 388 oss<<"TYPE(txios("<<className<<")) , INTENT(IN) :: "<<className<<"_hdl"<<iendl ; 389 390 for (it=begin; it != end; it++) 391 { 392 it->second->generateFortranInterfaceGetDeclaration(oss,className) ; 393 } 394 395 oss<<iendl ; 396 397 oss<<"CALL xios(get_"<<className<<"_attr_hdl_) &"<<iendl ; 398 399 *oss2<<"( "<<className<<"_hdl" ; 400 for ( it=begin ; it != end; it++) 401 { 402 *oss2<<", "<<it->second->getName() ; 403 if (oss2->str().size()>90) 404 { 405 oss<<oss2->str()<<" &"<<iendl ; 406 delete oss2 ; 407 oss2=new ostringstream ; 408 } 409 } 410 *oss2<<" )" ; 411 oss<<oss2->str() ; 412 delete oss2 ; 413 414 oss<<iendl--<<iendl-- ; 415 oss<<"END SUBROUTINE xios(get_"<<className<<"_attr_hdl)"<<iendl ; 416 } 417 418 void CAttributeMap::generateFortranInterface_id(ostream& oss, const string& className) 419 { 420 oss<<"SUBROUTINE xios(set_"<<className<<"_attr) &"<<iendl++ ; 421 ostringstream* oss2 ; 422 SuperClassMap::const_iterator it ; 423 SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end(); 424 425 oss2=new ostringstream ; 426 *oss2<<"( "<<className<<"_id" ; 427 for ( it=begin ; it != end; it++) 428 { 429 *oss2<<", "<<it->second->getName() ; 430 if (oss2->str().size()>90) 431 { 432 oss<<oss2->str()<<" &"<<iendl ; 433 delete oss2 ; 434 oss2=new ostringstream ; 435 } 436 } 437 *oss2<<" )" ; 438 oss<<oss2->str()<<iendl ; 439 oss<<iendl ; 440 delete oss2 ; 441 oss2=new ostringstream ; 442 443 oss<<"IMPLICIT NONE"<<iendl++ ; 444 445 oss<<"TYPE(txios("<<className<<")) :: "<<className<<"_hdl"<<iendl ; 446 oss<<"CHARACTER(LEN=*), INTENT(IN) ::"<<className<<"_id"<<iendl ; 447 448 for (it=begin; it != end; it++) 449 { 450 it->second->generateFortranInterfaceDeclaration(oss,className) ; 451 } 452 453 oss<<iendl ; 454 oss<<"CALL xios(get_"<<className<<"_handle)("<<className<<"_id,"<<className<<"_hdl)"<<iendl ; 455 oss<<"CALL xios(set_"<<className<<"_attr_hdl_) &"<<iendl ; 456 *oss2<<"( "<<className<<"_hdl" ; 457 for ( it=begin ; it != end; it++) 458 { 459 *oss2<<", "<<it->second->getName() ; 460 if (oss2->str().size()>90) 461 { 462 oss<<oss2->str()<<" &"<<iendl ; 463 delete oss2 ; 464 oss2=new ostringstream ; 465 } 466 } 467 *oss2<<" )" ; 468 oss<<oss2->str() ; 469 delete oss2 ; 470 471 oss<<iendl--<<iendl-- ; 472 oss<<"END SUBROUTINE xios(set_"<<className<<"_attr)"<<iendl ; 473 474 } 475 476 void CAttributeMap::generateFortranInterfaceGet_id(ostream& oss, const string& className) 477 { 478 oss<<"SUBROUTINE xios(get_"<<className<<"_attr) &"<<iendl++ ; 479 ostringstream* oss2 ; 480 SuperClassMap::const_iterator it ; 481 SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end(); 482 483 oss2=new ostringstream ; 484 *oss2<<"( "<<className<<"_id" ; 485 for ( it=begin ; it != end; it++) 486 { 487 *oss2<<", "<<it->second->getName() ; 488 if (oss2->str().size()>90) 489 { 490 oss<<oss2->str()<<" &"<<iendl ; 491 delete oss2 ; 492 oss2=new ostringstream ; 493 } 494 } 495 *oss2<<" )" ; 496 oss<<oss2->str()<<iendl ; 497 oss<<iendl ; 498 delete oss2 ; 499 oss2=new ostringstream ; 500 501 oss<<"IMPLICIT NONE"<<iendl++ ; 502 503 oss<<"TYPE(txios("<<className<<")) :: "<<className<<"_hdl"<<iendl ; 504 oss<<"CHARACTER(LEN=*), INTENT(IN) ::"<<className<<"_id"<<iendl ; 505 506 for (it=begin; it != end; it++) 507 { 508 it->second->generateFortranInterfaceGetDeclaration(oss,className) ; 509 } 510 511 oss<<iendl ; 512 oss<<"CALL xios(get_"<<className<<"_handle)("<<className<<"_id,"<<className<<"_hdl)"<<iendl ; 513 oss<<"CALL xios(get_"<<className<<"_attr_hdl_) &"<<iendl ; 514 *oss2<<"( "<<className<<"_hdl" ; 515 for ( it=begin ; it != end; it++) 516 { 517 *oss2<<", "<<it->second->getName() ; 518 if (oss2->str().size()>90) 519 { 520 oss<<oss2->str()<<" &"<<iendl ; 521 delete oss2 ; 522 oss2=new ostringstream ; 523 } 524 } 525 *oss2<<" )" ; 526 oss<<oss2->str() ; 527 delete oss2 ; 528 529 oss<<iendl--<<iendl-- ; 530 oss<<"END SUBROUTINE xios(get_"<<className<<"_attr)"<<iendl ; 531 532 } 533 ///-------------------------------------------------------------- 534 189 535 190 536 } // namespace tree
Note: See TracChangeset
for help on using the changeset viewer.