SkillExecutionHandle Class Reference

RAII handle for a running subskill. More...

#include <RobotAPI/libraries/skills/core/SkillExecutionHandle.h>

Public Member Functions

bool abortAsync ()
 Request an asynchronous abort of the subskill.
 
const skills::SkillExecutionIDexecutionId () const
 
std::optional< SkillStatusUpdategetExecutionStatus ()
 Get the current execution status of the subskill.
 
std::optional< TerminatedSkillStatusUpdatejoin ()
 Block until the subskill terminates and return its status.
 
 SkillExecutionHandle (SkillProxyPtr proxy, skills::SkillExecutionID executionId)
 Construct a handle for an executing subskill.
 
 ~SkillExecutionHandle ()
 Destructor requests cleanup of the subskill.
 

Detailed Description

RAII handle for a running subskill.

Represents an asynchronously started subskill. The handle owns the information required to control and query the subskill (a SkillProxy and the subskill's execution id). To ensure that the subskill is properly cleaned up, the handle should be destroyed (or explicitly abort()/join()) before the parent skill exits.

The handle provides:

  • join(): block until the subskill terminates and get its terminated status
  • abort(): request asynchronous abortion of the subskill

Copies of the handle will each hold their own proxy+execution id (shallow copies of the proxy). Destruction of any handle will trigger a best-effort abort request; therefore lifetime management should be done carefully by the caller.

Definition at line 55 of file SkillExecutionHandle.h.

Constructor & Destructor Documentation

◆ SkillExecutionHandle()

Construct a handle for an executing subskill.

Parameters
proxyA SkillProxy configured to control the subskill.
executionIdThe execution id returned when starting the subskill.

Definition at line 76 of file SkillExecutionHandle.cpp.

+ Here is the call graph for this function:

◆ ~SkillExecutionHandle()

Destructor requests cleanup of the subskill.

As a safety measure, the destructor issues an asynchronous abort request for the associated subskill. This is a best-effort request and may be a no-op if the subskill already finished. If the caller needs to wait for the subskill to finish cleanly, call join() before destruction.

Definition at line 51 of file SkillExecutionHandle.cpp.

+ Here is the call graph for this function:

Member Function Documentation

◆ abortAsync()

bool abortAsync ( )

Request an asynchronous abort of the subskill.

This sends an abort request to the subskill but does not wait for it to terminate. Use join() to wait for completion after calling abort() if synchronous behavior is required.

Definition at line 95 of file SkillExecutionHandle.cpp.

◆ executionId()

const skills::SkillExecutionID & executionId ( ) const

Definition at line 189 of file SkillExecutionHandle.cpp.

+ Here is the caller graph for this function:

◆ getExecutionStatus()

std::optional< SkillStatusUpdate > getExecutionStatus ( )

Get the current execution status of the subskill.

Returns
optional containing SkillStatusUpdate if available.

Definition at line 103 of file SkillExecutionHandle.cpp.

◆ join()

std::optional< TerminatedSkillStatusUpdate > join ( )

Block until the subskill terminates and return its status.

This call will block the caller until the subskill execution finishes. On success it returns a TerminatedSkillStatusUpdate describing the final state of the subskill. If the subskill information cannot be retrieved an empty optional may be returned (depending on SkillProxy semantics).

Returns
optional containing TerminatedSkillStatusUpdate if available.

Definition at line 84 of file SkillExecutionHandle.cpp.

+ Here is the caller graph for this function:

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