diff --git a/src/Makefile.am b/src/Makefile.am index 467bd95da45bd680c5a62d54d9fceb68218d889b..11331d54895fd8ac11130a966e1cbed1ae2372be 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -184,6 +184,8 @@ libcdo_la_SOURCES = after_dvtrans.cc \ mpim_grid/gridreference.h \ mpim_grid/mpim_grid.cc \ mpim_grid/mpim_grid.h \ + mpim_grid/grid_options.cc \ + mpim_grid/grid_options.h \ mpmo.cc \ mpmo.h \ mpmo_color.cc \ diff --git a/src/cdo.cc b/src/cdo.cc index 968a9f7cc005053aa1476a678e257e45e51c1858..1333d129c5523c66eb088e754a3c1d01d4ddcc70 100644 --- a/src/cdo.cc +++ b/src/cdo.cc @@ -174,12 +174,12 @@ get_env_vars() ->add_help("The largest size (in bytes) core file that may be created."); CLIOptions::envvar("CDO_DOWNLOAD_PATH") - ->add_effect([&](const std::string &downloadPath) { cdo::DownloadPath = downloadPath; }) + ->add_effect([&](const std::string &downloadPath) { DownloadPath = downloadPath; }) ->describe_argument("path") ->add_help("Path where CDO can store downloads."); CLIOptions::envvar("CDO_ICON_GRIDS") - ->add_effect([&](const std::string &iconGrid) { cdo::IconGrids = iconGrid; }) + ->add_effect([&](const std::string &iconGrid) { IconGrids = iconGrid; }) ->describe_argument("path") ->add_help("Root directory of the installed ICON grids (e.g. /pool/data/ICON)."); diff --git a/src/cdo_options.cc b/src/cdo_options.cc index 864493acb8174e6398d1ed8b6d7f5a95f9dc299d..3f93a6053d8d9e2a5aa5f1bc27d2802ddde4fd07 100644 --- a/src/cdo_options.cc +++ b/src/cdo_options.cc @@ -27,8 +27,6 @@ namespace cdo const char *progname; const char *Version = "Climate Data Operators version " VERSION " (https://mpimet.mpg.de/cdo)"; std::string FileSuffix; -std::string DownloadPath; -std::string IconGrids; bool stdinIsTerminal = false; bool stdoutIsTerminal = false; bool stderrIsTerminal = false; diff --git a/src/cdo_options.h b/src/cdo_options.h index 1c1009ac2d45885de812b58c7402db055a0dead5..06588a43ea31854ed35835a0f57fde247469e89f 100644 --- a/src/cdo_options.h +++ b/src/cdo_options.h @@ -3,6 +3,7 @@ #include <vector> #include <string> +#include "mpim_grid/grid_options.h" #ifdef HAVE_CONFIG_H #include "config.h" /* _FILE_OFFSET_BITS influence off_t */ @@ -16,8 +17,6 @@ namespace cdo extern const char *progname; extern const char *Version; extern std::string FileSuffix; -extern std::string DownloadPath; -extern std::string IconGrids; extern bool stdinIsTerminal; extern bool stdoutIsTerminal; extern bool stderrIsTerminal; diff --git a/src/mpim_grid/grid_options.cc b/src/mpim_grid/grid_options.cc new file mode 100644 index 0000000000000000000000000000000000000000..b5d58d9bcaeb2a2f4899899ff7d1e065bf3b9846 --- /dev/null +++ b/src/mpim_grid/grid_options.cc @@ -0,0 +1,3 @@ +#include <string> +std::string DownloadPath; +std::string IconGrids; diff --git a/src/mpim_grid/grid_options.h b/src/mpim_grid/grid_options.h new file mode 100644 index 0000000000000000000000000000000000000000..13846e46302cffd6d08d521ee565035cb5614023 --- /dev/null +++ b/src/mpim_grid/grid_options.h @@ -0,0 +1,6 @@ +#ifndef GRID_OPTIONS +#define GRID_OPTIONS +#include <string> +extern std::string IconGrids; +extern std::string DownloadPath; +#endif diff --git a/src/mpim_grid/gridreference.cc b/src/mpim_grid/gridreference.cc index fb6d8c960fbf6f1439afa50611191167086d8f60..df8629a4b23e95d9a1a0bcce80e9af658cd34d63 100644 --- a/src/mpim_grid/gridreference.cc +++ b/src/mpim_grid/gridreference.cc @@ -22,11 +22,11 @@ #include <cdi.h> #include "cdi_uuid.h" +#include "cdi_lockedIO.h" +#include "grid_options.h" #include "gridreference.h" #include "cdo_output.h" #include <mpim_grid.h> -#include "cdi_lockedIO.h" -#include "cdo_options.h" // callback function for curl for writing the network retrieved grid file #ifdef HAVE_LIBCURL @@ -266,9 +266,9 @@ referenceToGrid(int gridID1) char griddir[8192] = { 0 }; char gridfilepath[8192] = { 0 }; - if (!cdo::IconGrids.empty() && griduri[0]) + if (!IconGrids.empty() && griduri[0]) { - if (search_directory(cdo::IconGrids.c_str())) cdo_abort("CDO_ICON_GRIDS not found: %s!", cdo::IconGrids); + if (search_directory(IconGrids.c_str())) cdo_abort("CDO_ICON_GRIDS not found: %s!", IconGrids); auto wpath = griduri; if (strncmp(griduri, "http://", 7) == 0) wpath += 7; @@ -279,7 +279,7 @@ referenceToGrid(int gridID1) auto gridpath = strchr(wpath, '/'); if (gridpath) { - strcpy(griddir, cdo::IconGrids.c_str()); + strcpy(griddir, IconGrids.c_str()); strcpy(gridfilepath, griddir); strcat(gridfilepath, gridpath); status = search_file(griddir, gridfilepath); @@ -290,9 +290,9 @@ referenceToGrid(int gridID1) if (gridfilepath[0] == 0) { - if (!cdo::DownloadPath.empty()) + if (!DownloadPath.empty()) { - strcpy(griddir, cdo::DownloadPath.c_str()); + strcpy(griddir, DownloadPath.c_str()); strcat(griddir, "/"); status = search_directory(griddir); diff --git a/src/process.cc b/src/process.cc index 43bd7439b68e5cba49b1d75d41f5307470d913a0..918be8aa4bf6709d2d9da55698deacd476f802cf 100644 --- a/src/process.cc +++ b/src/process.cc @@ -148,18 +148,12 @@ Process::add_pipe_in_stream() void Process::add_parent(const std::shared_ptr<Process> &parentProcess) { - parentProcesses.push_back(parentProcess); m_posInParent = parentProcess->inputStreams.size() - 1; - add_pipe_out_stream(); -} - -void -Process::add_pipe_out_stream() -{ - outputStreams.push_back(parentProcesses[0]->inputStreams[m_posInParent]); + outputStreams.push_back(parentProcess->inputStreams[m_posInParent]); m_streamCnt++; } + void * execute(void *process) { diff --git a/src/process.h b/src/process.h index dd5eba310a008eb1edf357e256ae161636c93156..d3f8a9e1b4f6c53a380e2dc07a7d943f64ca08a7 100644 --- a/src/process.h +++ b/src/process.h @@ -42,7 +42,6 @@ public: const CdoModule &m_module; int m_posInParent; std::vector<std::shared_ptr<Process>> childProcesses; - std::vector<std::shared_ptr<Process>> parentProcesses; std::vector<CdoStreamID> inputStreams; std::vector<CdoStreamID> outputStreams; @@ -63,7 +62,7 @@ public: /* Member Functions */ Process(int p_ID, const std::string &p_operatorName, const std::vector<std::string> &p_arguments, const CdoModule &p_module); - virtual ~Process() {} + virtual ~Process() {Debug(PROCESS,"destruction of %s",operatorName);} pthread_t start_thread(); virtual void init() = 0;