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


Ignore:
Timestamp:
Apr 12, 2000, 7:49:54 PM (25 years ago)
Author:
ansari
Message:

Documentation de fichiers - Reza 12/4/2000

File:
1 edited

Legend:

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

    r827 r895  
    1212//++
    1313// Class        DVList
    14 // Lib          Outils++
     14// Lib          SysTools
    1515// include      dvlist.h
    1616//
     
    4242static MuTyV ddvdum(-9.e19);
    4343
     44/*!
     45   \class SOPHYA::DVList
     46   This class can be used to construct list of values associated with names.
     47   Variables names should not contain space characters and is limited to 64
     48   characters. The DVList class uses \b SOPHYA::MuTyV objects to hold values
     49   of type string, integer (\b int_8) or float (\b r_8). A comment string
     50   can be associated with each variable name. A global comment string
     51   can be attached to the DVList object. DVList objects can conveniently be
     52   used to represent FITS headers. The class \b SOPHYA::ObjFileIO<DVList>
     53   handles serialisation for DVList. (See SOPHYA::PPersist ).
     54   An
     55   \code
     56   //  ------- Using MuTyV objects -------
     57   MuTyV mvu;         // MuTyV variable declaration
     58   mvu = 60;          // mvu contains the integer value 60
     59   mvu = 66.6;        // and now the double value 66.6
     60   string ds = mvu;   // ds contains the string "66.6"
     61   MuTyV mvi(14);     // New MuTyV variable containing integer value 14
     62   r_4 x = mvi;       // x has the value 14.0
     63   MuTyV mvs("Bonjour !");  // mvs contains the string "Bonjour !"
     64   string s = mvs;          // s vaut "Bonjour, Ca va ?" 
     65   //  ------- Using DVList objects ------
     66   DVList  dvl;
     67   dvl("toto") = 14;      // Integer type value (=14) named toto
     68   dvl("titi") = 25.5;    // float type value (=25.5) named titi
     69   dvl("tata") = "Bonjour !"; // string type value (="Bonjour !") named tata
     70   // Upper and lower case letters are distinguished
     71   dvl("hello") = 88;
     72   dvl("Hello") = 77.77;   
     73   dvl.Comment() = "DVList test object, with values named hello, Hello ";
     74   // Saving the dvl object into a PPF file
     75   POutStream os("dvl.ppf");
     76   os << dvl;
     77   //  later on ...
     78   DVList dvlr;
     79   PInStream is("dvl.ppf");
     80   is << dvlr;
     81   int k = dvlr["toto"] ;     //  k = 14
     82   r_8 b = dvlr["titi"] ;     //  b = 25.5
     83   string s =  dvlr["tata"] ; //  s = "Bonjour !"
     84   int m =  dvlr["hello"] ;   //  m = 88
     85
     86   \endcode
     87*/
    4488
    4589//++
     
    58102
    59103/* --Methode-- */
     104/*! Default constructor */
    60105DVList::DVList()
    61106{
     
    64109
    65110/* --Methode-- */
     111/*! copy constructor */
    66112DVList::DVList(const DVList& dvl)
    67113{
     
    70116
    71117/* --Methode-- */
     118/*! Copy constructor - Object initialized using the PPF file \b flnm */
    72119DVList::DVList(char *flnm)
    73120{
     
    97144
    98145/* --Methode-- */
     146/*! Copy operator - Replaces the variables list with the list from \b dvl */
    99147DVList&     DVList::operator= (const DVList& dvl)
    100148{
     
    105153
    106154/* --Methode-- */
     155/*! Resets the object and clears the variable list and global comment */
    107156void        DVList::Clear()
    108157{
     
    112161
    113162/* --Methode-- */
     163/*! Appends the values from the object \b dvl to the objects list */
    114164DVList&     DVList::Merge(const DVList& dvl)
    115165{
     
    149199
    150200/* --Methode-- */
     201/*! Returns the value corresponding to name \b key, converted to integer
     202    Default value \b def is returned if name \b key not found */
    151203int_8       DVList::GetI(string const& key, int_8 def)
    152204{
     
    158210
    159211/* --Methode-- */
     212/*! Returns the value corresponding to name \b key, converted to double
     213    Default value \b def is returned if name \b key not found */
    160214r_8      DVList::GetD(string const& key, r_8 def)
    161215{
     
    167221
    168222/* --Methode-- */
     223/*! Returns the value corresponding to name \b key, converted to string
     224    Default value \b def is returned if name \b key not found */
    169225string      DVList::GetS(string const& key, char* def)
    170226{
     
    176232
    177233/* --Methode-- */
     234/*! Returns the comment associated with name \b key */
    178235string      DVList::GetComment(string const& key)
    179236{
     
    200257
    201258/* --Methode-- */
     259/*! Appends or sets the integer value \b val in the list with name \b key */
    202260void        DVList::SetI(string const& key, int_8 val)
    203261{
     
    207265/* --Methode-- */
    208266void        DVList::SetD(string const& key, r_8 val)
     267/*! Appends or sets the double value \b val in the list with name \b key */
    209268{
    210269Get(key) = (r_8)val;
     
    212271
    213272/* --Methode-- */
     273/*! Appends or sets the string value \b val in the list with name \b key */
    214274void        DVList::SetS(string const& key, char const* val)
    215275{
     
    219279
    220280/* --Methode-- */
     281/*! Appends or sets the string value \b val in the list with name \b key */
    221282void        DVList::SetS(string const& key, string val)
    222283{
     
    226287
    227288/* --Methode-- */
     289/*! Assigns the comment \b comm with the name \b key .
     290    Does nothing if the entry with name is not present in the list   */
    228291void        DVList::SetComment(string const& key, string const& comm)
    229292{
     
    246309
    247310/* --Methode-- */
     311/*!  Return the MuTyV value associated with name \b key .
     312     Adds an entry of type integer in the list if \b key is not present in the list   */
    248313MuTyV&      DVList::Get(string const& key)
    249314{
     
    272337//--
    273338
    274 
    275 /* --Methode-- */
     339/* --Methode-- */
     340/*! Prints a brief description of object on on the output stream \b os */
     341void        DVList::Show(ostream& os) const
     342{
     343os << "DVList::Show() - NVar= " << (int)mvlist.size() << "\n";
     344os << comment << endl;
     345}
     346
     347/* --Methode-- */
     348/*! Prints the list of variables on the output stream \b os */
    276349void        DVList::Print(ostream& os) const
    277350{
Note: See TracChangeset for help on using the changeset viewer.