Index: /trunk/SophyaLib/BaseTools/dvlist.cc
===================================================================
--- /trunk/SophyaLib/BaseTools/dvlist.cc	(revision 1079)
+++ /trunk/SophyaLib/BaseTools/dvlist.cc	(revision 1080)
@@ -38,15 +38,7 @@
 //--
 
-char MuTyV::myStrBuf[64];   // Declare static ds le .h 
 
 static MuTyV ddvdum(-9.e19);
 
-/*!
-   \class SOPHYA::MuTyV
-   \ingroup SysTools
-   Simple utility class which can be used to hold values of type
-   string, integer (\b int_8) or float (\b r_8) and providing
-   easy conversion methods between these types. 
-*/
 
 /*!
@@ -61,15 +53,5 @@
    used to represent FITS headers. The class \b SOPHYA::ObjFileIO<DVList>
    handles serialisation for DVList. (See SOPHYA::PPersist ).
-   An 
-   \code
-   //  ------- Using MuTyV objects ------- 
-   MuTyV mvu;         // MuTyV variable declaration 
-   mvu = 60;          // mvu contains the integer value 60
-   mvu = 66.6;        // and now the double value 66.6 
-   string ds = mvu;   // ds contains the string "66.6"
-   MuTyV mvi(14);     // New MuTyV variable containing integer value 14
-   r_4 x = mvi;       // x has the value 14.0
-   MuTyV mvs("Bonjour !");  // mvs contains the string "Bonjour !"
-   string s = mvs;          // s vaut "Bonjour, Ca va ?"  
+   
    //  ------- Using DVList objects ------ 
    DVList  dvl;
@@ -179,11 +161,14 @@
     {
     case 'I' :
-      SetI((*it).first, (*it).second.elval.mtv.iv);
+      SetI((*it).first, (*it).second.elval.iv);
       break;
     case 'D' : 
-      SetD((*it).first, (*it).second.elval.mtv.dv);
+      SetD((*it).first, (*it).second.elval.dv);
+      break;
+    case 'Z' : 
+      SetZ((*it).first, complex<r_8>((*it).second.elval.dv, (*it).second.elval.dv_im));
       break;
     case 'S' : 
-      SetS((*it).first, (*it).second.elval.mtv.strv);
+      SetS((*it).first, *((*it).second.elval.strv));
       break;
     default :
@@ -214,6 +199,5 @@
 ValList::iterator it = mvlist.find(key);
 if (it == mvlist.end())  return(def);
-if ( (*it).second.elval.typ != 'I') return(def);
-return((*it).second.elval.mtv.iv);
+return((*it).second.elval.iv);
 }
 
@@ -225,6 +209,15 @@
 ValList::iterator it = mvlist.find(key);
 if (it == mvlist.end())  return(def);
-if ( (*it).second.elval.typ != 'D') return(def);
-return((*it).second.elval.mtv.dv);
+return((*it).second.elval.dv);
+}
+
+/* --Methode-- */
+/*! Returns the value corresponding to name \b key, converted to complex
+    Default value \b def is returned if name \b key not found */
+complex<r_8>       DVList::GetZ(string const& key, complex<r_8> def)
+{
+ValList::iterator it = mvlist.find(key);
+if (it == mvlist.end())  return(def);
+return((*it).second.elval.dv);
 }
 
@@ -236,6 +229,5 @@
 ValList::iterator it = mvlist.find(key);
 if (it == mvlist.end())  return(def);
-if ( (*it).second.elval.typ != 'S') return(def);
-return((*it).second.elval.mtv.strv);
+return(*((*it).second.elval.strv));
 }
 
@@ -252,7 +244,8 @@
 // void  SetI(string const& key, int_8  val)
 // void  SetD(string const& key, r_8 val)
+// void  SetZ(string const& key, complex<r_8> val)
 // void  SetS(string const& key, char*  val)
 // void  SetS(string const& key, string val)
-//	Crée la variable de nom "key", de type entier, double, string et 
+//	Crée la variable de nom "key", de type entier, double, complexe, string et 
 //	lui attribue la valeur "val". Si une variable du même nom existe, 
 //	sa valeur et eventuellement son type sont modifiés.  Les noms de
@@ -280,4 +273,11 @@
 
 /* --Methode-- */
+void        DVList::SetZ(string const& key, complex<r_8> val)
+/*! Appends or sets the complex value \b val in the list with name \b key */
+{
+Get(key) = val;
+}
+
+/* --Methode-- */
 /*! Appends or sets the string value \b val in the list with name \b key */
 void        DVList::SetS(string const& key, char const* val)
@@ -289,5 +289,5 @@
 /* --Methode-- */
 /*! Appends or sets the string value \b val in the list with name \b key */
-void        DVList::SetS(string const& key, string val)
+void        DVList::SetS(string const& key, string const& val)
 {
 MuTyV div(val);
@@ -367,13 +367,17 @@
     case 'I' :
       sprintf(buff, "%s = %ld (int) %s\n", (*it).first.substr(0,64).c_str(), 
-	      (long)((*it).second.elval.mtv.iv), (*it).second.elcomm.substr(0,128).c_str());
+	      (long)((*it).second.elval.iv), (*it).second.elcomm.substr(0,128).c_str());
       break;
     case 'D' : 
       sprintf(buff, "%s = %.20g (double) %s\n", (*it).first.substr(0,64).c_str(), 
-	      (*it).second.elval.mtv.dv, (*it).second.elcomm.substr(0,128).c_str());
+	      (*it).second.elval.dv, (*it).second.elcomm.substr(0,128).c_str());
+      break;
+    case 'Z' : 
+      sprintf(buff, "%s = %.20g %.20g i (complex) %s\n", (*it).first.substr(0,64).c_str(), 
+	      (*it).second.elval.dv, (*it).second.elval.dv_im, (*it).second.elcomm.substr(0,128).c_str());
       break;
     case 'S' : 
       sprintf(buff, "%s = %s (string) %s\n", (*it).first.substr(0,64).c_str(), 
-	      (*it).second.elval.mtv.strv, (*it).second.elcomm.substr(0,128).c_str());
+	      (*it).second.elval.strv->c_str(), (*it).second.elcomm.substr(0,128).c_str());
       break;
     default :
@@ -441,13 +445,18 @@
   switch ((*it).second.elval.typ) {
     case 'I' :
-      sprintf(buf,"I %s %ld", (*it).first.substr(0,64).c_str(), (long)((*it).second.elval.mtv.iv) );
+      sprintf(buf,"I %s %ld", (*it).first.substr(0,64).c_str(), (long)((*it).second.elval.iv) );
       sfw = buf;  s.PutStr(sfw);
       break;
     case 'D' : 
-      sprintf(buf,"D %s %.20g", (*it).first.substr(0,64).c_str(), (*it).second.elval.mtv.dv );
+      sprintf(buf,"D %s %.20g", (*it).first.substr(0,64).c_str(), (*it).second.elval.dv );
       sfw = buf;  s.PutStr(sfw);
       break;
+    case 'Z' : 
+      sprintf(buf,"Z %s %.20g %.20g", (*it).first.substr(0,64).c_str(), (*it).second.elval.dv, 
+                                      (*it).second.elval.dv_im);
+      sfw = buf;  s.PutStr(sfw);
+      break;
     case 'S' : 
-      sprintf(buf,"S %s %s", (*it).first.substr(0,64).c_str(), (*it).second.elval.mtv.strv );
+      sprintf(buf,"S %s %s", (*it).first.substr(0,64).c_str(), (*it).second.elval.strv->c_str() );
       sfw = buf;  s.PutStr(sfw);
       break;
@@ -470,6 +479,7 @@
 char buf[512];
 string sfr;
-int_8 j,iv;
-r_8 dv;
+int_8 j,iv,k;
+r_8 dv, dvi;
+complex<r_8> z;
 bool ok=true;
 buf[0] = '\0';
@@ -505,4 +515,13 @@
       dobj->SetD(key, dv);
       break;
+    case 'Z' :
+      k = posc(buf+j+1, ' ')+j+1;
+      buf[k] = '\0';
+      dv = atof(buf+j+1);
+      dvi = atof(buf+k+1);
+      key = buf+2;
+      z = complex<r_8>(dv, dvi);      
+      dobj->SetZ(key, z);
+      break;
     case 'S' :
       key = buf+2;
Index: /trunk/SophyaLib/BaseTools/dvlist.h
===================================================================
--- /trunk/SophyaLib/BaseTools/dvlist.h	(revision 1079)
+++ /trunk/SophyaLib/BaseTools/dvlist.h	(revision 1080)
@@ -9,63 +9,11 @@
 
 #include <stdio.h>
-
 #include <iostream.h>
 
+#include "mutyv.h"
 #include <list>
 #include <map>
-#include <string.h>
-#include <string>
 
 namespace SOPHYA {
-
-// Classe utilitaire pour manipuler des variables typees 
-//! A simple class for holding string, integer and float type values.
-class MuTyV {
-public:
-  union {
-  int_8 iv;
-  r_8 dv;
-  char strv[39];
-  } mtv; 
-  char typ;
-
-  static char myStrBuf[64];  
-
-  inline MuTyV() { typ = 'I'; mtv.iv = 0;  mtv.dv = 0.;  mtv.strv[0] ='\0'; }
-  inline MuTyV(MuTyV const & a) { typ = a.typ; mtv = a.mtv; }
-  inline MuTyV(int_4 i) { typ = 'I'; mtv.iv = (int_8)i; mtv.dv = 0.;  mtv.strv[0] ='\0'; }
-  inline MuTyV(int_8 i) { typ = 'I'; mtv.iv = i; mtv.dv = 0.;  mtv.strv[0] ='\0'; }
-  inline MuTyV(r_4 f) { typ = 'D'; mtv.dv = (r_8)f;  mtv.iv = 0;  mtv.strv[0] ='\0'; }
-  inline MuTyV(r_8 d) { typ = 'D'; mtv.dv = d; mtv.iv = 0;  mtv.strv[0] ='\0'; }
-  inline MuTyV(char const* s)  { typ = 'S'; strncpy(mtv.strv, s, 39); mtv.strv[38] = '\0'; }
-  inline MuTyV(string const& s) { typ = 'S'; strncpy(mtv.strv, s.c_str(), 39); mtv.strv[38] = '\0'; }
-  inline MuTyV & operator= (MuTyV const & a) { typ = a.typ; mtv = a.mtv; return(*this); }
-  inline int_4  operator= (int_4 v)  { typ = 'I'; mtv.iv = (int_8)v; return(v); }
-  inline int_8  operator= (int_8 v)  { typ = 'I'; mtv.iv = v; return(v); }
-  inline r_4  operator= (r_4 v)  { typ = 'D'; mtv.dv = (r_8)v; return(v); }
-  inline r_8 operator= (r_8 v) { typ = 'D'; mtv.dv = v; return(v); }
-  inline char*  operator= (char* s)  { typ = 'S'; strncpy(mtv.strv, s, 39); 
-                                       mtv.strv[38] = '\0';  return(s); }
-  inline string& operator= (string& s)    { typ = 'S'; strncpy(mtv.strv, s.c_str(), 39); 
-                                            mtv.strv[38] = '\0'; return(s); }
-
-  inline operator int_4() { if (typ == 'I')  return((int_4)mtv.iv);
-                            else if (typ == 'D') return((int_4)mtv.dv); 
-                            else return(atol(mtv.strv)); }
-  inline operator int_8() { if (typ == 'I')  return((int_8)mtv.iv);
-                            else if (typ == 'D') return((int_8)mtv.dv); 
-                            else return(atol(mtv.strv)); }
-  inline operator r_4() { if (typ == 'I')  return((r_4)mtv.iv);
-                            else if (typ == 'D') return((r_4)mtv.dv); 
-                            else return((r_4)atof(mtv.strv)); }
-  inline operator r_8() { if (typ == 'I')  return((r_8)mtv.iv);
-                            else if (typ == 'D') return(mtv.dv); 
-                            else return(atof(mtv.strv)); }
-  inline operator string() { char *ss=myStrBuf;
-                            if (typ == 'I')  sprintf(ss,"%ld", (long)mtv.iv);
-                            else if (typ == 'D') sprintf(ss,"%.20g", mtv.dv);
-                            else ss = mtv.strv;
-                            return(ss); }
-};
 
 //  Classe liste de variables  Dynamic Variable List  
@@ -74,5 +22,4 @@
 class DVList : public AnyDataObj {
 public:
-//  enum {classId = ClassId_DVList };
 
                     DVList();
@@ -89,4 +36,5 @@
   int_8             GetI(string const& key, int_8 def=-1);
   r_8               GetD(string const& key, r_8 def=-9.e19);
+  complex<r_8>      GetZ(string const& key, complex<r_8> def=-9.e19);
   string            GetS(string const& key, char* def="");
   string            GetComment(string const& key);
@@ -94,6 +42,7 @@
   void              SetI(string const& key, int_8 val);
   void              SetD(string const& key, r_8 val);
+  void              SetZ(string const& key, complex<r_8> val);
   void              SetS(string const& key, char const*  val);
-  void              SetS(string const& key, string val);
+  void              SetS(string const& key, string const& val);
   void              SetComment(string const& key, string const& comm);
 
Index: /trunk/SophyaLib/BaseTools/mutyv.cc
===================================================================
--- /trunk/SophyaLib/BaseTools/mutyv.cc	(revision 1080)
+++ /trunk/SophyaLib/BaseTools/mutyv.cc	(revision 1080)
@@ -0,0 +1,116 @@
+// Classe MuTyV : Variable multi-type numerique
+//                  R. Ansari  1997-2000
+// LAL (Orsay) / IN2P3-CNRS  DAPNIA/SPP (Saclay) / CEA
+
+
+#include "mutyv.h"
+#include <stdio.h>
+
+#include <iostream.h>
+#include <string.h>
+
+/*!
+   \class SOPHYA::MuTyV
+   \ingroup SysTools
+   Simple utility class which can be used to hold values of type
+   string, integer (\b int_8) or float (\b r_8) as well as complex,
+   It provides also easy conversion methods between these types. 
+
+   \code
+   //  ------- Using MuTyV objects ------- 
+   MuTyV mvu;         // MuTyV variable declaration 
+   mvu = 60;          // mvu contains the integer value 60
+   mvu = 66.6;        // and now the double value 66.6 
+   string ds = mvu;   // ds contains the string "66.6"
+   MuTyV mvi(14);     // New MuTyV variable containing integer value 14
+   r_4 x = mvi;       // x has the value 14.0
+   MuTyV mvs("Bonjour !");  // mvs contains the string "Bonjour !"
+   string s = mvs;          // s contains "Bonjour !"
+  
+   \endcode
+*/
+
+
+/* --Methode-- */
+MuTyV::MuTyV(MuTyV const & a)
+{
+  typ = a.typ;  iv = a.iv;  dv = a.dv;  dv_im = a.dv_im; 
+  if (typ == 'S')  strv = new string(*(a.strv));
+  else strv = NULL;
+}
+
+/* --Methode-- */
+MuTyV::~MuTyV()
+{
+  if (strv) delete strv;
+}
+
+/* --Methode-- */
+MuTyV::MuTyV(char const* s)
+{
+  typ = 'S';
+  strv = new string(s);
+  dv = dv_im = 0.;
+  sscanf(s, "%lg %lg", &dv, &dv_im);
+  iv = (int_8)dv;
+}
+
+/* --Methode-- */
+MuTyV::MuTyV(string const& s)
+{
+  typ = 'S';
+  strv = new string(s);
+  dv = dv_im = 0.;
+  sscanf(s.c_str(), "%lg %lg", &dv, &dv_im);
+  iv = (int_8)dv;
+}
+
+/* --Methode-- */
+MuTyV & MuTyV::operator= (MuTyV const & a)
+{
+  typ = a.typ;  iv = a.iv;  dv = a.dv;  dv_im = a.dv_im; 
+  if (typ == 'S')  strv = new string(*(a.strv));
+  else strv = NULL;
+  return(*this);
+}
+
+/* --Methode-- */
+char * MuTyV::operator= (char* s)
+{
+  typ = 'S';
+  strv = new string(s);
+  dv = dv_im = 0.;
+  sscanf(s, "%lg %lg", &dv, &dv_im);
+  iv = (int_8)dv;
+  return(s);
+}
+
+/* --Methode-- */
+string & MuTyV::operator= (string& s)
+{
+  typ = 'S';
+  strv = new string(s);
+  dv = dv_im = 0.;
+  sscanf(s.c_str(), "%lg %lg", &dv, &dv_im);
+  iv = (int_8)dv;
+  return(s);
+}
+
+/* --Methode-- */
+MuTyV::operator string() const 
+{
+  if (typ == 'S')  return(*strv);
+  else {
+    char buff[96];
+    if (typ == 'I')  sprintf(buff,"%ld", (long)iv);
+    else if (typ == 'D') sprintf(buff,"%.20g", dv);
+    else if (typ == 'Z') sprintf(buff,"%.20g %.20g i", dv, dv_im);
+    else buff[0] = '\0';
+    return(string(buff));
+  }
+}
+
+
+
+
+
Index: /trunk/SophyaLib/BaseTools/mutyv.h
===================================================================
--- /trunk/SophyaLib/BaseTools/mutyv.h	(revision 1080)
+++ /trunk/SophyaLib/BaseTools/mutyv.h	(revision 1080)
@@ -0,0 +1,80 @@
+// This may look like C code, but it is really -*- C++ -*-
+// Classe MuTyV : Variable multi-type numerique
+//                               Reza Ansari - 96-2000
+
+#ifndef MUTYV_H_SEEN
+#define MUTYV_H_SEEN
+
+#include "machdefs.h"
+
+#include <string>
+#include <complex>
+#include <iostream.h>
+
+namespace SOPHYA {
+
+// Classe utilitaire pour manipuler des variables typees 
+//! A simple class for holding string, integer, float and complex type values.
+
+class MuTyV {
+public:
+
+  inline MuTyV() { typ = 'I'; iv = 0;  dv = dv_im = 0.;  strv = NULL; }
+         MuTyV(MuTyV const & a);
+  inline MuTyV(uint_2 i) { typ = 'I'; iv = (int_8)i;  dv = (r_8)i;  dv_im = 0.;  strv = NULL; }
+  inline MuTyV(int_4 i)  { typ = 'I'; iv = (int_8)i;  dv = (r_8)i;  dv_im = 0.;  strv = NULL; }
+  inline MuTyV(int_8 i)  { typ = 'I'; iv = i;  dv = (r_8)i;  dv_im = 0.;  strv = NULL; }
+  inline MuTyV(r_4 f) { typ = 'D'; dv = (r_8)f; iv = (int_8)f;  dv_im = 0.;  strv = NULL; } 
+  inline MuTyV(r_8 d) { typ = 'D'; dv = d;  iv = (int_8)d;  dv_im = 0.;  strv = NULL; } 
+  inline MuTyV(complex<r_4> z) { typ = 'Z'; dv = (r_8)z.real();  dv_im = z.imag();  
+                                 iv = (int_8)dv;  strv = NULL; } 
+  inline MuTyV(complex<r_8> z) { typ = 'Z'; dv = z.real();  dv_im = z.imag();  
+                                 iv = (int_8)dv;  strv = NULL; } 
+
+         MuTyV(char const* s);  
+         MuTyV(string const& s); 
+ 
+         ~MuTyV();
+ 
+  inline char Type() { return typ; }
+
+         MuTyV & operator= (MuTyV const & a);
+  inline uint_2  operator= (uint_2 v)  { typ = 'I'; iv = (int_8)v;  dv = (r_8)v;  dv_im = 0.;  return(v); }
+  inline int_4  operator= (int_4 v)  { typ = 'I'; iv = (int_8)v;  dv = (r_8)v;  dv_im = 0.;  return(v); }
+  inline int_8  operator= (int_8 v)  { typ = 'I'; iv = v;  dv = (r_8)v; dv_im = 0.;  return(v); }
+  inline r_4  operator= (r_4 v)  { typ = 'D'; dv = (r_8)v; iv = (int_8)v;  dv_im = 0.;  return(v); }
+  inline r_8  operator= (r_8 v) { typ = 'D'; dv = v; iv = (int_8)v;  dv_im = 0.;  return(v); }
+  inline complex<r_4> operator= (complex<r_4> v) { typ = 'Z'; dv = (r_8)v.real();  dv_im = v.imag();
+                                                    iv = (int_8)dv;  return(v); }
+  inline complex<r_8> operator= (complex<r_8> v) { typ = 'Z'; dv = (r_8)v.real();  dv_im = v.imag();
+                                                    iv = (int_8)dv;  return(v); }
+         char*  operator= (char* s);
+         string& operator= (string& s);
+
+  inline operator uint_2() const { return((uint_2)iv); }
+  inline operator int_4()  const { return((int_4)iv); }
+  inline operator int_8()  const { return(iv); }
+  inline operator r_4() const  { return((r_4)dv); }
+  inline operator r_8() const  { return(dv); }
+  inline operator complex<r_4>() const { return(complex<r_4>((r_4)dv, (r_4)dv_im)); }
+  inline operator complex<r_8>() const { return(complex<r_8>(dv, dv_im)); }
+
+         operator string() const ; 
+
+  int_8 iv;
+  r_8 dv;
+  r_8 dv_im;   /* for holding imaginary part of a complex */
+  string * strv; 
+  char typ;
+
+};
+
+inline ostream& operator << (ostream& s, MuTyV const & mtv)
+{  s << (string)mtv;   return(s); }
+ 
+
+} // namespace SOPHYA
+
+#endif /* MUTYV_H_SEEN */
+
+
Index: /trunk/SophyaLib/BaseTools/sversion.h
===================================================================
--- /trunk/SophyaLib/BaseTools/sversion.h	(revision 1079)
+++ /trunk/SophyaLib/BaseTools/sversion.h	(revision 1080)
@@ -3,5 +3,5 @@
 
 #define SOPHYA_VERSION   0.9 
-#define SOPHYA_REVISION  71
+#define SOPHYA_REVISION  80
 #define SOPHYA_TAG       "V_Jul2000"
 
