run_exe.hpp
Go to the documentation of this file.
1 // Copyright (c) 2006, 2007 Julio M. Merino Vidal
2 // Copyright (c) 2008 Ilya Sokolov, Boris Schaeling
3 // Copyright (c) 2009 Boris Schaeling
4 // Copyright (c) 2010 Felipe Tanus, Boris Schaeling
5 // Copyright (c) 2011, 2012 Jeff Flinn, Boris Schaeling
6 //
7 // Distributed under the Boost Software License, Version 1.0. (See accompanying
8 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9 
10 #pragma once
11 
13 #include <filesystem>
14 #include <boost/shared_array.hpp>
15 #include <string>
16 
18 {
19 
20  class run_exe_ : public initializer_base
21  {
22  public:
23  explicit run_exe_(const std::string& s) : s_(s), cmd_line_(new char* [2])
24  {
25  cmd_line_[0] = const_cast<char*>(s_.c_str());
26  cmd_line_[1] = 0;
27  }
28 
29  template <class PosixExecutor>
30  void on_exec_setup(PosixExecutor& e) const
31  {
32  e.exe = s_.c_str();
33  if (!e.cmd_line)
34  {
35  e.cmd_line = cmd_line_.get();
36  }
37  }
38 
39  private:
40  std::string s_;
41  boost::shared_array<char*> cmd_line_;
42  };
43 
44  inline run_exe_ run_exe(const char* s)
45  {
46  return run_exe_(s);
47  }
48 
49  inline run_exe_ run_exe(const std::string& s)
50  {
51  return run_exe_(s);
52  }
53 
54  inline run_exe_ run_exe(const std::filesystem::path& p)
55  {
56  return run_exe_(p.string());
57  }
58 
59 }
boost::process::posix::initializers::run_exe_::on_exec_setup
void on_exec_setup(PosixExecutor &e) const
Definition: run_exe.hpp:30
initializer_base.hpp
boost::process::posix::initializers::run_exe
run_exe_ run_exe(const char *s)
Definition: run_exe.hpp:44
boost::process::posix::initializers
Definition: bind_fd.hpp:15
boost::process::posix::initializers::initializer_base
Definition: initializer_base.hpp:15
boost::process::posix::initializers::run_exe_::run_exe_
run_exe_(const std::string &s)
Definition: run_exe.hpp:23
boost::process::posix::initializers::run_exe_
Definition: run_exe.hpp:20
armarx::ctrlutil::s
double s(double t, double s0, double v0, double a0, double j)
Definition: CtrlUtil.h:33