processes::launch_process Class Reference

Provides the capability to start processes in a variety of ways to run other applications. More...

#include <launch_process.h>

Inheritance diagram for processes::launch_process:
Inheritance graph
[legend]
Collaboration diagram for processes::launch_process:
Collaboration graph
[legend]

List of all members.

Public Types

enum  launch_flags {
  HIDE_APP_WINDOW = 0x1, AWAIT_APP_EXIT = 0x2, RETURN_IMMEDIATELY = 0x4, AWAIT_VIA_POLLING = 0x8,
  SHELL_EXECUTE = 0x10
}

Public Member Functions

 DEFINE_CLASS_NAME ("launch_process")
virtual ~launch_process ()

Static Public Member Functions

static basis::un_int run (const basis::astring &app_name, const basis::astring &command_line, int flag, basis::un_int &child_id)
 starts an application using the "app_name" as the executable to run.
static char_star_array break_line (basis::astring &app, const basis::astring &parameters)
 prepares an "app" to launch with the "parameters" (via exec).

Detailed Description

Provides the capability to start processes in a variety of ways to run other applications.

Definition at line 44 of file launch_process.h.


Member Enumeration Documentation

Enumerator:
HIDE_APP_WINDOW 

launches the application invisibly if possible.

AWAIT_APP_EXIT 

stays in the function until the launched application has exited.

RETURN_IMMEDIATELY 

starts the application and comes right back to the caller.

AWAIT_VIA_POLLING 

launches the app but polls and doesn't block on its exit.

SHELL_EXECUTE 

only valid on windows--uses ShellExecute instead of CreateProcess.

Definition at line 51 of file launch_process.h.


Constructor & Destructor Documentation

virtual processes::launch_process::~launch_process (  )  [inline, virtual]

Definition at line 49 of file launch_process.h.


Member Function Documentation

char_star_array processes::launch_process::break_line ( basis::astring app,
const basis::astring parameters 
) [static]

prepares an "app" to launch with the "parameters" (via exec).

this breaks the strings for an application named "app" and its "parameters" into an array of char * that is appropriate for the execv function.

Definition at line 118 of file launch_process.cpp.

References basis::astring::end(), FUNCDEF, basis::array< contents >::last(), basis::astring::length(), LOG, NIL, basis::astring::stuff(), basis::astring::substring(), and basis::astring::zap().

Referenced by run().

processes::launch_process::DEFINE_CLASS_NAME ( "launch_process"   ) 
basis::un_int processes::launch_process::run ( const basis::astring app_name,
const basis::astring command_line,
int  flag,
basis::un_int child_id 
) [static]

starts an application using the "app_name" as the executable to run.

the "command_line" is the set of parameters to be passed to the app. the return value is OS specific but can be identified using system_error_text(). usually a zero return means success and non-zero codes are errors. the "flag" is an XORed value from the process launch flags that dictates how the app is to be started. in practice, only the HIDE_APP_WINDOW flag can be combined with other values. if either AWAIT flag is used, then the return value will be the launched process's own exit value. the thread or process_id of the launched process is stored in "child_id" if appropriate.

Definition at line 163 of file launch_process.cpp.

References processes::__our_kids(), processes::__process_synchronizer(), AWAIT_APP_EXIT, AWAIT_VIA_POLLING, break_line(), basis::astring::end(), execv, FUNCDEF, HIDE_APP_WINDOW, basis::astring::insert(), LOG, NIL, basis::array< contents >::observe(), RETURN_IMMEDIATELY, basis::astring::s(), and SHELL_EXECUTE.


The documentation for this class was generated from the following files:
Generated on Sat Jan 28 04:25:50 2012 for hoople2 project by  doxygen 1.6.3