PPL  1.2
Parma_Polyhedra_Library::Weightwatch_Traits Struct Reference

Traits class for the deterministic timeout mechanism. More...

#include <globals_defs.hh>

Public Types

typedef unsigned long long Threshold
 The type used to specify thresholds for computational weight. More...
 
typedef unsigned long long Delta
 The type used to specify increments of computational weight. More...
 

Static Public Member Functions

static const Thresholdget ()
 Returns the current computational weight. More...
 
static bool less_than (const Threshold &a, const Threshold &b)
 Compares the two weights a and b. More...
 
static Delta compute_delta (unsigned long unscaled, unsigned scale)
 Computes a Delta value from unscaled and scale. More...
 
static void from_delta (Threshold &threshold, const Delta &delta)
 Sets threshold to be delta units bigger than the current weight. More...
 

Static Public Attributes

static Threshold weight = 0
 The current computational weight. More...
 
static void(* check_function )(void)
 A pointer to the function that has to be called when checking the reaching of thresholds. More...
 

Detailed Description

Traits class for the deterministic timeout mechanism.

This abstract base class should be instantiated by those users willing to provide a polynomial upper bound to the time spent by any invocation of a library operator.

Definition at line 169 of file globals_defs.hh.

Member Typedef Documentation

The type used to specify increments of computational weight.

Definition at line 174 of file globals_defs.hh.

The type used to specify thresholds for computational weight.

Definition at line 171 of file globals_defs.hh.

Member Function Documentation

Weightwatch_Traits::Delta Parma_Polyhedra_Library::Weightwatch_Traits::compute_delta ( unsigned long  unscaled,
unsigned  scale 
)
inlinestatic

Computes a Delta value from unscaled and scale.

Returns
$u \cdot 2^s$, where $u$ is the value of unscaled and $s$ is the value of scale.
Parameters
unscaledThe value of delta before scaling.
scaleThe scaling to be applied to unscaled.

Definition at line 60 of file globals_inlines.hh.

60  {
61  if ((std::numeric_limits<Delta>::max() >> scale) < unscaled) {
62  throw std::invalid_argument("PPL::Weightwatch_Traits::"
63  "compute_delta(u, s):\n"
64  "values of u and s cause wrap around.");
65  }
66  return static_cast<Delta>(unscaled) << scale;
67 }
unsigned long long Delta
The type used to specify increments of computational weight.
void Parma_Polyhedra_Library::Weightwatch_Traits::from_delta ( Threshold threshold,
const Delta delta 
)
inlinestatic

Sets threshold to be delta units bigger than the current weight.

Definition at line 70 of file globals_inlines.hh.

References weight.

70  {
71  threshold = weight + delta;
72 }
static Threshold weight
The current computational weight.
const Weightwatch_Traits::Threshold & Parma_Polyhedra_Library::Weightwatch_Traits::get ( )
inlinestatic

Returns the current computational weight.

Definition at line 50 of file globals_inlines.hh.

References weight.

50  {
51  return weight;
52 }
static Threshold weight
The current computational weight.
bool Parma_Polyhedra_Library::Weightwatch_Traits::less_than ( const Threshold a,
const Threshold b 
)
inlinestatic

Compares the two weights a and b.

Definition at line 55 of file globals_inlines.hh.

References sizeof_to_bits.

55  {
56  return b - a < (1ULL << (sizeof_to_bits(sizeof(Threshold)) - 1));
57 }
unsigned long long Threshold
The type used to specify thresholds for computational weight.
#define sizeof_to_bits(size)
Definition: compiler.hh:80

Member Data Documentation

void(* Parma_Polyhedra_Library::Weightwatch_Traits::check_function)(void)=0
static

A pointer to the function that has to be called when checking the reaching of thresholds.

The pointer can be null if no thresholds are set.

Definition at line 208 of file globals_defs.hh.

Referenced by Parma_Polyhedra_Library::maybe_abandon().

Weightwatch_Traits::Threshold Parma_Polyhedra_Library::Weightwatch_Traits::weight = 0
static

The current computational weight.

Definition at line 200 of file globals_defs.hh.

Referenced by Parma_Polyhedra_Library::Weight_Profiler::end(), from_delta(), and get().


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