Changeset 2826 in Sophya for trunk/SophyaLib/BaseTools/mutyv.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/mutyv.cc

    r2615 r2826  
    1515   \ingroup BaseTools
    1616   Simple utility class which can be used to hold values of type
    17    string, integer (\b int_8) or float (\b r_8) as well as complex,
     17   string, integer (\b int_8), float (\b r_8), complex and
     18   date/time (TimeStamp). Date/time values are kept internally
     19   as double precision values and are thus less precise than
     20   TimeStamp objects.
    1821   It provides also easy conversion methods between these types.
     22
     23   \sa SOPHYA::TimeStamp
    1924
    2025   \code
     
    2833   MuTyV mvs("Bonjour !");  // mvs contains the string "Bonjour !"
    2934   string s = mvs;          // s contains "Bonjour !"
    30  
     35   TimeStamp ts;      // Current date/time
     36   MuTyV mvt = ts;
     37   s = mvt;           // s contains the current date in string format
    3138   \endcode
    3239*/
     
    7481
    7582/* --Methode-- */
     83MuTyV::MuTyV(TimeStamp const& ts)
     84{
     85  typ = MTVTimeStamp;
     86  dv = ts.ToDays();
     87  dv_im = 0.;
     88  iv = (int_8)dv;
     89  strv = NULL;
     90}
     91
     92/* --Methode-- */
    7693MuTyV & MuTyV::operator= (MuTyV const & a)
    7794{
     
    85102
    86103/* --Methode-- */
    87 char * MuTyV::operator= (char* s)
     104const char * MuTyV::operator= (const char* s)
    88105{
    89106  typ = MTVString;
     
    96113
    97114/* --Methode-- */
    98 string & MuTyV::operator= (string& s)
     115string const & MuTyV::operator= (string const& s)
    99116{
    100117  typ = MTVString;
     
    107124
    108125/* --Methode-- */
     126TimeStamp const & MuTyV::operator= (TimeStamp const& ts)
     127{
     128  typ = MTVTimeStamp;
     129  dv = ts.ToDays();
     130  dv_im = 0.;
     131  iv = (int_8)dv;
     132  return(ts);
     133}
     134
     135
     136/* --Methode-- */
    109137MuTyV::operator string() const
    110138{
    111139  if (typ == MTVString)  return(*strv);
     140  else if (typ == MTVTimeStamp) { return TimeStamp(dv).ToString(); }
    112141  else {
    113142    char buff[96];
     
    120149}
    121150
    122 
     151/* --Methode-- */
     152MuTyV::operator TimeStamp() const
     153{
     154  return TimeStamp(dv);
     155}
    123156
    124157static void mutyv_decodestr(string const & s, double& r, double& im)
Note: See TracChangeset for help on using the changeset viewer.