executor.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 /**
11  * \file boost/process/executor.hpp
12  *
13  * Defines an executor which can create child processes.
14  */
15 
16 #pragma once
17 
18 #include <boost/process/config.hpp>
19 
20 #include BOOST_PROCESS_PLATFORM_PROMOTE_PATH(executor)
21 BOOST_PROCESS_PLATFORM_PROMOTE_NAMESPACE(executor)
22 
23 #if defined(BOOST_PROCESS_DOXYGEN)
24 namespace boost
25 {
26  namespace process
27  {
28 
29  /**
30  * Starts a program.
31  *
32  * boost::process::executor is a functor which calls the system functions
33  * to start a program. Before system functions are called it iterates
34  * over initializers and calls a member function passing a reference
35  * to itself as a parameter. Initializers get then a chance to setup
36  * the executor. If system functions fail boost::process::executor again
37  * iterates over initializers and calls another member function passing a
38  * reference to itself as a parameter. This gives initializers a
39  * chance to handle the error.
40  *
41  * \note Library users shouldn't need to use boost::process::executor.
42  * It is recommended to call boost::process::execute which uses
43  * boost::pocess::executor internally.
44  */
45  struct executor
46  {
47  /**
48  * Default constructor.
49  */
50  executor();
51 
52  /**
53  * Starts a program.
54  *
55  * \tparam initializers define what and how the program is started
56  */
57  template <class Initializer, class... Initializers>
58  child operator()(const Initializer& initializer, const Initializers... &initializers);
59 
60  ///\defgroup WindowsOnly Windows only.
61  ///@{
62 
63  /**
64  * Program name.
65  *
66  * \remark <em>Windows only.</em>
67  */
68  LPCTSTR exe;
69 
70  /**
71  * Command line.
72  *
73  * \remark <em>Windows only.</em>
74  */
75  LPTSTR cmd_line;
76 
77  /**
78  * Process attributes.
79  *
80  * \remark <em>Windows only.</em>
81  */
82  LPSECURITY_ATTRIBUTES proc_attrs;
83 
84  /**
85  * Thread attributes.
86  *
87  * \remark <em>Windows only.</em>
88  */
89  LPSECURITY_ATTRIBUTES thread_attrs;
90 
91  /**
92  * Flag to inherit handles.
93  *
94  * \remark <em>Windows only.</em>
95  */
96  BOOL inherit_handles;
97 
98  /**
99  * Creation flags.
100  *
101  * \remark <em>Windows only.</em>
102  */
103  DWORD creation_flags;
104 
105  /**
106  * Environment variables.
107  *
108  * \remark <em>Windows only.</em>
109  */
110  LPVOID env;
111 
112  /**
113  * Work directory.
114  *
115  * \remark <em>Windows only.</em>
116  */
117  LPCTSTR work_dir;
118 
119  /**
120  * Startupinfo structure.
121  *
122  * \remark <em>Windows only.</em>
123  */
124  STARTUPINFO startup_info;
125 
126  /**
127  * Startupinfoex structure.
128  *
129  * If this member variable is available, \c startup_info is a reference
130  * to \c StartupInfo in STARTUPINFOEX.
131  *
132  * \remark <em>Windows Vista, Windows Server 2008 or better.</em>
133  */
134  STARTUPINFOEX startup_info_ex;
135 
136  /**
137  * Process information.
138  *
139  * \c proc_info contains the result after a child process
140  * could be started successfully.
141  *
142  * \remark <em>Windows only.</em>
143  */
144  PROCESS_INFORMATION proc_info;
145 
146  ///@}
147 
148  ///\defgroup POSIXOnly POSIX only.
149  ///@{
150 
151  /**
152  * Program name.
153  *
154  * \remark <em>POSIX only.</em>
155  */
156  const char* exe;
157 
158  /**
159  * Command line arguments.
160  *
161  * \remark <em>POSIX only.</em>
162  */
163  char** cmd_line;
164 
165  /**
166  * Environment variables.
167  *
168  * \remark <em>POSIX only.</em>
169  */
170  char** env;
171 
172  ///@}
173  };
174 
175  }
176 }
177 #endif
178 
config.hpp
boost
Definition: ApplicationOptions.h:37
armarx::aron::type::Descriptor::BOOL
@ BOOL