47 #ifndef _MIRA_EXECUTEPROCESS_H_ 48 #define _MIRA_EXECUTEPROCESS_H_ 54 #include <boost/noncopyable.hpp> 55 #include <boost/optional.hpp> 56 #include <boost/iostreams/device/file_descriptor.hpp> 57 #include <boost/iostreams/stream.hpp> 82 std::string* oStdOut=NULL,
83 std::string* oErrOut=NULL);
133 void insert(
const std::string& var,
const std::string& value);
142 void insert(
const std::string&
string);
150 void insertList(
const std::string&
string);
156 void remove(
const std::string& var);
159 const std::string& value(
const std::string& var,
const std::string& defaultValue = std::string())
const;
166 std::vector<std::string> envp();
171 const std::map<std::string,std::string>&
variables()
const {
return mVariables; }
179 std::map<std::string,std::string> mVariables;
209 interruptChildOnParentDeath = 0x01,
215 shutdownRecursively = 0x02
258 static Process createProcess(
const std::string& commandLine,
260 RedirectionFlags streamRedirection = none);
263 static Process createProcess(
const std::string& commandLine,
264 RedirectionFlags streamRedirection = none);
272 static Process createProcess(
const std::string& applicationName,
273 const std::vector<std::string>& args,
274 CreationFlags flags = noflags,
275 RedirectionFlags streamRedirection = none,
276 boost::optional<Environment> env = boost::optional<Environment>());
299 ExitStatus getExitStatus();
324 void setRecursiveShutdown(
bool recursive);
343 uint32 getPID()
const;
347 typedef boost::iostreams::stream<boost::iostreams::file_descriptor_sink>
ostream;
348 typedef boost::iostreams::stream<boost::iostreams::file_descriptor_source>
istream;
374 std::vector<int> getRecursiveChildProcesses(
int pid,
int maxDepth = -1);
375 bool interrupt(
int pid);
376 bool terminate(
int pid);
393 bool mShutdownRecursively;
395 boost::shared_ptr<ostream> mCinFd;
396 boost::shared_ptr<istream> mCoutFd;
397 boost::shared_ptr<istream> mCerrFd;
Environment()
Definition: Process.h:119
Macros for generating logical operators for using enum values as flags.
const std::map< std::string, std::string > & variables() const
Definition: Process.h:171
specialize cv::DataType for our ImgPixel and inherit from cv::DataType<Vec>
Definition: IOService.h:67
Time and Duration wrapper class.
Definition: Process.h:103
#define MIRA_ENUM_TO_FLAGS_INCLASS(EnumType)
Macro that can be used with enums that contain flags.
Definition: EnumToFlags.h:143
Encapsulates a process, that was launched from the current process.
Definition: Process.h:96
MIRA_BASE_EXPORT int executeProcess(const std::string &cmd, std::string *oStdOut=NULL, std::string *oErrOut=NULL)
Executes a given command/process.
boost::iostreams::stream< boost::iostreams::file_descriptor_sink > ostream
Definition: Process.h:347
sec_type seconds() const
Returns normalized number of seconds (0..59)
Definition: Time.h:280
Use this class to represent time durations.
Definition: Time.h:106
static Duration infinity()
Returns a special duration time representing positive infinity.
Definition: Time.h:242
CreationFlags
Definition: Process.h:205
Definition: Process.h:101
Definition: Process.h:102
ExitStatus
Definition: Process.h:99
RedirectionFlags
Definition: Process.h:220
boost::iostreams::stream< boost::iostreams::file_descriptor_source > istream
Definition: Process.h:348
Holds the environment variables that can be passed to a process.
Definition: Process.h:116