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::SkillExecutionID & executionId () const
 
std::optional< SkillStatusUpdate > getExecutionStatus ()
 Get the current execution status of the subskill.
 
std::optional< TerminatedSkillStatusUpdate > join ()
 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.

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.

◆ ~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.

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.

◆ executionId()

const skills::SkillExecutionID & executionId ( ) const

◆ getExecutionStatus()

std::optional< SkillStatusUpdate > getExecutionStatus ( )

Get the current execution status of the subskill.

Returns
optional containing SkillStatusUpdate if available.

◆ 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.

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