Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
FInteractiveProcess Class Reference

#include <InteractiveProcess.h>

+ Inheritance diagram for FInteractiveProcess:
+ Collaboration diagram for FInteractiveProcess:

Public Member Functions

 FInteractiveProcess (const FString &InURL, const FString &InParams, bool InHidden, bool LongTime=false)
 
 FInteractiveProcess (const FString &InURL, const FString &InParams, const FString &InWorkingDir, bool InHidden, bool LongTime=false)
 
 ~FInteractiveProcess ()
 
FTimespan GetDuration () const
 
FProcHandle GetProcessHandle () const
 
bool IsRunning () const
 
bool Launch ()
 
FSimpleDelegateOnCanceled ()
 
FOnInteractiveProcessCompletedOnCompleted ()
 
FOnInteractiveProcessOutputOnOutput ()
 
void SendWhenReady (const FString &Message)
 
void SendWhenReady (const TArray< uint8 > &Data)
 
int GetReturnCode () const
 
void Cancel (bool InKillTree=false)
 
virtual bool Init () override
 
virtual uint32 Run () override
 
virtual void Stop () override
 
virtual void Exit () override
 
- Public Member Functions inherited from FRunnable
virtual class FSingleThreadRunnableGetSingleThreadInterface ()
 
virtual ~FRunnable ()
 

Protected Member Functions

void ProcessOutput (const FString &Output)
 
void SendMessageToProcessIf ()
 

Private Attributes

bool bCanceling: 1
 
bool bHidden: 1
 
bool bKillTree: 1
 
float SleepTime
 
FString URL
 
FString Params
 
FString WorkingDir
 
FProcHandle ProcessHandle
 
voidReadPipeParent
 
voidWritePipeParent
 
voidReadPipeChild
 
voidWritePipeChild
 
FRunnableThreadThread
 
FString ThreadName
 
int ReturnCode
 
FDateTime StartTime
 
FDateTime EndTime
 
TQueue< FStringStringMessagesToProcess
 
TQueue< TArray< uint8 > > DataMessagesToProcess
 
FSimpleDelegate CanceledDelegate
 
FOnInteractiveProcessCompleted CompletedDelegate
 
FOnInteractiveProcessOutput OutputDelegate
 

Detailed Description

Implements an external process that can be interacted.

Definition at line 37 of file InteractiveProcess.h.

Constructor & Destructor Documentation

◆ FInteractiveProcess() [1/2]

FInteractiveProcess::FInteractiveProcess ( const FString & InURL,
const FString & InParams,
bool InHidden,
bool LongTime = false )

Creates a new interactive process.

Parameters
InURLThe URL of the executable to launch.
InParamsThe command line parameters.
InHiddenWhether the window of the process should be hidden.

◆ FInteractiveProcess() [2/2]

FInteractiveProcess::FInteractiveProcess ( const FString & InURL,
const FString & InParams,
const FString & InWorkingDir,
bool InHidden,
bool LongTime = false )

Creates a new interactive process.

Parameters
InURLThe URL of the executable to launch.
InParamsThe command line parameters.
InWorkingDirThe URL of the working dir where the executable should launch.
InHiddenWhether the window of the process should be hidden.

◆ ~FInteractiveProcess()

FInteractiveProcess::~FInteractiveProcess ( )

Destructor.

Member Function Documentation

◆ Cancel()

void FInteractiveProcess::Cancel ( bool InKillTree = false)
inline

Cancels the process.

Parameters
InKillTreeWhether to kill the entire process tree when canceling this process.

Definition at line 158 of file InteractiveProcess.h.

+ Here is the caller graph for this function:

◆ Exit()

virtual void FInteractiveProcess::Exit ( )
inlineoverridevirtual

Exits the runnable object.

Called in the context of the aggregating thread to perform any cleanup.

See also
Init, Run, Stop

Reimplemented from FRunnable.

Definition at line 178 of file InteractiveProcess.h.

◆ GetDuration()

FTimespan FInteractiveProcess::GetDuration ( ) const

Gets the duration of time that the task has been running.

Returns
Time duration.

◆ GetProcessHandle()

FProcHandle FInteractiveProcess::GetProcessHandle ( ) const
inline

Gets the Process Handle. The instance can be invalid if the process was not created.

Returns
The Process Handle

Definition at line 76 of file InteractiveProcess.h.

◆ GetReturnCode()

int FInteractiveProcess::GetReturnCode ( ) const
inline

Returns the return code from the exited process

Returns
Process return code

Definition at line 148 of file InteractiveProcess.h.

◆ Init()

virtual bool FInteractiveProcess::Init ( )
inlineoverridevirtual

Initializes the runnable object.

This method is called in the context of the thread object that aggregates this, not the thread that passes this runnable to a new thread.

Returns
True if initialization was successful, false otherwise
See also
Run, Stop, Exit

Reimplemented from FRunnable.

Definition at line 166 of file InteractiveProcess.h.

◆ IsRunning()

bool FInteractiveProcess::IsRunning ( ) const
inline

Checks whether the process is still running.

Returns
true if the process is running, false otherwise.

Definition at line 86 of file InteractiveProcess.h.

◆ Launch()

bool FInteractiveProcess::Launch ( )

Launches the process

Returns
True if succeed

◆ OnCanceled()

FSimpleDelegate & FInteractiveProcess::OnCanceled ( )
inline

Returns a delegate that is executed when the process has been canceled.

Returns
The delegate.

Definition at line 103 of file InteractiveProcess.h.

◆ OnCompleted()

FOnInteractiveProcessCompleted & FInteractiveProcess::OnCompleted ( )
inline

Returns a delegate that is executed when the interactive process completed. Delegate won't be executed if process terminated without user wanting

Returns
The delegate.

Definition at line 114 of file InteractiveProcess.h.

◆ OnOutput()

FOnInteractiveProcessOutput & FInteractiveProcess::OnOutput ( )
inline

Returns a delegate that is executed when a interactive process produces output.

Returns
The delegate.

Definition at line 124 of file InteractiveProcess.h.

◆ ProcessOutput()

void FInteractiveProcess::ProcessOutput ( const FString & Output)
protected

Processes the given output string.

Parameters
OutputThe output string to process.

◆ Run()

virtual uint32 FInteractiveProcess::Run ( )
overridevirtual

Runs the runnable object.

This is where all per object thread work is done. This is only called if the initialization was successful.

Returns
The exit code of the runnable object
See also
Init, Stop, Exit

Implements FRunnable.

◆ SendMessageToProcessIf()

void FInteractiveProcess::SendMessageToProcessIf ( )
protected

Takes the first message to be sent from MessagesToProcess, if there is one, and sends it to process

◆ SendWhenReady() [1/2]

void FInteractiveProcess::SendWhenReady ( const FString & Message)

Sends the string message when process is ready

Parameters
Messageto be sent

◆ SendWhenReady() [2/2]

void FInteractiveProcess::SendWhenReady ( const TArray< uint8 > & Data)

Sends the data message when process is ready

Parameters
Datato be sent

◆ Stop()

virtual void FInteractiveProcess::Stop ( )
inlineoverridevirtual

Stops the runnable object.

This is called if a thread is requested to terminate early.

See also
Init, Run, Exit

Reimplemented from FRunnable.

Definition at line 173 of file InteractiveProcess.h.

+ Here is the call graph for this function:

Member Data Documentation

◆ bCanceling

bool FInteractiveProcess::bCanceling
private

Definition at line 196 of file InteractiveProcess.h.

◆ bHidden

bool FInteractiveProcess::bHidden
private

Definition at line 199 of file InteractiveProcess.h.

◆ bKillTree

bool FInteractiveProcess::bKillTree
private

Definition at line 202 of file InteractiveProcess.h.

◆ CanceledDelegate

FSimpleDelegate FInteractiveProcess::CanceledDelegate
private

Definition at line 253 of file InteractiveProcess.h.

◆ CompletedDelegate

FOnInteractiveProcessCompleted FInteractiveProcess::CompletedDelegate
private

Definition at line 256 of file InteractiveProcess.h.

◆ DataMessagesToProcess

TQueue<TArray<uint8> > FInteractiveProcess::DataMessagesToProcess
private

Definition at line 250 of file InteractiveProcess.h.

◆ EndTime

FDateTime FInteractiveProcess::EndTime
private

Definition at line 244 of file InteractiveProcess.h.

◆ OutputDelegate

FOnInteractiveProcessOutput FInteractiveProcess::OutputDelegate
private

Definition at line 259 of file InteractiveProcess.h.

◆ Params

FString FInteractiveProcess::Params
private

Definition at line 211 of file InteractiveProcess.h.

◆ ProcessHandle

FProcHandle FInteractiveProcess::ProcessHandle
private

Definition at line 217 of file InteractiveProcess.h.

◆ ReadPipeChild

void* FInteractiveProcess::ReadPipeChild
private

Definition at line 226 of file InteractiveProcess.h.

◆ ReadPipeParent

void* FInteractiveProcess::ReadPipeParent
private

Definition at line 220 of file InteractiveProcess.h.

◆ ReturnCode

int FInteractiveProcess::ReturnCode
private

Definition at line 238 of file InteractiveProcess.h.

◆ SleepTime

float FInteractiveProcess::SleepTime
private

Definition at line 205 of file InteractiveProcess.h.

◆ StartTime

FDateTime FInteractiveProcess::StartTime
private

Definition at line 241 of file InteractiveProcess.h.

◆ StringMessagesToProcess

TQueue<FString> FInteractiveProcess::StringMessagesToProcess
private

Definition at line 247 of file InteractiveProcess.h.

◆ Thread

FRunnableThread* FInteractiveProcess::Thread
private

Definition at line 232 of file InteractiveProcess.h.

◆ ThreadName

FString FInteractiveProcess::ThreadName
private

Definition at line 235 of file InteractiveProcess.h.

◆ URL

FString FInteractiveProcess::URL
private

Definition at line 208 of file InteractiveProcess.h.

◆ WorkingDir

FString FInteractiveProcess::WorkingDir
private

Definition at line 214 of file InteractiveProcess.h.

◆ WritePipeChild

void* FInteractiveProcess::WritePipeChild
private

Definition at line 229 of file InteractiveProcess.h.

◆ WritePipeParent

void* FInteractiveProcess::WritePipeParent
private

Definition at line 223 of file InteractiveProcess.h.


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