Changeset 2826 in Sophya for trunk/SophyaLib/BaseTools/dvlist.cc
- Timestamp:
- Nov 2, 2005, 9:52:39 AM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/BaseTools/dvlist.cc
r2698 r2826 49 49 Variables names should not contain space characters and is limited to 64 50 50 characters. The DVList class uses \b SOPHYA::MuTyV objects to hold values 51 of type string, integer (\b int_8) or float (\b r_8) . A comment string52 can be associated with each variable name. A global comment string51 of type string, integer (\b int_8) or float (\b r_8) or time/date (TimeStamp). 52 A comment string can be associated with each variable name. A global comment string 53 53 can be attached to the DVList object. DVList objects can conveniently be 54 54 used to represent FITS headers. The class \b SOPHYA::ObjFileIO<DVList> 55 55 handles serialisation for DVList. (See SOPHYA::PPersist ). 56 56 57 \sa SOPHYA::ObjFileIO<DVList> 58 \sa SOPHYA::MuTyV 57 59 58 60 \code … … 65 67 dvl("hello") = 88; 66 68 dvl("Hello") = 77.77; 69 dvl("ToDay") = TimeStamp(); 67 70 dvl.Comment() = "DVList test object, with values named hello, Hello "; 68 71 // Saving the dvl object into a PPF file … … 333 336 334 337 /* --Methode-- */ 338 /*! Appends or sets the TimeStamp value \b val in the list with name \b key */ 339 void DVList::SetT(string const& key, TimeStamp const& val) 340 { 341 MuTyV div(val); 342 Get(key) = div; 343 } 344 345 /* --Methode-- */ 335 346 /*! Assigns the comment \b comm with the name \b key . 336 347 Does nothing if the entry with name is not present in the list */ … … 408 419 if (comment.length() > 0) os << comment << endl; 409 420 char buff[1024]; 421 TimeStamp ts; 410 422 ValList::const_iterator it; 411 423 for(it = mvlist.begin(); it != mvlist.end(); it++) { … … 427 439 sprintf(buff, "%s = %s (string) %s\n", (*it).first.substr(0,64).c_str(), 428 440 (*it).second.elval.GetStringPointer()->substr(0,800).c_str(), (*it).second.elcomm.substr(0,128).c_str()); 441 break; 442 case MuTyV::MTVTimeStamp : 443 ts.Set((*it).second.elval.GetRealPart()); 444 sprintf(buff, "%s = %s (TimeStamp) %s\n", (*it).first.substr(0,64).c_str(), 445 ts.ToString().c_str(), (*it).second.elcomm.substr(0,128).c_str()); 429 446 break; 430 447 default : … … 514 531 sfw = buf; s.PutStr(sfw); 515 532 break; 533 case MuTyV::MTVTimeStamp : 534 sprintf(buf,"T %s %.20g\n", (*it).first.substr(0,64).c_str(), (*it).second.elval.GetRealPart() ); 535 sfw = buf; s.PutStr(sfw); 536 break; 516 537 default : 517 538 break; … … 524 545 } 525 546 526 sfw = "ZZZZZ--End-of-Vari ble-List------"; s.PutStr(sfw);547 sfw = "ZZZZZ--End-of-Variable-List------"; s.PutStr(sfw); 527 548 } 528 549 … … 587 608 dobj->SetS(key, buf+j+1); 588 609 break; 610 case 'T' : 611 dv = atof(buf+j+1); 612 key = buf+2; 613 dobj->SetT(key, TimeStamp(dv)); 614 break; 589 615 default : 590 616 break;
Note:
See TracChangeset
for help on using the changeset viewer.