Go to the documentation of this file.
39 ostringstream& token,
const String& indent,
50 const char description[],
65 bool pass_wsv_names ) :
67 mdescription( description ),
72 mgoutdesc( goutdesc ),
76 mgindefault( gindefault ),
78 mset_method( set_method ),
79 magenda_method( agenda_method ),
80 msupergeneric( false ),
81 msuppress_header( suppress_header ),
82 mpass_workspace( pass_workspace ),
83 mpass_wsv_names( pass_wsv_names ),
106 os <<
"Unknown WSV " << output[j] <<
" for output "
107 <<
"in WSM " <<
mname;
108 throw runtime_error( os.str() );
119 os <<
"Unknown WSV " << input[j] <<
" for input "
120 <<
"in WSM " <<
mname;
121 throw runtime_error( os.str() );
133 if (types.
nelem() == 1)
138 else if (types.
nelem() > 1)
146 os <<
"Unknown WSV Group " << gouttype[j] <<
" for generic output "
147 <<
"in WSM " <<
mname;
148 throw runtime_error( os.str() );
160 if (types.
nelem() == 1)
165 else if (types.
nelem() > 1)
173 os <<
"Unknown WSV Group " << gintype[j] <<
" for generic input "
174 <<
"in WSM " <<
mname;
175 throw runtime_error( os.str() );
183 bool consistent =
true;
190 else if (nspecs !=
mginspectype[0].nelem()) consistent =
false;
199 else if (nspecs !=
mgoutspectype[0].nelem()) consistent =
false;
205 os <<
"Inconsistent number of types given for supergeneric variables"
206 << endl <<
"in WSM " <<
mname <<
"." << endl;
207 throw runtime_error (os.str());
223 for (ArrayOfIndex::const_iterator j=
moutput.begin(); j<
moutput.end(); ++j)
224 for (ArrayOfIndex::iterator k=
minonly.begin(); k<
minonly.end(); ++k)
237 for (ArrayOfIndex::const_iterator j=
moutput.begin(); j<
moutput.end(); ++j,++i)
238 for (ArrayOfIndex::const_iterator k=
minput.begin(); k<
minput.end(); ++k)
244 for (ArrayOfIndex::const_iterator j=
minput.begin(); j<
minput.end(); ++j)
280 assert( wsv_group_id_Any != g );
344 if ( wsv_group_id_Any ==
mgintype[j] )
420 if ( wsv_group_id_Any != j )
444 extern map<String, Index>
MdMap;
448 assert( 0 !=
md_data.nelem() );
460 os << mdd.
Name() <<
"_sg_"
467 methodname = os.str();
469 MdMap[methodname] = i;
500 size_t currentlinelength = offset;
501 for (
size_t i = 0; i < s.length(); i++)
503 if (s[i] ==
'\n') s[i] =
' ';
507 if (currentlinelength + token.length() > linelen)
509 out +=
'\n' + indent;
510 currentlinelength = indent.length();
514 currentlinelength += token.length();
521 if (currentlinelength + token.length() > linelen)
523 out +=
'\n' + indent;
539 pos = desc.find(
".\n");
540 pos2 = desc.find(
". ");
544 s = desc.substr(0, pos+1);
551 s.replace (pos, 1,
" ");
557 bool show_description)
const
561 if (show_description)
578 if (first) first=
false;
586 if (first) first=
false;
608 os <<
"\t" << setw((
int)maxsize)
609 <<
GIn()[i] <<
" = \n";
625 ostringstream& curline,
626 ostringstream& token,
630 if (indent.length() + curline.str().length() + token.str().length() > linelen)
632 os << curline.str() << endl << indent;
635 curline << token.str();
648 const size_t linelen = 68;
652 os <<
"\n*-------------------------------------------------------------------*\n"
653 <<
"Workspace method = " << mdr.
Name() <<
654 "\n---------------------------------------------------------------------\n"
663 while (indent.length() < mdr.
Name().length() + 2) indent +=
' ';
665 os <<
"\nSynopsis:\n\n";
666 buf << mdr.
Name() <<
"( ";
668 for (
Index i=0; i<mdr.
Out().nelem(); ++i )
670 if (first) first=
false;
else buf <<
", ";
678 if (first) first=
false;
else buf <<
", ";
679 if (mdr.
GOut()[i].length())
680 param << mdr.
GOut()[i];
682 param <<
"gout" << i;
690 if (first) first=
false;
else buf <<
", ";
698 if (first) first=
false;
else buf <<
", ";
699 if (mdr.
GIn()[i].length())
701 param << mdr.
GIn()[i];
710 if (buf.str().length()) os << buf.str();
715 bool is_first_author =
true;
721 is_first_author =
false;
731 os <<
"\n\nVariables:\n\n";
739 for (
Index i=0; i<mdr.
Out().nelem(); ++i )
752 if (buf.str().length() + desc.length() > linelen)
755 buf << endl << indent << desc;
762 os << buf.str() << endl;
765 for (
Index i=0; i<mdr.
GOut().nelem(); ++i )
768 buf <<
"GOUT " << mdr.
GOut()[i] <<
" (";
772 bool firstarg =
true;
775 if (!firstarg) buf <<
", ";
else firstarg =
false;
786 lastlen = desc.length();
795 buf << endl << indent << desc;
797 else if (lastlen + desc.length() > linelen)
807 os << buf.str() << endl;
810 for (
Index i=0; i<mdr.
In().nelem(); ++i )
823 if (buf.str().length() + desc.length() > linelen)
826 buf << endl << indent << desc;
833 os << buf.str() << endl;
836 for (
Index i=0; i<mdr.
GIn().nelem(); ++i )
839 buf <<
"GIN " << mdr.
GIn()[i] <<
" (";
843 bool firstarg =
true;
846 if (!firstarg) buf <<
", ";
else firstarg =
false;
857 buf <<
", Default: ";
871 lastlen = desc.length();
880 buf << endl << indent << desc;
882 else if (lastlen + desc.length() > linelen)
885 buf << endl << indent << desc;
892 os << buf.str() << endl;
895 os <<
"\n*-------------------------------------------------------------------*\n";
const ArrayOfString & GOut() const
void limit_line_length(ostream &os, ostringstream &curline, ostringstream &token, const String &indent, size_t linelen)
Limit length of output.
static Array< WsvRecord > wsv_data
bool Supergeneric() const
const ArrayOfArrayOfIndex & GOutSpecType() const
const ArrayOfIndex & GOutType() const
ArrayOfIndex mgouttype
Generic Workspace Output Type.
Array< MdRecord > md_data_raw
Lookup information for workspace methods.
const ArrayOfIndex & GInType() const
Index get_wsv_id(const String &name)
Get index of WSV.
ArrayOfArrayOfIndex mgoutspectype
Generic Workspace Output Types (Contains the valid types if the method.
void define_md_raw_map()
Define MdRawMap.
MdRecord()
Default constructor.
ArrayOfIndex mgintype
Generic Workspace Input.
void get_short_wsv_description(String &s, const String &desc)
ArrayOfIndex minout
Indexes of Input-Output variables.
String mname
The name of this method.
const String & ActualGroups() const
ArrayOfIndex minput
Workspace Input.
The implementation for String, the ARTS string class.
const Array< String > & GInDescription() const
void get_wsv_group_ids(ArrayOfIndex &ids, String name)
ArrayOfString wsv_group_names
map< String, Index > MdRawMap
The map associated with md_data_raw.
Implements the class MakeArray, which is a derived class of Array, allowing explicit initialization.
const String & Name() const
const ArrayOfIndex & In() const
const ArrayOfIndex & InOnly() const
ArrayOfString mgin
Generic Workspace Input Names.
const Array< String > & GOutDescription() const
Index nelem() const
Number of elements.
const Array< String > & GInDefault() const
ArrayOfString mgout
Generic Workspace Output Names.
Array< MdRecord > md_data
Lookup information for workspace methods.
ArrayOfString mgindefault
Generic Workspace Input Defaults.
const ArrayOfString & GIn() const
ostream & operator<<(ostream &os, const MdRecord &mdr)
Output operator for MdRecord.
bool format_paragraph(String &s, const String &indent, const size_t linelen, const size_t offset)
This file contains the declaration and partly the implementation of the workspace class.
All information for one workspace method.
void subst_any_with_specific_group(Index g)
Expand supergeneric record for given Index in GOutSpecType and GInSpecType.
my_basic_string< char > String
The String type for ARTS.
const ArrayOfArrayOfIndex & GInSpecType() const
void expand_md_data_raw_to_md_data()
Expand supergeneric methods.
void subst_any_with_group(Index g)
Expand supergeneric record for given group.
map< String, Index > MdMap
The map associated with md_data.
ostream & PrintTemplate(ostream &os, bool show_description=true) const
Print method template for the control file.
ArrayOfArrayOfIndex mginspectype
Generic Workspace Input Types (Contains the valid types if the method.
Explicit construction of Arrays.
String mactual_groups
The actual groups of a supergeneric method.
bool msupergeneric
Flag, whether this method is supergeneric.
INDEX Index
The type to use for all integer numbers and indices.
const ArrayOfIndex & Out() const
static const Index npos
Define npos:
ArrayOfIndex minonly
Indexes of Input-only variables.
Index get_wsv_group_id(const String &name)
ArrayOfIndex moutput
Workspace Output.
const String & Description() const
void define_md_map()
Define MdMap.
Index nelem() const
Number of elements.
Declaration of the class MdRecord.
Auxiliary header stuff related to workspace variable groups.
const ArrayOfString & Authors() const
The global header file for ARTS.
ArrayOfIndex moutonly
Indexes of Output-only variables.