AUI Framework  master
Cross-platform module-based framework for developing C++20 desktop applications
AProcess Class Referenceabstract

Detailed Description

Retrieves data about processes.

Classes

struct  ArgSingleString
 Process arguments represented as a single string. More...
 
struct  ArgStringList
 Process arguments represented as array of strings. More...
 
struct  ProcessCreationInfo
 Process creation info. More...
 

Public Member Functions

virtual APath getModuleName ()=0
 
virtual APath getPathToExecutable ()=0
 
virtual uint32_t getPid () const noexcept=0
 
virtual int waitForExitCode ()=0
 Wait for process to be finished and returns exit code. More...
 
virtual size_t processMemory () const =0
 Obtain process memory usage. More...
 
void kill () const noexcept
 
- Public Member Functions inherited from aui::noncopyable
 noncopyable (const noncopyable &)=delete
 
noncopyableoperator= (const noncopyable &)=delete
 

Static Public Member Functions

static _< AChildProcesscreate (ProcessCreationInfo args)
 Launches an executable. More...
 
static _< AChildProcessmake (AString applicationFile, AString args={}, APath workingDirectory={})
 Launches an executable. More...
 
static int executeWaitForExit (AString applicationFile, AString args={}, APath workingDirectory={}, ASubProcessExecutionFlags flags=ASubProcessExecutionFlags::DEFAULT)
 Launches executable. More...
 
static AVector< _< AProcess > > all ()
 
static _< AProcessself ()
 
static _< AProcessfindAnotherSelfInstance (const AString &yourProjectName)
 tempFileName file name which will be used as lock More...
 
static _< AProcessfromPid (uint32_t pid)
 

Member Function Documentation

◆ all()

AVector< _< AProcess > > AProcess::all ( )
static
Returns
data about all other running processes.

◆ create()

_< AChildProcess > AProcess::create ( AProcess::ProcessCreationInfo  info)
static

Launches an executable.

Parameters
argsdesignated initializer. See ProcessCreationInfo
Returns
AChildProcess instance. Use AChildProcess::run to execute.

◆ executeWaitForExit()

int AProcess::executeWaitForExit ( AString  applicationFile,
AString  args = {},
APath  workingDirectory = {},
ASubProcessExecutionFlags  flags = ASubProcessExecutionFlags::DEFAULT 
)
static

Launches executable.

Parameters
applicationFileexecutable file
argsarguments
workingDirectoryworking directory
Returns
exit code

◆ findAnotherSelfInstance()

_< AProcess > AProcess::findAnotherSelfInstance ( const AString yourProjectName)
static

tempFileName file name which will be used as lock

Returns
another instance of this application; nullptr, if not found

◆ fromPid()

_< AProcess > AProcess::fromPid ( uint32_t  pid)
static
Returns
process by id

◆ getModuleName()

virtual APath AProcess::getModuleName ( )
pure virtual
Returns
process' executable file name.

Implemented in ASelfProcess, AChildProcess, AOtherProcess, and AOtherProcess.

◆ getPathToExecutable()

virtual APath AProcess::getPathToExecutable ( )
pure virtual
Returns
path to the process' executable.

Implemented in ASelfProcess, AChildProcess, AOtherProcess, and AOtherProcess.

◆ getPid()

virtual uint32_t AProcess::getPid ( ) const
pure virtualnoexcept
Returns
process' ID.

Implemented in ASelfProcess, AChildProcess, AOtherProcess, and AOtherProcess.

◆ make()

static _< AChildProcess > AProcess::make ( AString  applicationFile,
AString  args = {},
APath  workingDirectory = {} 
)
inlinestatic

Launches an executable.

Parameters
applicationFileexecutable file
argsarguments
workingDirectoryworking directory
Returns
AChildProcess instance. Use AChildProcess::run to execute.

◆ processMemory()

virtual size_t AProcess::processMemory ( ) const
pure virtual

Obtain process memory usage.

Implemented in ASelfProcess, AChildProcess, AOtherProcess, and AOtherProcess.

◆ self()

_< AProcess > AProcess::self ( )
static
Returns
data about this process.

◆ waitForExitCode()

virtual int AProcess::waitForExitCode ( )
pure virtual

Wait for process to be finished and returns exit code.

Returns
exit code

Implemented in ASelfProcess, AChildProcess, AOtherProcess, and AOtherProcess.

#include <AUI/Platform/AProcess.h>


The documentation for this class was generated from the following files:
Inheritance diagram for AProcess:
Collaboration diagram for AProcess: