Member functions inherited from Runner¶
This page contains a description of the member functions of the ToddCoxeter
class inherited from Runner
.
-
inline bool libsemigroups::congruence::ToddCoxeter::dead() const noexcept¶
Check if the runner is dead.
This function can be used to check if we should terminate run() because it has been killed by another thread.
See also
- Parameters
(None)
- Throws
(None) – This function is
noexcept
and is guaranteed never to throw.- Returns
A
bool
.
-
inline bool libsemigroups::congruence::ToddCoxeter::finished() const¶
Check if run has been run to completion or not.
Returns
true
if run() has been run to completion. For this to work, the implementation of run() in a derived class of Runner must implement a specialisation offinished_impl
.See also
- Parameters
(None)
- Returns
A
bool
.
-
inline void libsemigroups::congruence::ToddCoxeter::kill() noexcept¶
Stop run from running (thread-safe).
This function can be used to terminate run() from another thread. After kill() has been called the Runner may no longer be in a valid state, but will return
true
from dead() .See also
- Parameters
(None)
- Throws
(None) – This function is
noexcept
and is guaranteed never to throw.- Returns
(None).
-
inline bool libsemigroups::congruence::ToddCoxeter::report() const¶
Check if it is time to report.
This function can be used in an implementation of run() (in a derived class of Runner) to check if enough time has passed that we should report again.
See also
report_every(std::chrono::nanoseconds) and report_every(TIntType).
- Parameters
(None)
- Returns
A
bool
.
-
inline std::chrono::nanoseconds libsemigroups::congruence::ToddCoxeter::report_every() const noexcept¶
Get the minimum elapsed time between reports.
- Parameters
(None)
- Returns
The number of nanoseconds between reports.
-
template<typename TIntType>
inline void libsemigroups::congruence::ToddCoxeter::report_every(TIntType t)¶ Set the minimum elapsed time between reports.
This function can be used to specify at run time the minimum elapsed time between two calls to report() that return
true
. If report() returnstrue
at times
, then report() will only returntrue
again after times
+t
has elapsed.- Parameters
t – the amount of time (in
TIntType
) between reports.- Returns
(None)
-
void libsemigroups::congruence::ToddCoxeter::report_every(std::chrono::nanoseconds t)¶
Set the minimum elapsed time between reports.
This function can be used to specify at run time the minimum elapsed time between two calls to report() that return
true
. If report() returnstrue
at times
, then report() will only returntrue
again after times
+t
has elapsed.See also
- Parameters
t – the amount of time (in nanoseconds) between reports.
- Returns
(None)
-
void libsemigroups::congruence::ToddCoxeter::report_why_we_stopped() const¶
Report why run stopped.
Reports whether run() was stopped because it is finished(), timed_out(), or dead().
- Parameters
(None)
- Returns
(None)
-
inline void libsemigroups::congruence::ToddCoxeter::run()¶
Run until finished.
Run the main algorithm implemented by a derived class derived of Runner.
- Parameters
(None)
- Returns
(None)
-
template<typename TIntType>
inline void libsemigroups::congruence::ToddCoxeter::run_for(TIntType t)¶ Run for a specified amount of time.
For this to work it is necessary to periodically check if timed_out() returns
true
, and to stop if it is, in the run() member function of any derived class of Runner.See also
- Parameters
t – the time to run for (in
TIntType
).- Returns
(None)
-
void libsemigroups::congruence::ToddCoxeter::run_for(std::chrono::nanoseconds t)¶
Run for a specified amount of time.
For this to work it is necessary to periodically check if timed_out() returns
true
, and to stop if it is, in the run() member function of any derived class of Runner.See also
- Parameters
t – the time in nanoseconds to run for.
- Returns
(None)
-
template<typename T>
inline void libsemigroups::congruence::ToddCoxeter::run_until(T &&func)¶ Run until a nullary predicate returns
true
or finished.- Parameters
func – a callable type that will exist for at least until this function returns, or a function pointer.
- Returns
(None)
-
inline void libsemigroups::congruence::ToddCoxeter::run_until(bool (*func)())¶
Run until a nullary predicate returns
true
or finished.- Parameters
func – a function pointer.
- Returns
(None)
-
inline bool libsemigroups::congruence::ToddCoxeter::running() const noexcept¶
Check if currently running.
See also
- Parameters
(None)
- Returns
true
if run() is in the process of running andfalse
it is not.- Returns
A
bool
.
-
inline bool libsemigroups::congruence::ToddCoxeter::running_for() const noexcept¶
Check if the runner is currently running for a particular length of time.
If the Runner is currently running because its member function run_for has been invoked, then this function returns
true
. Otherwise,false
is returned.- Complexity
Constant.
- Parameters
(None)
- Throws
(None) – This function is
noexcept
and is guaranteed never to throw.- Returns
A
bool
.
-
inline bool libsemigroups::congruence::ToddCoxeter::running_until() const noexcept¶
Check if the runner is currently running until a nullary predicate returns
true
.If the Runner is currently running because its member function run_until has been invoked, then this function returns
true
. Otherwise,false
is returned.- Complexity
Constant.
- Parameters
(None)
- Throws
(None) – This function is
noexcept
and is guaranteed never to throw.- Returns
A
bool
.
-
inline bool libsemigroups::congruence::ToddCoxeter::started() const¶
Check if run has been called at least once before.
Returns
true
if run() has started to run (it can be running or not).See also
- Parameters
(None)
- Returns
A
bool
.
-
inline bool libsemigroups::congruence::ToddCoxeter::stopped() const¶
Check if the runner is stopped.
This function can be used to check whether or not run() has been stopped for whatever reason. In other words, it checks if timed_out(), finished(), or dead().
- Parameters
(None)
- Returns
A
bool
.
-
inline bool libsemigroups::congruence::ToddCoxeter::stopped_by_predicate() const¶
Check if the runner was, or should, stop because of the argument for run_until.
If
this
is running, then the nullary predicate is called and its return value is returned. Ifthis
is not running, thentrue
is returned if and only if the last timethis
was running it was stopped by a call to the nullary predicate passed to run_until().- Complexity
Constant.
- Parameters
(None)
- Throws
(None) – This function guarantees not to throw a LibsemigroupsException.
- Returns
A
bool
.
-
inline bool libsemigroups::congruence::ToddCoxeter::timed_out() const¶
Check if the amount of time passed to run_for has elapsed.
See also
- Parameters
(None)
- Returns
A
bool