Dakota
Version 6.21
Explore and Predict with Confidence
|
Utility class which defines convenience operators for spawning processes with system calls. More...
Public Member Functions | |
CommandShell () | |
constructor | |
~CommandShell () | |
destructor | |
CommandShell & | operator<< (const char *cmd) |
appends cmd to sysCommand More... | |
CommandShell & | operator<< (const std::string &cmd) |
convenient operator: appends string to the commandString to be executed | |
CommandShell & | operator<< (CommandShell &(*f)(CommandShell &)) |
allows passing of the flush function to the shell using << More... | |
CommandShell & | flush () |
"flushes" the shell; i.e. executes the sysCommand More... | |
void | asynch_flag (const bool flag) |
set the asynchFlag | |
bool | asynch_flag () const |
get the asynchFlag | |
void | suppress_output_flag (const bool flag) |
set the suppressOutputFlag | |
bool | suppress_output_flag () const |
get the suppressOutputFlag | |
Private Attributes | |
std::string | sysCommand |
The command string that is constructed through one or more << insertions and then executed by flush. | |
bool | asynchFlag |
flags nonblocking operation (background system calls) | |
bool | suppressOutputFlag |
flags suppression of shell output (no command echo) | |
Utility class which defines convenience operators for spawning processes with system calls.
The CommandShell class wraps the C system() utility and defines convenience operators for building a command string and then passing it to the shell.
|
inline |
appends cmd to sysCommand
convenient operator: appends string to the commandString to be executed
References CommandShell::sysCommand.
|
inline |
allows passing of the flush function to the shell using <<
convenience operator: allows passing of the flush func to the shell via <<
CommandShell & flush | ( | ) |
"flushes" the shell; i.e. executes the sysCommand
Executes the sysCommand by passing it to system(). Appends an "&" if asynchFlag is set (background system call) and echos the sysCommand to Cout if suppressOutputFlag is not set.
References Dakota::abort_handler(), CommandShell::asynchFlag, CommandShell::suppressOutputFlag, and CommandShell::sysCommand.
Referenced by Dakota::flush().