00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include "arts.h"
00019 #include "matpackI.h"
00020 #include "array.h"
00021 #include "file.h"
00022 #include "auto_wsv_groups.h"
00023 #include "wsv_aux.h"
00024
00025 int main()
00026 {
00027 try
00028 {
00029
00030 extern const ArrayOfString wsv_group_names;
00031 extern const Array<WsvRecord> wsv_data;
00032
00033
00034 define_wsv_group_names();
00035 define_wsv_data();
00036
00037 const Index n_wsv = wsv_data.nelem();
00038
00039 ofstream ofs;
00040 open_output_file(ofs,"auto_wsv_pointers.cc");
00041
00042 ofs << "/** \\file auto_wsv_pointers.cc\n"
00043 << " Defines the smart pointers that are used by\n"
00044 << " the engine to access workspace variables.\n\n"
00045
00046 << " This file was generated automatically by make_auto_wsv_pointers_cc.cc.\n"
00047
00048 << " <b>DO NOT EDIT!</b>\n\n"
00049
00050 << " \\date "
00051 << __DATE__ << ", "
00052 << __TIME__ << " */\n\n";
00053
00054 ofs << "#include \"arts.h\"\n"
00055 << "//#include \"matpackI.h\"\n"
00056 << "#include \"array.h\"\n"
00057 << "#include \"auto_wsv_groups.h\"\n"
00058 << "#include \"wsv_aux.h\"\n"
00059 << "#include \"auto_wsv.h\"\n\n";
00060
00061 ofs << "/** The array of WSV pointers.\n"
00062 << " This can be used to access a WSV by its index. */\n"
00063 << "Array<WsvP*> wsv_pointers;\n\n";
00064
00065 ofs << "void define_wsv_pointers(Array<WsvP*>& wsv_pointers,\n"
00066 << " WorkSpace& workspace)\n"
00067 << "{\n\n";
00068
00069
00070 for (Index i=0; i<n_wsv; ++i)
00071 {
00072 const WsvRecord& wr = wsv_data[i];
00073
00074 ofs << " {\n"
00075 << " static WsvPointer<"
00076 << wsv_group_names[wr.Group()]
00077 << "> p(&workspace."
00078 << wr.Name()
00079 << ");\n";
00080
00081 ofs << " wsv_pointers.push_back(&p);\n"
00082 << " }\n\n";
00083 }
00084
00085 ofs << "};\n";
00086
00087 }
00088 catch (runtime_error x)
00089 {
00090 cout << "Something went wrong. Message text:\n";
00091 cout << x.what() << '\n';
00092 return 1;
00093 }
00094
00095 return 0;
00096 }