Changeset 2826 in Sophya for trunk/SophyaLib/BaseTools/dvlist.cc


Ignore:
Timestamp:
Nov 2, 2005, 9:52:39 AM (20 years ago)
Author:
ansari
Message:

1/ Correction bug TimeStamp::ToDays() + petites amelioration
2/ Prise en compte du type TimeStamp dans MuTyV (sous forme de r_8 en interne)
3/ Adaptation DVList a modifs MuTyV (typ TimeStamp) et R/W PPersist

+ Petites corrections et MAJ num.version , Reza 2 Nov 2005

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaLib/BaseTools/dvlist.cc

    r2698 r2826  
    4949   Variables names should not contain space characters and is limited to 64
    5050   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 string
    52    can be associated with each variable name. A global comment string
     51   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
    5353   can be attached to the DVList object. DVList objects can conveniently be
    5454   used to represent FITS headers. The class \b SOPHYA::ObjFileIO<DVList>
    5555   handles serialisation for DVList. (See SOPHYA::PPersist ).
     56
    5657   \sa SOPHYA::ObjFileIO<DVList>
     58   \sa SOPHYA::MuTyV
    5759
    5860   \code
     
    6567   dvl("hello") = 88;
    6668   dvl("Hello") = 77.77;   
     69   dvl("ToDay") = TimeStamp();   
    6770   dvl.Comment() = "DVList test object, with values named hello, Hello ";
    6871   // Saving the dvl object into a PPF file
     
    333336
    334337/* --Methode-- */
     338/*! Appends or sets the TimeStamp value \b val in the list with name \b key */
     339void        DVList::SetT(string const& key, TimeStamp const& val)
     340{
     341MuTyV div(val);
     342Get(key) = div;
     343}
     344
     345/* --Methode-- */
    335346/*! Assigns the comment \b comm with the name \b key .
    336347    Does nothing if the entry with name is not present in the list   */
     
    408419if (comment.length() > 0)  os << comment << endl;
    409420char buff[1024];
     421TimeStamp ts;
    410422ValList::const_iterator it;
    411423for(it = mvlist.begin(); it != mvlist.end(); it++)  {
     
    427439      sprintf(buff, "%s = %s (string) %s\n", (*it).first.substr(0,64).c_str(),
    428440              (*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());
    429446      break;
    430447    default :
     
    514531      sfw = buf;  s.PutStr(sfw);
    515532      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;
    516537    default :
    517538      break;
     
    524545}
    525546
    526 sfw = "ZZZZZ--End-of-Varible-List------"; s.PutStr(sfw);
     547sfw = "ZZZZZ--End-of-Variable-List------"; s.PutStr(sfw);
    527548}
    528549
     
    587608      dobj->SetS(key, buf+j+1);
    588609      break;
     610    case 'T' :
     611      dv = atof(buf+j+1);
     612      key = buf+2;
     613      dobj->SetT(key, TimeStamp(dv));
     614      break;
    589615    default :
    590616      break;
Note: See TracChangeset for help on using the changeset viewer.