Hugin trunk 0.1
Loading...
Searching...
No Matches
Executor.h
Go to the documentation of this file.
1
8/* This is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
12 *
13 * This software is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public
19 * License along with this software. If not, see
20 * <http://www.gnu.org/licenses/>.
21 *
22 */
23
24#ifndef EXECUTOR_H
25#define EXECUTOR_H
26
27#include <hugin_shared.h>
28#include <vector>
29#include <wx/string.h>
30#include <wx/config.h>
31#include "base_wx/wxPlatform.h"
32
33namespace HuginQueue
34{
35
38 {
39 public:
40 NormalCommand(wxString prog, wxString args, wxString comment=wxEmptyString) : m_prog(prog), m_args(args), m_comment(comment) {};
41 virtual ~NormalCommand() {};
42 virtual bool Execute(bool dryRun);
43 virtual bool CheckReturnCode() const;
44 virtual wxString GetCommand() const;
45 wxString GetComment() const;
46 protected:
50 };
51
54 {
55 public:
57 virtual bool Execute(bool dryRun);
58 virtual bool CheckReturnCode() const;
59 };
60
61 typedef std::vector<NormalCommand*> CommandQueue;
62
65 WXIMPEX bool RunCommandsQueue(CommandQueue* queue, size_t threads, bool dryRun);
67 WXIMPEX void CleanQueue(CommandQueue* queue);
68
73
76
78 template <class str>
80 {
81#ifdef __WXMSW__
82 // on Windows we return the string enclosed in quotes "
83 // the quote itself is not allowed in filenames, so no further handling is required
84 return str("\"") + arg + str("\"");
85#else
86 // we use UNIX style escaping, escape all special chars with backslash
87 return hugin_utils::wxQuoteStringInternal(arg, str("\\"), str("\\ ~$\"|'`{}[]()"));
88#endif
89 };
90
91#ifdef __WXMSW__
94#endif
95
100
103
104}; //namespace
105
106#endif
normal command for queue, processing is stopped if an error occurred in program
Definition Executor.h:38
NormalCommand(wxString prog, wxString args, wxString comment=wxEmptyString)
Definition Executor.h:40
optional command for queue, processing of queue is always continued, also if an error occurred
Definition Executor.h:54
OptionalCommand(wxString prog, wxString args, wxString comment=wxEmptyString)
Definition Executor.h:56
#define WXIMPEX
str wxEscapeFilename(const str &arg)
special escaping routine for CommandQueues
Definition Executor.h:79
wxString GetExternalProgram(wxConfigBase *config, const wxString &bindir, const wxString &name)
return path and name of external program, which can be overwritten by the user
Definition Executor.cpp:148
void CleanQueue(CommandQueue *queue)
clean the queue, delete all entries, but not the queue itself
Definition Executor.cpp:118
bool RunCommandsQueue(CommandQueue *queue, size_t threads, bool dryRun)
execute the given, set environment variable OMP_NUM_THREADS to threads (ignored for 0) after running ...
Definition Executor.cpp:83
wxString wxStringFromCDouble(double val, int precision)
convert double to wxString, it is always using a '.
Definition Executor.cpp:238
std::vector< NormalCommand * > CommandQueue
Definition Executor.h:61
const wxString GetSettingStringTranslated(wxConfigBase *setting, const wxString &name, const wxString defaultValue)
read a translated string from settings and remove all whitespaces
Definition Executor.cpp:288
wxString GetInternalProgram(const wxString &bindir, const wxString &name)
return path and name of external program, which comes bundled with Hugin
Definition Executor.cpp:129
const wxString GetConfigTempDir(const wxConfigBase *config)
return the temp dir from the preferences, ensure that it ends with path separator
Definition Executor.cpp:302
const wxString GetSettingString(wxConfigBase *setting, const wxString &name, const wxString defaultValue)
read a string from setting and remove all whitespaces
Definition Executor.cpp:281
str wxQuoteStringInternal(const str &arg, const str &quotechar, const str &replacements)
Definition wxPlatform.h:36
std::vector< deghosting::BImagePtr > threshold(const std::vector< deghosting::FImagePtr > &inputImages, const double threshold, const uint16_t flags)
Threshold function used for creating alpha masks for images.
Definition threshold.h:41
platform/compiler specific stuff.