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

Class to control a running ground call. More...

#include <ground.hh>

Public Member Functions

 GroundHandle (clingo_ground_handle_t *hnd)
 Constructor from the underlying C representation.
 
auto get () const -> GroundResult
 Get the solve result.
 
void cancel ()
 Cancel the current search.
 
void close () noexcept
 Closes the solve handle.
 
auto wait (std::optional< double > timeout) -> bool
 Wait for a running ground call.
 

Friends

auto c_cast (GroundHandle const &x) -> clingo_ground_handle_t *
 Cast the solve handle to its C representation.
 

Detailed Description

Class to control a running ground call.

Constructor & Destructor Documentation

◆ GroundHandle()

Clingo::GroundHandle::GroundHandle ( clingo_ground_handle_t hnd)
inlineexplicit

Constructor from the underlying C representation.

For internal use.

Parameters
hndthe C representation of the solve handle

Member Function Documentation

◆ cancel()

void Clingo::GroundHandle::cancel ( )
inline

Cancel the current search.

This is a blocking operation.

◆ close()

void Clingo::GroundHandle::close ( )
inlinenoexcept

Closes the solve handle.

Blocks until the grounding process has been cleaned up.

◆ get()

auto Clingo::GroundHandle::get ( ) const -> GroundResult
inline

Get the solve result.

This is a blocking operation and should always be called at the end of a search.

Returns
the solve result

◆ wait()

auto Clingo::GroundHandle::wait ( std::optional< double >  timeout) -> bool
inline

Wait for a running ground call.

If no timeout is given, waits until the ground call is finished. Otherwise, waits for the given timeout in seconds. A value of zero can be used for polling.

Parameters
timeoutthe optional timeout in seconds
Returns
whether a model or result is available

Friends And Related Symbol Documentation

◆ c_cast

auto c_cast ( GroundHandle const &  x) -> clingo_ground_handle_t *
friend

Cast the solve handle to its C representation.

Parameters
xthe solve handle to cast
Returns
the C representation of the solve handle

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