|
|
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. | |
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:
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.
| SkillExecutionHandle | ( | SkillProxyPtr | proxy, |
| skills::SkillExecutionID | executionId ) |
Construct a handle for an executing subskill.
| proxy | A SkillProxy configured to control the subskill. |
| executionId | The 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.
| 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.
| 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.
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).