Changeset 2826 in Sophya for trunk/SophyaLib/BaseTools/mutyv.cc
- Timestamp:
- Nov 2, 2005, 9:52:39 AM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/BaseTools/mutyv.cc
r2615 r2826 15 15 \ingroup BaseTools 16 16 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. 18 21 It provides also easy conversion methods between these types. 22 23 \sa SOPHYA::TimeStamp 19 24 20 25 \code … … 28 33 MuTyV mvs("Bonjour !"); // mvs contains the string "Bonjour !" 29 34 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 31 38 \endcode 32 39 */ … … 74 81 75 82 /* --Methode-- */ 83 MuTyV::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-- */ 76 93 MuTyV & MuTyV::operator= (MuTyV const & a) 77 94 { … … 85 102 86 103 /* --Methode-- */ 87 c har * MuTyV::operator= (char* s)104 const char * MuTyV::operator= (const char* s) 88 105 { 89 106 typ = MTVString; … … 96 113 97 114 /* --Methode-- */ 98 string & MuTyV::operator= (string& s)115 string const & MuTyV::operator= (string const& s) 99 116 { 100 117 typ = MTVString; … … 107 124 108 125 /* --Methode-- */ 126 TimeStamp 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-- */ 109 137 MuTyV::operator string() const 110 138 { 111 139 if (typ == MTVString) return(*strv); 140 else if (typ == MTVTimeStamp) { return TimeStamp(dv).ToString(); } 112 141 else { 113 142 char buff[96]; … … 120 149 } 121 150 122 151 /* --Methode-- */ 152 MuTyV::operator TimeStamp() const 153 { 154 return TimeStamp(dv); 155 } 123 156 124 157 static void mutyv_decodestr(string const & s, double& r, double& im)
Note:
See TracChangeset
for help on using the changeset viewer.