Class CProcessControl#

Nested Relationships#

Nested Types#

Inheritance Relationships#

Base Types#

Class Documentation#

class CProcessControl : public sdv::CSdvObject, public sdv::IObjectControl, public sdv::process::IProcessInfo, public sdv::process::IProcessLifetime, public sdv::process::IProcessControl#

Process control service class.

Public Functions

CProcessControl() = default#

Default constructor.

virtual ~CProcessControl() override#

Destructor.

virtual void Initialize(const sdv::u8string &ssObjectConfig) override#

Initialize the object. Overload of sdv::IObjectControl::Initialize.

Parameters:

ssObjectConfig[in] Optional configuration string.

virtual sdv::EObjectStatus GetStatus() const override#

Get the current status of the object. Overload of sdv::IObjectControl::GetStatus.

Returns:

Return the current status of the object.

virtual void SetOperationMode(sdv::EOperationMode eMode) override#

Set the component operation mode. Overload of sdv::IObjectControl::SetOperationMode.

Parameters:

eMode[in] The operation mode, the component should run in.

virtual void Shutdown() override#

Shutdown called before the object is destroyed. Overload of sdv::IObjectControl::Shutdown.

bool AllowProcessControl() const#

Check for the application context mode being main or standalone.

Returns:

Returns ‘true’ when the process control is allowed; otherwise returns ‘false’.

virtual sdv::process::TProcessID GetProcessID() const override#

Gets the process ID of that currently in. Overload of sdv::process::IProcessInfo::GetProcessID.

Returns:

Return the process ID.

virtual uint32_t RegisterMonitor(sdv::process::TProcessID tProcessID, sdv::IInterfaceAccess *pMonitor) override#

Register a process lifetime monitor. Overload of sdv::process::IProcessLifetime::RegisterMonitor.

Parameters:
  • tProcessID[in] Process ID to monitor the lifetime for.

  • pMonitor[in] Pointer to the monitor interface. The monitor should expose the IProcessLifetimeCallback interface.

Returns:

Returns a non-zero cookie when successful; zero when not.

virtual void UnregisterMonitor(uint32_t uiCookie) override#

Unregistered a previously registered monitor. Overload of sdv::process::IProcessLifetime::UnregisterMonitor.

Parameters:

uiCookie[in] The cookie from the monitor registration.

virtual bool WaitForTerminate(sdv::process::TProcessID tProcessID, uint32_t uiWaitMs) override#

Wait for a process to finalize. Overload of sdv::process::IProcessLifetime::WaitForTerminate.

Parameters:
  • tProcessID[in] The process ID to wait for.

  • uiWaitMs[in] Maximum time to wait in ms. Could be 0xffffffff to wait indefintely.

Returns:

Returns ‘true’ when the process was terminated (or isn’t running), ‘false’ when still running and a timeout has occurred.

virtual sdv::process::TProcessID Execute(const sdv::u8string &ssModule, const sdv::sequence<sdv::u8string> &seqArgs, sdv::process::EProcessRights eRights) override#

Execute a process. Overload of sdv::process::IProcessControl::Execute.

Parameters:
  • ssModule[in] Module name of the process executable.

  • seqArgs[in] Instantiation arguments to supply to the process.

  • eRights[in] The process rights during instantiation.

Returns:

Returns the process ID or 0 when process creation failed.

virtual bool Terminate(sdv::process::TProcessID tProcessID) override#

Terminate the process. Overload of sdv::process::IProcessControl::Terminate.

Attention

Use this function as a last resort only. The process will be killed and anything unsaved will render invalid.

Parameters:

tProcessID[in] The process ID of the process to terminate.

Returns:

Returns ‘true’ if termination was successful; returns ‘false’ if termination was not possible or not allowed.