Changeset 581 for XIOS/trunk/src/attribute_map.cpp
- Timestamp:
- 03/24/15 11:21:45 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/attribute_map.cpp
r509 r581 5 5 { 6 6 /// ////////////////////// Définitions ////////////////////// /// 7 CAttributeMap 7 CAttributeMap* CAttributeMap::Current = NULL; 8 8 9 9 CAttributeMap::CAttributeMap(void) … … 22 22 for (; it != end; it++) 23 23 { 24 const StdStrAttPair 24 const StdStrAttPair& att = *it; 25 25 att.second->reset(); 26 26 } … … 29 29 //--------------------------------------------------------------- 30 30 31 bool CAttributeMap::hasAttribute(const StdString 31 bool CAttributeMap::hasAttribute(const StdString& key) const 32 32 { 33 33 return (this->find(key) != this->end()); … … 41 41 //--------------------------------------------------------------- 42 42 43 void CAttributeMap::setAttribute(const StdString & key, CAttribute* const attr)43 void CAttributeMap::setAttribute(const StdString& key, CAttribute* const attr) 44 44 { 45 45 if (!this->hasAttribute(key)) … … 49 49 ERROR("CAttributeMap::setAttribute(key, attr)", 50 50 << "[ key = " << key << "] attr is null !"); 51 this->find(key)->second->set(*attr) 52 // 53 } 54 55 //--------------------------------------------------------------- 56 57 CAttribute * CAttributeMap::operator[](const StdString& key)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 58 { 59 59 if (!this->hasAttribute(key)) 60 ERROR("CAttributeMap::operator[](const StdString 60 ERROR("CAttributeMap::operator[](const StdString& key)", 61 61 << "[ key = " << key << "] key not found !"); 62 return (SuperClassMap::operator[](key));62 return SuperClassMap::operator[](key); 63 63 } 64 64 … … 73 73 for (; it != end; it++) 74 74 { 75 const StdStrAttPair 75 const StdStrAttPair& att = *it; 76 76 if (!att.second->isEmpty()) 77 77 oss << *att.second << " "; 78 78 } 79 return (oss.str());80 } 81 82 //--------------------------------------------------------------- 83 84 void CAttributeMap::fromString(const StdString 85 { 86 ERROR("CAttributeMap::fromString(const StdString 79 return oss.str(); 80 } 81 82 //--------------------------------------------------------------- 83 84 void CAttributeMap::fromString(const StdString& str) 85 { 86 ERROR("CAttributeMap::fromString(const StdString& str)", 87 87 << "[ str = " << str << "] Not implemented yet !"); 88 88 } … … 90 90 //--------------------------------------------------------------- 91 91 92 //StdOStream & operator << (StdOStream & os, const CAttributeMap& attributmap)92 //StdOStream& operator << (StdOStream& os, const CAttributeMap& attributmap) 93 93 //{ os << attributmap.toString(); return (os); } 94 94 95 95 //--------------------------------------------------------------- 96 96 97 void CAttributeMap::setAttributes(const xml::THashAttributes 97 void CAttributeMap::setAttributes(const xml::THashAttributes& attributes) 98 98 { 99 99 for (xml::THashAttributes::const_iterator it = attributes.begin(); 100 100 it != attributes.end(); 101 it ++) 102 { 103 if ((*it).first.compare(StdString("id")) != 0 && 104 (*it).first.compare(StdString("src"))!= 0) 101 it++) 102 { 103 if ((*it).first.compare(StdString("id")) != 0 && (*it).first.compare(StdString("src")) != 0) 105 104 { 106 105 //if (CAttributeMap::operator[]((*it).first)->isEmpty()) … … 121 120 or filled in in case of emptyp (true) 122 121 */ 123 void CAttributeMap::setAttributes(const CAttributeMap 122 void CAttributeMap::setAttributes(const CAttributeMap* const _parent, bool apply) 124 123 { 125 124 typedef std::pair<StdString, CAttribute*> StdStrAttPair; … … 128 127 for (; it != end; it++) 129 128 { 130 const StdStrAttPair 129 const StdStrAttPair& el = *it; 131 130 if (this->hasAttribute(el.first)) 132 131 { 133 CAttribute 134 CAttribute * parentAtt = el.second;132 CAttribute* currentAtt = CAttributeMap::operator[](el.first); 133 CAttribute* parentAtt = el.second; 135 134 if (apply) 136 135 { … … 140 139 } 141 140 } 142 else currentAtt->setInheritedValue(*parentAtt) 141 else currentAtt->setInheritedValue(*parentAtt); 143 142 } 144 143 } … … 147 146 //--------------------------------------------------------------- 148 147 /* 149 void CAttributeMap::toBinary(StdOStream 148 void CAttributeMap::toBinary(StdOStream& os) const 150 149 { 151 150 typedef std::pair<StdString, CAttribute*> StdStrAttPair; … … 157 156 for (; it != end; it++) 158 157 { 159 const StdString 158 const StdString& key = it->first; 160 159 const CAttribute* value = it->second; 161 160 const StdSize size = key.size(); 162 161 163 162 os.write (reinterpret_cast<const char*>(&size) , sizeof(StdSize)); 164 os.write (key.data(), size 163 os.write (key.data(), size* sizeof(char)); 165 164 166 165 if (!value->isEmpty()) … … 180 179 //--------------------------------------------------------------- 181 180 182 void CAttributeMap::fromBinary(StdIStream 181 void CAttributeMap::fromBinary(StdIStream& is) 183 182 { 184 183 StdSize nbatt = 0; … … 191 190 is.read (reinterpret_cast<char*>(&size), sizeof(StdSize)); 192 191 StdString key(size, ' '); 193 is.read (const_cast<char *>(key.data()), size 192 is.read (const_cast<char *>(key.data()), size* sizeof(char)); 194 193 195 194 if (!this->hasAttribute(key)) 196 ERROR("CAttributeMap::fromBinary(StdIStream 195 ERROR("CAttributeMap::fromBinary(StdIStream& is)", 197 196 << "[ key = " << key << "] key not found !"); 198 197 … … 209 208 for (; it != end; it++) 210 209 { 211 it->second->generateCInterface(oss,className) ; 212 it->second->generateCInterfaceIsDefined(oss,className) ; 213 oss<<iendl<<iendl ; 210 oss << std::endl << iendl; 211 it->second->generateCInterface(oss, className); 212 oss << iendl; 213 it->second->generateCInterfaceIsDefined(oss, className); 214 214 } 215 215 } … … 220 220 for (; it != end; it++) 221 221 { 222 it->second->generateFortran2003Interface(oss,className);223 it->second->generateFortran2003Interface IsDefined(oss,className);224 225 oss<<iendl<<iendl;222 oss << std::endl << iendl; 223 it->second->generateFortran2003Interface(oss, className); 224 oss << iendl; 225 it->second->generateFortran2003InterfaceIsDefined(oss, className); 226 226 } 227 227 } … … 231 231 void CAttributeMap::generateFortranInterface_hdl_(ostream& oss, const string& className) 232 232 { 233 oss<<"SUBROUTINE xios(set_"<<className<<"_attr_hdl_) &"<<iendl++ ; 234 ostringstream* oss2 ; 235 SuperClassMap::const_iterator it ; 236 SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end(); 237 238 oss2=new ostringstream ; 239 240 *oss2<<"( "<<className<<"_hdl" ; 241 242 for ( it=begin ; it != end; it++) 243 { 244 *oss2<<", "<<it->second->getName()<<"_" ; 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 257 oss<<"IMPLICIT NONE"<<iendl++ ; 258 oss<<"TYPE(txios("<<className<<")) , INTENT(IN) :: "<<className<<"_hdl"<<iendl ; 259 260 for (it=begin; it != end; it++) 261 { 262 it->second->generateFortranInterfaceDeclaration_(oss,className) ; 263 } 264 265 oss<<iendl ; 266 267 for (it=begin; it != end; it++) 268 { 269 it->second->generateFortranInterfaceBody_(oss,className) ; 270 oss<<iendl ; 271 } 272 273 oss<<iendl--<<iendl-- ; 274 oss<<"END SUBROUTINE xios(set_"<<className<<"_attr_hdl_)"<<iendl ; 275 233 oss << "SUBROUTINE xios(set_" << className << "_attr_hdl_) &" << iendl++; 234 ostringstream* oss2; 235 SuperClassMap::const_iterator it; 236 SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end(); 237 238 oss2 = new ostringstream; 239 240 *oss2 << "( " << className << "_hdl" ; 241 242 for (it = begin; it != end; it++) 243 { 244 *oss2 << ", " << it->second->getName() << "_"; 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() << std::endl; 254 oss << iendl; 255 delete oss2; 256 257 oss << "IMPLICIT NONE" << iendl++; 258 oss << "TYPE(txios(" << className << ")) , INTENT(IN) :: " << className << "_hdl"; 259 260 for (it = begin; it != end; it++) 261 { 262 oss << iendl; 263 it->second->generateFortranInterfaceDeclaration_(oss, className); 264 } 265 266 for (it = begin; it != end; it++) 267 { 268 oss << std::endl << iendl; 269 it->second->generateFortranInterfaceBody_(oss, className); 270 } 271 272 oss << std::endl << (iendl -= 2); 273 oss << "END SUBROUTINE xios(set_" << className << "_attr_hdl_)" << std::endl; 276 274 } 277 275 278 276 void CAttributeMap::generateFortranInterfaceGet_hdl_(ostream& oss, const string& className) 279 277 { 280 oss<<"SUBROUTINE xios(get_"<<className<<"_attr_hdl_) &"<<iendl++ ; 281 ostringstream* oss2 ; 282 SuperClassMap::const_iterator it ; 283 SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end(); 284 285 oss2=new ostringstream ; 286 287 *oss2<<"( "<<className<<"_hdl" ; 288 289 for ( it=begin ; it != end; it++) 290 { 291 *oss2<<", "<<it->second->getName()<<"_" ; 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 304 oss<<"IMPLICIT NONE"<<iendl++ ; 305 oss<<"TYPE(txios("<<className<<")) , INTENT(IN) :: "<<className<<"_hdl"<<iendl ; 306 307 for (it=begin; it != end; it++) 308 { 309 it->second->generateFortranInterfaceGetDeclaration_(oss,className) ; 310 } 311 312 oss<<iendl ; 313 314 for (it=begin; it != end; it++) 315 { 316 it->second->generateFortranInterfaceGetBody_(oss,className) ; 317 oss<<iendl ; 318 } 319 320 oss<<iendl--<<iendl-- ; 321 oss<<"END SUBROUTINE xios(get_"<<className<<"_attr_hdl_)"<<iendl ; 322 323 } 324 278 oss << "SUBROUTINE xios(get_" << className << "_attr_hdl_) &" << iendl++; 279 ostringstream* oss2; 280 SuperClassMap::const_iterator it; 281 SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end(); 282 283 oss2 = new ostringstream; 284 285 *oss2 << "( " << className << "_hdl" ; 286 287 for (it = begin; it != end; it++) 288 { 289 *oss2 << ", " << it->second->getName() << "_"; 290 if (oss2->str().size() > 90) 291 { 292 oss << oss2->str() << " &" << iendl; 293 delete oss2; 294 oss2 = new ostringstream; 295 } 296 } 297 *oss2 << " )"; 298 oss << oss2->str() << std::endl; 299 oss << iendl; 300 delete oss2; 301 302 oss << "IMPLICIT NONE" << iendl++; 303 oss << "TYPE(txios(" << className << ")) , INTENT(IN) :: " << className << "_hdl"; 304 305 for (it = begin; it != end; it++) 306 { 307 oss << iendl; 308 it->second->generateFortranInterfaceGetDeclaration_(oss, className); 309 } 310 311 for (it = begin; it != end; it++) 312 { 313 oss << std::endl << iendl; 314 it->second->generateFortranInterfaceGetBody_(oss, className); 315 } 316 317 oss << std::endl << (iendl -= 2); 318 oss << "END SUBROUTINE xios(get_" << className << "_attr_hdl_)" << std::endl; 319 } 325 320 326 321 void CAttributeMap::generateFortranInterfaceIsDefined_hdl_(ostream& oss, const string& className) 327 322 { 328 oss<<"SUBROUTINE xios(is_defined_"<<className<<"_attr_hdl_) &"<<iendl++ ; 329 ostringstream* oss2 ; 330 SuperClassMap::const_iterator it ; 331 SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end(); 332 333 oss2=new ostringstream ; 334 335 *oss2<<"( "<<className<<"_hdl" ; 336 337 for ( it=begin ; it != end; it++) 338 { 339 *oss2<<", "<<it->second->getName()<<"_" ; 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 352 oss<<"IMPLICIT NONE"<<iendl++ ; 353 oss<<"TYPE(txios("<<className<<")) , INTENT(IN) :: "<<className<<"_hdl"<<iendl ; 354 355 for (it=begin; it != end; it++) 356 { 357 it->second->generateFortranInterfaceIsDefinedDeclaration_(oss,className) ; 358 } 359 360 oss<<iendl ; 361 362 for (it=begin; it != end; it++) 363 { 364 it->second->generateFortranInterfaceIsDefinedBody_(oss,className) ; 365 oss<<iendl ; 366 } 367 368 oss<<iendl--<<iendl-- ; 369 oss<<"END SUBROUTINE xios(is_defined_"<<className<<"_attr_hdl_)"<<iendl ; 370 371 } 372 323 oss << "SUBROUTINE xios(is_defined_" << className << "_attr_hdl_) &" << iendl++; 324 ostringstream* oss2; 325 SuperClassMap::const_iterator it; 326 SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end(); 327 328 oss2 = new ostringstream; 329 330 *oss2 << "( " << className << "_hdl" ; 331 332 for (it = begin; it != end; it++) 333 { 334 *oss2 << ", " << it->second->getName() << "_"; 335 if (oss2->str().size() > 90) 336 { 337 oss << oss2->str() << " &" << iendl; 338 delete oss2; 339 oss2 = new ostringstream; 340 } 341 } 342 *oss2 << " )"; 343 oss << oss2->str() << std::endl; 344 oss << iendl; 345 delete oss2; 346 347 oss << "IMPLICIT NONE" << iendl++; 348 oss << "TYPE(txios(" << className << ")) , INTENT(IN) :: " << className << "_hdl"; 349 350 for (it = begin; it != end; it++) 351 { 352 oss << iendl; 353 it->second->generateFortranInterfaceIsDefinedDeclaration_(oss, className); 354 } 355 356 for (it = begin; it != end; it++) 357 { 358 oss << std::endl << iendl; 359 it->second->generateFortranInterfaceIsDefinedBody_(oss, className); 360 } 361 362 oss << std::endl << (iendl -= 2); 363 oss << "END SUBROUTINE xios(is_defined_" << className << "_attr_hdl_)" << std::endl; 364 } 373 365 374 366 void CAttributeMap::generateFortranInterface_hdl(ostream& oss, const string& className) 375 367 { 376 oss <<"SUBROUTINE xios(set_"<<className<<"_attr_hdl) &"<<iendl++;377 ostringstream* oss2 378 SuperClassMap::const_iterator it 379 SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end(); 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 399 oss <<"IMPLICIT NONE"<<iendl++;400 oss <<"TYPE(txios("<<className<<")) , INTENT(IN) :: "<<className<<"_hdl"<<iendl;401 402 for (it =begin; it != end; it++)403 { 404 it->second->generateFortranInterfaceDeclaration(oss,className);405 }406 407 oss<<iendl ; 408 409 oss<<"CALL xios(set_"<<className<<"_attr_hdl_) &"<<iendl ; 410 411 *oss2<<"( "<<className<<"_hdl" ; 412 for ( it=begin ; it != end; it++)413 {414 *oss2<<", "<<it->second->getName() ;415 if (oss2->str().size()>90)416 {417 oss<<oss2->str()<<" &"<<iendl ;418 delete oss2;419 oss2=new ostringstream;420 }421 }422 *oss2<<" )" ;423 oss<<oss2->str();424 delete oss2;425 426 oss<<iendl--<<iendl-- ; 427 oss <<"END SUBROUTINE xios(set_"<<className<<"_attr_hdl)"<<iendl;428 }429 368 oss << "SUBROUTINE xios(set_" << className << "_attr_hdl) &" << iendl++; 369 ostringstream* oss2; 370 SuperClassMap::const_iterator it; 371 SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end(); 372 373 oss2 = new ostringstream; 374 *oss2 << "( " << className << "_hdl" ; 375 for (it = begin; it != end; it++) 376 { 377 *oss2 << ", " << it->second->getName(); 378 if (oss2->str().size() > 90) 379 { 380 oss << oss2->str() << " &" << iendl; 381 delete oss2; 382 oss2 = new ostringstream; 383 } 384 } 385 *oss2 << " )"; 386 oss << oss2->str() << std::endl; 387 oss << iendl; 388 delete oss2; 389 oss2 = new ostringstream; 390 391 oss << "IMPLICIT NONE" << iendl++; 392 oss << "TYPE(txios(" << className << ")) , INTENT(IN) :: " << className << "_hdl"; 393 394 for (it = begin; it != end; it++) 395 { 396 oss << iendl; 397 it->second->generateFortranInterfaceDeclaration(oss, className); 398 } 399 400 oss << std::endl << iendl; 401 402 oss << "CALL xios(set_" << className << "_attr_hdl_) &" << iendl; 403 404 *oss2 << "( " << className << "_hdl" ; 405 for (it = begin; it != end; it++) 406 { 407 *oss2 << ", " << it->second->getName(); 408 if (oss2->str().size() > 90) 409 { 410 oss << oss2->str() << " &" << iendl; 411 delete oss2; 412 oss2 = new ostringstream; 413 } 414 } 415 *oss2 << " )"; 416 oss << oss2->str(); 417 delete oss2; 418 419 oss << std::endl << (iendl -= 2); 420 oss << "END SUBROUTINE xios(set_" << className << "_attr_hdl)" << std::endl; 421 } 430 422 431 423 void CAttributeMap::generateFortranInterfaceGet_hdl(ostream& oss, const string& className) 432 424 { 433 oss <<"SUBROUTINE xios(get_"<<className<<"_attr_hdl) &"<<iendl++;434 ostringstream* oss2 435 SuperClassMap::const_iterator it 436 SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end(); 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 456 oss <<"IMPLICIT NONE"<<iendl++;457 oss <<"TYPE(txios("<<className<<")) , INTENT(IN) :: "<<className<<"_hdl"<<iendl;458 459 for (it =begin; it != end; it++)460 { 461 it->second->generateFortranInterfaceGetDeclaration(oss,className);462 }463 464 oss<<iendl ; 465 466 oss<<"CALL xios(get_"<<className<<"_attr_hdl_) &"<<iendl ; 467 468 *oss2<<"( "<<className<<"_hdl" ; 469 for ( it=begin ; it != end; it++)470 {471 *oss2<<", "<<it->second->getName() ;472 if (oss2->str().size()>90)473 {474 oss<<oss2->str()<<" &"<<iendl ;475 delete oss2;476 oss2=new ostringstream;477 }478 }479 *oss2<<" )" ;480 oss<<oss2->str();481 delete oss2;482 483 oss<<iendl--<<iendl-- ; 484 oss <<"END SUBROUTINE xios(get_"<<className<<"_attr_hdl)"<<iendl;485 }486 425 oss << "SUBROUTINE xios(get_" << className << "_attr_hdl) &" << iendl++; 426 ostringstream* oss2; 427 SuperClassMap::const_iterator it; 428 SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end(); 429 430 oss2 = new ostringstream; 431 *oss2 << "( " << className << "_hdl" ; 432 for (it = begin; it != end; it++) 433 { 434 *oss2 << ", " << it->second->getName(); 435 if (oss2->str().size() > 90) 436 { 437 oss << oss2->str() << " &" << iendl; 438 delete oss2; 439 oss2 = new ostringstream; 440 } 441 } 442 *oss2 << " )"; 443 oss << oss2->str() << std::endl; 444 oss << iendl; 445 delete oss2; 446 oss2 = new ostringstream; 447 448 oss << "IMPLICIT NONE" << iendl++; 449 oss << "TYPE(txios(" << className << ")) , INTENT(IN) :: " << className << "_hdl"; 450 451 for (it = begin; it != end; it++) 452 { 453 oss << iendl; 454 it->second->generateFortranInterfaceGetDeclaration(oss, className); 455 } 456 457 oss << std::endl << iendl; 458 459 oss << "CALL xios(get_" << className << "_attr_hdl_) &" << iendl; 460 461 *oss2 << "( " << className << "_hdl" ; 462 for (it = begin; it != end; it++) 463 { 464 *oss2 << ", " << it->second->getName(); 465 if (oss2->str().size() > 90) 466 { 467 oss << oss2->str() << " &" << iendl; 468 delete oss2; 469 oss2 = new ostringstream; 470 } 471 } 472 *oss2 << " )"; 473 oss << oss2->str(); 474 delete oss2; 475 476 oss << std::endl << (iendl -= 2); 477 oss << "END SUBROUTINE xios(get_" << className << "_attr_hdl)" << std::endl; 478 } 487 479 488 480 void CAttributeMap::generateFortranInterfaceIsDefined_hdl(ostream& oss, const string& className) 489 481 { 490 oss <<"SUBROUTINE xios(is_defined_"<<className<<"_attr_hdl) &"<<iendl++;491 ostringstream* oss2 492 SuperClassMap::const_iterator it 493 SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end(); 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 513 oss <<"IMPLICIT NONE"<<iendl++;514 oss <<"TYPE(txios("<<className<<")) , INTENT(IN) :: "<<className<<"_hdl"<<iendl;515 516 for (it =begin; it != end; it++)517 { 518 it->second->generateFortranInterfaceIsDefinedDeclaration(oss,className);519 }520 521 oss<<iendl ; 522 523 oss<<"CALL xios(is_defined_"<<className<<"_attr_hdl_) &"<<iendl ; 524 525 *oss2<<"( "<<className<<"_hdl" ; 526 for ( it=begin ; it != end; it++)527 {528 *oss2<<", "<<it->second->getName() ;529 if (oss2->str().size()>90)530 {531 oss<<oss2->str()<<" &"<<iendl ;532 delete oss2;533 oss2=new ostringstream;534 }535 }536 *oss2<<" )" ;537 oss<<oss2->str();538 delete oss2;539 540 oss<<iendl--<<iendl-- ; 541 oss <<"END SUBROUTINE xios(is_defined_"<<className<<"_attr_hdl)"<<iendl;542 }543 482 oss << "SUBROUTINE xios(is_defined_" << className << "_attr_hdl) &" << iendl++; 483 ostringstream* oss2; 484 SuperClassMap::const_iterator it; 485 SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end(); 486 487 oss2 = new ostringstream; 488 *oss2 << "( " << className << "_hdl" ; 489 for (it = begin; it != end; it++) 490 { 491 *oss2 << ", " << it->second->getName(); 492 if (oss2->str().size() > 90) 493 { 494 oss << oss2->str() << " &" << iendl; 495 delete oss2; 496 oss2 = new ostringstream; 497 } 498 } 499 *oss2 << " )"; 500 oss << oss2->str() << std::endl; 501 oss << iendl; 502 delete oss2; 503 oss2 = new ostringstream; 504 505 oss << "IMPLICIT NONE" << iendl++; 506 oss << "TYPE(txios(" << className << ")) , INTENT(IN) :: " << className << "_hdl"; 507 508 for (it = begin; it != end; it++) 509 { 510 oss << iendl; 511 it->second->generateFortranInterfaceIsDefinedDeclaration(oss, className); 512 } 513 514 oss << std::endl << iendl; 515 516 oss << "CALL xios(is_defined_" << className << "_attr_hdl_) &" << iendl; 517 518 *oss2 << "( " << className << "_hdl" ; 519 for (it = begin; it != end; it++) 520 { 521 *oss2 << ", " << it->second->getName(); 522 if (oss2->str().size() > 90) 523 { 524 oss << oss2->str() << " &" << iendl; 525 delete oss2; 526 oss2 = new ostringstream; 527 } 528 } 529 *oss2 << " )"; 530 oss << oss2->str(); 531 delete oss2; 532 533 oss << std::endl << (iendl -= 2); 534 oss << "END SUBROUTINE xios(is_defined_" << className << "_attr_hdl)" << std::endl; 535 } 544 536 545 537 void CAttributeMap::generateFortranInterface_id(ostream& oss, const string& className) 546 538 { 547 oss <<"SUBROUTINE xios(set_"<<className<<"_attr) &"<<iendl++;548 ostringstream* oss2 549 SuperClassMap::const_iterator it 550 SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end(); 551 552 oss2 =new ostringstream;553 *oss2 <<"( "<<className<<"_id";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 570 oss <<"IMPLICIT NONE"<<iendl++;571 572 oss <<"TYPE(txios("<<className<<")) :: "<<className<<"_hdl"<<iendl;573 oss <<"CHARACTER(LEN=*), INTENT(IN) ::"<<className<<"_id"<<iendl;574 575 for (it =begin; it != end; it++)576 { 577 it->second->generateFortranInterfaceDeclaration(oss,className);578 }579 580 oss<<iendl ; 581 oss <<"CALL xios(get_"<<className<<"_handle)("<<className<<"_id,"<<className<<"_hdl)"<<iendl;582 oss <<"CALL xios(set_"<<className<<"_attr_hdl_) &"<<iendl;583 *oss2<<"( "<<className<<"_hdl";584 for ( it=begin ; it != end; it++)585 {586 *oss2<<", "<<it->second->getName() ;587 if (oss2->str().size()>90)588 {589 oss<<oss2->str()<<" &"<<iendl ;590 delete oss2;591 oss2=new ostringstream;592 }593 }594 *oss2<<" )" ;595 oss<<oss2->str();596 delete oss2;597 598 oss<<iendl--<<iendl-- ; 599 oss <<"END SUBROUTINE xios(set_"<<className<<"_attr)"<<iendl;600 539 oss << "SUBROUTINE xios(set_" << className << "_attr) &" << iendl++; 540 ostringstream* oss2; 541 SuperClassMap::const_iterator it; 542 SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end(); 543 544 oss2 = new ostringstream; 545 *oss2 << "( " << className << "_id" ; 546 for (it = begin; it != end; it++) 547 { 548 *oss2 << ", " << it->second->getName(); 549 if (oss2->str().size() > 90) 550 { 551 oss << oss2->str() << " &" << iendl; 552 delete oss2; 553 oss2 = new ostringstream; 554 } 555 } 556 *oss2 << " )"; 557 oss << oss2->str() << std::endl; 558 oss << iendl; 559 delete oss2; 560 oss2 = new ostringstream; 561 562 oss << "IMPLICIT NONE" << iendl++; 563 564 oss << "TYPE(txios(" << className << ")) :: " << className << "_hdl" << iendl; 565 oss << "CHARACTER(LEN=*), INTENT(IN) ::" << className << "_id"; 566 567 for (it = begin; it != end; it++) 568 { 569 oss << iendl; 570 it->second->generateFortranInterfaceDeclaration(oss, className); 571 } 572 573 oss << std::endl << iendl; 574 oss << "CALL xios(get_" << className << "_handle)(" << className << "_id," << className << "_hdl)" << iendl; 575 oss << "CALL xios(set_" << className << "_attr_hdl_) &" << iendl; 576 *oss2 << "( " << className << "_hdl" ; 577 for (it = begin; it != end; it++) 578 { 579 *oss2 << ", " << it->second->getName(); 580 if (oss2->str().size() > 90) 581 { 582 oss << oss2->str() << " &" << iendl; 583 delete oss2; 584 oss2 = new ostringstream; 585 } 586 } 587 *oss2 << " )"; 588 oss << oss2->str(); 589 delete oss2; 590 591 oss << std::endl << (iendl -= 2); 592 oss << "END SUBROUTINE xios(set_" << className << "_attr)" << std::endl; 601 593 } 602 594 603 595 void CAttributeMap::generateFortranInterfaceGet_id(ostream& oss, const string& className) 604 596 { 605 oss <<"SUBROUTINE xios(get_"<<className<<"_attr) &"<<iendl++;606 ostringstream* oss2 607 SuperClassMap::const_iterator it 608 SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end(); 609 610 oss2 =new ostringstream;611 *oss2 <<"( "<<className<<"_id";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 628 oss <<"IMPLICIT NONE"<<iendl++;629 630 oss <<"TYPE(txios("<<className<<")) :: "<<className<<"_hdl"<<iendl;631 oss <<"CHARACTER(LEN=*), INTENT(IN) ::"<<className<<"_id"<<iendl;632 633 for (it =begin; it != end; it++)634 { 635 it->second->generateFortranInterfaceGetDeclaration(oss,className);636 }637 638 oss<<iendl ; 639 oss <<"CALL xios(get_"<<className<<"_handle)("<<className<<"_id,"<<className<<"_hdl)"<<iendl;640 oss <<"CALL xios(get_"<<className<<"_attr_hdl_) &"<<iendl;641 *oss2<<"( "<<className<<"_hdl";642 for ( it=begin ; it != end; it++)643 {644 *oss2<<", "<<it->second->getName() ;645 if (oss2->str().size()>90)646 {647 oss<<oss2->str()<<" &"<<iendl ;648 delete oss2;649 oss2=new ostringstream;650 }651 }652 *oss2<<" )" ;653 oss<<oss2->str();654 delete oss2;655 656 oss<<iendl--<<iendl-- ; 657 oss <<"END SUBROUTINE xios(get_"<<className<<"_attr)"<<iendl;658 597 oss << "SUBROUTINE xios(get_" << className << "_attr) &" << iendl++; 598 ostringstream* oss2; 599 SuperClassMap::const_iterator it; 600 SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end(); 601 602 oss2 = new ostringstream; 603 *oss2 << "( " << className << "_id" ; 604 for (it = begin; it != end; it++) 605 { 606 *oss2 << ", " << it->second->getName(); 607 if (oss2->str().size() > 90) 608 { 609 oss << oss2->str() << " &" << iendl; 610 delete oss2; 611 oss2 = new ostringstream; 612 } 613 } 614 *oss2 << " )"; 615 oss << oss2->str() << std::endl; 616 oss << iendl; 617 delete oss2; 618 oss2 = new ostringstream; 619 620 oss << "IMPLICIT NONE" << iendl++; 621 622 oss << "TYPE(txios(" << className << ")) :: " << className << "_hdl" << iendl; 623 oss << "CHARACTER(LEN=*), INTENT(IN) ::" << className << "_id"; 624 625 for (it = begin; it != end; it++) 626 { 627 oss << iendl; 628 it->second->generateFortranInterfaceGetDeclaration(oss, className); 629 } 630 631 oss << std::endl << iendl; 632 oss << "CALL xios(get_" << className << "_handle)(" << className << "_id," << className << "_hdl)" << iendl; 633 oss << "CALL xios(get_" << className << "_attr_hdl_) &" << iendl; 634 *oss2 << "( " << className << "_hdl" ; 635 for (it = begin; it != end; it++) 636 { 637 *oss2 << ", " << it->second->getName(); 638 if (oss2->str().size() > 90) 639 { 640 oss << oss2->str() << " &" << iendl; 641 delete oss2; 642 oss2 = new ostringstream; 643 } 644 } 645 *oss2 << " )"; 646 oss << oss2->str(); 647 delete oss2; 648 649 oss << std::endl << (iendl -= 2); 650 oss << "END SUBROUTINE xios(get_" << className << "_attr)" << std::endl; 659 651 } 660 652 661 653 void CAttributeMap::generateFortranInterfaceIsDefined_id(ostream& oss, const string& className) 662 654 { 663 oss<<"SUBROUTINE xios(is_defined_"<<className<<"_attr) &"<<iendl++ ; 664 ostringstream* oss2 ; 665 SuperClassMap::const_iterator it ; 666 SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end(); 667 668 oss2=new ostringstream ; 669 *oss2<<"( "<<className<<"_id" ; 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 686 oss<<"IMPLICIT NONE"<<iendl++ ; 687 688 oss<<"TYPE(txios("<<className<<")) :: "<<className<<"_hdl"<<iendl ; 689 oss<<"CHARACTER(LEN=*), INTENT(IN) ::"<<className<<"_id"<<iendl ; 690 691 for (it=begin; it != end; it++) 692 { 693 it->second->generateFortranInterfaceIsDefinedDeclaration(oss,className) ; 694 } 695 696 oss<<iendl ; 697 oss<<"CALL xios(get_"<<className<<"_handle)("<<className<<"_id,"<<className<<"_hdl)"<<iendl ; 698 oss<<"CALL xios(is_defined_"<<className<<"_attr_hdl_) &"<<iendl ; 699 *oss2<<"( "<<className<<"_hdl" ; 700 for ( it=begin ; it != end; it++) 701 { 702 *oss2<<", "<<it->second->getName() ; 703 if (oss2->str().size()>90) 704 { 705 oss<<oss2->str()<<" &"<<iendl ; 706 delete oss2 ; 707 oss2=new ostringstream ; 708 } 709 } 710 *oss2<<" )" ; 711 oss<<oss2->str() ; 712 delete oss2 ; 713 714 oss<<iendl--<<iendl-- ; 715 oss<<"END SUBROUTINE xios(is_defined_"<<className<<"_attr)"<<iendl ; 716 717 } 718 ///-------------------------------------------------------------- 719 720 655 oss << "SUBROUTINE xios(is_defined_" << className << "_attr) &" << iendl++; 656 ostringstream* oss2; 657 SuperClassMap::const_iterator it; 658 SuperClassMap::const_iterator begin = SuperClassMap::begin(), end = SuperClassMap::end(); 659 660 oss2 = new ostringstream; 661 *oss2 << "( " << className << "_id" ; 662 for (it = begin; it != end; it++) 663 { 664 *oss2 << ", " << it->second->getName(); 665 if (oss2->str().size() > 90) 666 { 667 oss << oss2->str() << " &" << iendl; 668 delete oss2; 669 oss2 = new ostringstream; 670 } 671 } 672 *oss2 << " )"; 673 oss << oss2->str() << std::endl; 674 oss << iendl; 675 delete oss2; 676 oss2 = new ostringstream; 677 678 oss << "IMPLICIT NONE" << iendl++; 679 680 oss << "TYPE(txios(" << className << ")) :: " << className << "_hdl" << iendl; 681 oss << "CHARACTER(LEN=*), INTENT(IN) ::" << className << "_id"; 682 683 for (it = begin; it != end; it++) 684 { 685 oss << iendl; 686 it->second->generateFortranInterfaceIsDefinedDeclaration(oss, className); 687 } 688 689 oss << std::endl << iendl; 690 oss << "CALL xios(get_" << className << "_handle)(" << className << "_id," << className << "_hdl)" << iendl; 691 oss << "CALL xios(is_defined_" << className << "_attr_hdl_) &" << iendl; 692 *oss2 << "( " << className << "_hdl" ; 693 for (it = begin; it != end; it++) 694 { 695 *oss2 << ", " << it->second->getName(); 696 if (oss2->str().size() > 90) 697 { 698 oss << oss2->str() << " &" << iendl; 699 delete oss2; 700 oss2 = new ostringstream; 701 } 702 } 703 *oss2 << " )"; 704 oss << oss2->str(); 705 delete oss2; 706 707 oss << std::endl << (iendl -= 2); 708 oss << "END SUBROUTINE xios(is_defined_" << className << "_attr)" << std::endl; 709 } 721 710 } // namespace xmlioser
Note: See TracChangeset
for help on using the changeset viewer.