feisty meow concerns codebase  2.140
processes::process_control Class Reference

Provides a bridge to the operating system for information on processes. More...

#include <process_control.h>

Inheritance diagram for processes::process_control:
Collaboration diagram for processes::process_control:

Public Member Functions

 process_control ()
 
virtual ~process_control ()
 
 DEFINE_CLASS_NAME ("process_control")
 
bool healthy () const
 returns true if this object should be functional. More...
 
process_entry query_process (basis::un_int to_query)
 returns the information for just one process. More...
 
bool query_processes (process_entry_array &to_fill)
 finds the processes that are running and drops them into "to_fill". More...
 
bool zap_process (basis::un_int to_zap)
 preemptively zaps the process "to_zap". More...
 
void sort_by_name (process_entry_array &to_sort)
 
void sort_by_pid (process_entry_array &to_sort)
 
- Public Member Functions inherited from basis::nameable
virtual const char * class_name () const =0
 Returns the bare name of this class as a constant character pointer. More...
 

Static Public Member Functions

static bool find_process_in_list (const process_entry_array &processes, const basis::astring &app_name, structures::int_set &pids)
 uses a pre-existing list of "processes" to search for the "app_name". More...
 

Detailed Description

Provides a bridge to the operating system for information on processes.

This object can query the operating system for the current set of processes or zap a particular process of interest.

Definition at line 36 of file process_control.h.

Constructor & Destructor Documentation

◆ process_control()

processes::process_control::process_control ( )

◆ ~process_control()

processes::process_control::~process_control ( )
virtual

Definition at line 165 of file process_control.cpp.

References basis::WHACK().

Member Function Documentation

◆ DEFINE_CLASS_NAME()

processes::process_control::DEFINE_CLASS_NAME ( "process_control"  )

◆ find_process_in_list()

bool processes::process_control::find_process_in_list ( const process_entry_array processes,
const basis::astring app_name,
structures::int_set pids 
)
static

uses a pre-existing list of "processes" to search for the "app_name".

if the process is found, true is returned and the "pids" are set to all entries matching the process name. note that this is an approximate match for some OSes that have a brain damaged process lister (such as ms-windows); they have programs listed under incomplete names in some cases.

Definition at line 317 of file process_control.cpp.

References structures::set< contents >::add(), structures::set< contents >::clear(), basis::astring::compare(), FUNCDEF, LOG, basis::astring::lower(), eml_to_txt::path, structures::version::v_major(), and structures::version::v_minor().

Referenced by application::hoople_service::close_application().

◆ healthy()

bool processes::process_control::healthy ( ) const
inline

returns true if this object should be functional.

if it failed to construct properly, this returns false. usually a failure indicates that a required dynamic library is missing, such as "psapi.dll" on win32.

Definition at line 44 of file process_control.h.

◆ query_process()

process_entry processes::process_control::query_process ( basis::un_int  to_query)

returns the information for just one process.

Definition at line 293 of file process_control.cpp.

References FUNCDEF, basis::array< contents >::length(), and query_processes().

◆ query_processes()

bool processes::process_control::query_processes ( process_entry_array to_fill)

finds the processes that are running and drops them into "to_fill".

Definition at line 195 of file process_control.cpp.

Referenced by application::hoople_service::close_application(), main(), and query_process().

◆ sort_by_name()

void processes::process_control::sort_by_name ( process_entry_array to_sort)

◆ sort_by_pid()

void processes::process_control::sort_by_pid ( process_entry_array to_sort)

Definition at line 185 of file process_control.cpp.

References basis::array< contents >::length().

◆ zap_process()

bool processes::process_control::zap_process ( basis::un_int  to_zap)

preemptively zaps the process "to_zap".

this does not invoke any friendly graceful shut down process, but merely terminates it if possible.

Definition at line 266 of file process_control.cpp.

References FUNCDEF, and LOG.

Referenced by main(), application::launch_manager::push_timed_activities(), and application::launch_manager::zap_process().


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