00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00030 #include "arts.h"
00031 #include <map>
00032 #include "make_array.h"
00033 #include "auto_wsv.h"
00034 #include "methods.h"
00035 #include "wsv_aux.h"
00036 
00037 void define_md_map()
00038 {
00039   extern const Array<MdRecord> md_data;
00040   extern std::map<String, Index> MdMap;
00041 
00042   for ( Index i=0 ; i<md_data.nelem() ; ++i)
00043     {
00044       MdMap[md_data[i].Name()] = i;
00045     }
00046 }
00047 
00048 
00049 ostream& MdRecord::PrintTemplate(ostream& os,
00050                                  bool show_description) const
00051 {
00052   extern const  ArrayOfString wsv_group_names;
00053 
00054   if (show_description)
00055     {
00056       
00057     }
00058   
00059   os << Name();
00060 
00061   
00062   if ( 0 != GOutput().nelem()+GInput().nelem() )
00063     {
00064       
00065       bool first=true;
00066 
00067       os << '(';
00068 
00069       for (Index i=0; i<GOutput().nelem(); ++i)
00070         {
00071           if (first) first=false;
00072           else os << ",\n";
00073 
00074           os << wsv_group_names[GOutput()[i]];
00075         }
00076 
00077       for (Index i=0; i<GInput().nelem(); ++i)
00078         {
00079           if (first) first=false;
00080           else os << ",\n";
00081 
00082           os << wsv_group_names[GInput()[i]];
00083         }
00084 
00085       os << ')';
00086     }
00087 
00088   
00089 
00090   os << '{';
00091 
00092   
00093   Index maxsize = 0;
00094   for (Index i=0; i<Keywords().nelem(); ++i)
00095     if ( Keywords()[i].nelem() > maxsize )
00096       maxsize = Keywords()[i].nelem();
00097 
00098 
00099   for (Index i=0; i<Keywords().nelem(); ++i)
00100     {
00101       os << "\t" << setw(maxsize)
00102          << Keywords()[i] << " = \n";
00103     }
00104 
00105   os << '}';
00106 
00107   return os;
00108 }
00109 
00110 ostream& operator<<(ostream& os, const MdRecord& mdr)
00111 {
00112   extern const Array<WsvRecord> wsv_data;
00113   extern const ArrayOfString wsv_group_names;
00114   extern const String TokValTypeName[];
00115   bool first;
00116 
00117   os << "\n*--------------------------------------------------------------*\n"
00118      << "Workspace method = " << mdr.Name() << 
00119         "\n----------------------------------------------------------------\n"
00120      << "\n" << mdr.Description() << "\n" << 
00121         "\n----------------------------------------------------------------\n";
00122 
00123   
00124   
00125 
00126   
00127   first = true;
00128   os << "Output = ";
00129   for ( Index i=0; i<mdr.Output().nelem(); ++i )
00130     {
00131       if (first) first=false;
00132       else os << ", ";
00133 
00134       os << wsv_data[mdr.Output()[i]].Name();
00135     }
00136   os << '\n';
00137 
00138   
00139   first = true;
00140   os << "Input = ";
00141   for ( Index i=0; i<mdr.Input().nelem(); ++i )
00142     {
00143       if (first) first=false;
00144       else os << ", ";
00145 
00146       os << wsv_data[mdr.Input()[i]].Name();
00147     }
00148   os << '\n';
00149       
00150   
00151   first = true;
00152   os << "GOutput = ";
00153   for ( Index i=0; i<mdr.GOutput().nelem(); ++i )
00154     {
00155       if (first) first=false;
00156       else os << ", ";
00157 
00158       os << wsv_group_names[mdr.GOutput()[i]];
00159     }
00160   os << '\n';
00161 
00162   
00163   first = true;
00164   os << "GInput = ";
00165   for ( Index i=0; i<mdr.GInput().nelem(); ++i )
00166     {
00167       if (first) first=false;
00168       else os << ", ";
00169 
00170       os << wsv_group_names[mdr.GInput()[i]];
00171     }
00172   os << '\n';
00173 
00174   
00175   first = true;
00176   os << "Keywords = ";
00177   for ( Index i=0; i<mdr.Keywords().nelem(); ++i )
00178     {
00179       if (first) first=false;
00180       else os << ", ";
00181 
00182       os << mdr.Keywords()[i];
00183     }
00184   os << '\n';
00185 
00186   
00187   first = true;
00188   os << "Types = ";
00189   for ( Index i=0; i<mdr.Types().nelem(); ++i )
00190     {
00191       if (first) first=false;
00192       else os << ", ";
00193 
00194       os << TokValTypeName[mdr.Types()[i]];
00195     }
00196   os << "\n*--------------------------------------------------------------*\n";
00197 
00198   return os;
00199 }
00200