Changeset 875
- Timestamp:
- 06/21/16 17:00:24 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/node/file.cpp
r823 r875 357 357 { 358 358 StdString filename = getFileOutputName(); 359 if (!name_suffix.isEmpty()) filename+=name_suffix.getValue(); 360 361 // determine splitting format in the file name : firstPart%start_date%middlePart%end_date%lastPart 362 363 std::string strStartDate="%start_date%" ; 364 std::string strEndDate="%end_date%" ; 365 366 std::string firstPart ; 367 std::string middlePart ; 368 std::string lastPart ; 369 size_t pos1, pos2 ; 370 bool hasStartDate=false ; 371 bool hasEndDate=false ; 372 373 pos1=filename.find(strStartDate) ; 374 if (pos1!=std::string::npos) 375 { 376 firstPart=filename.substr(0,pos1) ; 377 pos1+=strStartDate.size() ; 378 hasStartDate=true ; 379 } 380 else pos1=0 ; 381 382 pos2=filename.find(strEndDate,pos1) ; 383 if (pos2!=std::string::npos) 384 { 385 middlePart=filename.substr(pos1,pos2-pos1) ; 386 cout<<pos2<<endl ; 387 pos2+=strEndDate.size() ; 388 lastPart=filename.substr(pos2,filename.size()-pos2) ; 389 hasEndDate=true ; 390 } 391 else middlePart=filename.substr(pos1,filename.size()) ; 392 393 if (!hasStartDate && !hasEndDate) 394 { 395 hasStartDate=true ; 396 hasEndDate=true; 397 firstPart=middlePart ; 398 middlePart="-" ; 399 } 400 // 401 cout<<"filename : "<<filename<<" firstPart : "<<firstPart<<" middlePart : "<<middlePart<<" lastPart : "<<lastPart<<endl ; 402 cout<<" hasStartDate : "<<hasStartDate<<" hasEndDate :"<<hasEndDate ; 359 403 StdOStringStream oss; 360 oss << filename;361 if (!name_suffix.isEmpty()) oss << name_suffix.getValue();362 404 363 405 if (!split_freq.isEmpty()) … … 377 419 else splitFormat = split_freq_format; 378 420 379 oss << "_" << lastSplit.getStr(splitFormat) << "-" << splitEnd.getStr(splitFormat); 421 oss << firstPart ; 422 if (hasStartDate) oss << lastSplit.getStr(splitFormat) ; 423 oss << middlePart ; 424 if (hasEndDate) oss << splitEnd.getStr(splitFormat); 425 oss << lastPart ; 380 426 381 427 context->registryOut->setKey("splitStart", lastSplit); 382 428 context->registryOut->setKey("splitEnd", splitEnd); 383 429 } 430 else oss<<firstPart<<lastPart ; 384 431 385 432 bool append = !this->append.isEmpty() && this->append.getValue();
Note: See TracChangeset
for help on using the changeset viewer.