Clingo
Loading...
Searching...
No Matches
CppClingo::Control::GroundHandle Class Reference

A handle for asynchronous grounding. More...

#include <solver.hh>

Public Member Functions

 GroundHandle (Solver &solver, Input::ProgramParamVec params, UGroundEventHandler handler)
 Start grounding with the given params and context.
 
 ~GroundHandle () noexcept
 Destroy the ground handle.
 
 GroundHandle (GroundHandle const &other)=delete
 Prevent copying.
 
 GroundHandle (GroundHandle &&other) noexcept
 Enable moving.
 
auto operator= (GroundHandle &&other) noexcept -> GroundHandle &
 Enable moving.
 
auto operator= (GroundHandle const &other) -> GroundHandle &=delete
 Prevent copying.
 
auto wait (double timeout) -> bool
 Wait for grounding to finish.
 
auto get () -> GroundResult
 Get the result of grounding.
 
void cancel ()
 Stop grounding.
 

Detailed Description

A handle for asynchronous grounding.

The handle can be moved but not copied.

Constructor & Destructor Documentation

◆ ~GroundHandle()

CppClingo::Control::GroundHandle::~GroundHandle ( )
noexcept

Destroy the ground handle.

If grounding has not stopped yet, this requests grounding to stop and joins the grounding thread.

Member Function Documentation

◆ cancel()

void CppClingo::Control::GroundHandle::cancel ( )

Stop grounding.

Blocks until grounding has finished.

◆ get()

auto CppClingo::Control::GroundHandle::get ( ) -> GroundResult

Get the result of grounding.

Blocks until grounding has finished. Raises exceptions thrown during grounding.

◆ wait()

auto CppClingo::Control::GroundHandle::wait ( double  timeout) -> bool

Wait for grounding to finish.

If the timeout is greater than zero, the method blocks for at most timeout seconds. If the timeout is zero, the method does not block. If the timeout is negative, the method blocks until grounding has finished.

The function returns true if grounding has finished, false otherwise.

Parameters
timeoutThe maximum time to wait in seconds.

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