AUI Framework  develop
Cross-platform base for C++ UI apps
Loading...
Searching...
No Matches
AProcess Class Referenceabstract

#include <AUI/Platform/AProcess.h>

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.
 
virtual size_t processMemory () const =0
 Obtain process memory usage.
 
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.
 
static _< AChildProcessmake (AString applicationFile, AString args={}, APath workingDirectory={})
 Launches an executable.
 
static int executeWaitForExit (AString applicationFile, AString args={}, APath workingDirectory={}, ASubProcessExecutionFlags flags=ASubProcessExecutionFlags::DEFAULT)
 Launches executable.
 
static void executeAsAdministrator (const AString &applicationFile, const AString &args={}, const APath &workingDirectory={})
 Launches executable with administrator rights. (Windows only)
 
static AVector< _< AProcess > > all ()
 
static _< AProcessself ()
 
static _< AProcessfindAnotherSelfInstance (const AString &yourProjectName)
 tempFileName file name which will be used as lock
 
static _< AProcessfromPid (uint32_t pid)
 

Detailed Description

Retrieves data about processes.

Member Function Documentation

◆ all()

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

◆ create()

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

Launches an executable.

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

◆ executeAsAdministrator()

void AProcess::executeAsAdministrator ( const AString & applicationFile,
const AString & args = {},
const APath & workingDirectory = {} )
static

Launches executable with administrator rights. (Windows only)

Parameters
applicationFileexecutable file
argsarguments
workingDirectorypro
Note
This function could not determine exit code because of MS Windows restrictions

◆ executeWaitForExit()

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

Launches executable.

Parameters
applicationFileexecutable file.
argsarguments.
workingDirectoryworking directory.
flagsprocess execution flags. see ASubProcessExecutionFlags.
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 AChildProcess, AOtherProcess, AOtherProcess, and ASelfProcess.

◆ getPathToExecutable()

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

Implemented in AChildProcess, AOtherProcess, AOtherProcess, and ASelfProcess.

◆ getPid()

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

Implemented in AChildProcess, AOtherProcess, AOtherProcess, and ASelfProcess.

◆ 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 AChildProcess, AOtherProcess, AOtherProcess, and ASelfProcess.

◆ 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 AChildProcess, AOtherProcess, AOtherProcess, and ASelfProcess.


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