Dakota  Version 6.15
Explore and Predict with Confidence
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
Public Member Functions | Private Attributes | List of all members
CommandShell Class Reference

Utility class which defines convenience operators for spawning processes with system calls. More...

Public Member Functions

 CommandShell ()
 constructor
 
 ~CommandShell ()
 destructor
 
CommandShelloperator<< (const char *cmd)
 appends cmd to sysCommand More...
 
CommandShelloperator<< (const std::string &cmd)
 convenient operator: appends string to the commandString to be executed
 
CommandShelloperator<< (CommandShell &(*f)(CommandShell &))
 allows passing of the flush function to the shell using << More...
 
CommandShellflush ()
 "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)
 

Detailed Description

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.

Member Function Documentation

CommandShell & operator<< ( const char *  cmd)
inline

appends cmd to sysCommand

convenient operator: appends string to the commandString to be executed

References CommandShell::sysCommand.

CommandShell & operator<< ( CommandShell &(*)(CommandShell &)  f)
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().


The documentation for this class was generated from the following files: