24 #ifndef PPL_globals_defs_hh
25 #define PPL_globals_defs_hh 1
35 #ifndef PPL_PROFILE_ADD_WEIGHT
36 #define PPL_PROFILE_ADD_WEIGHT 0
39 #if defined(NDEBUG) && PPL_PROFILE_ADD_WEIGHT
45 #if PPL_PROFILE_ADD_WEIGHT
47 #define WEIGHT_BEGIN() Weight_Profiler::begin()
49 #define WEIGHT_ADD(delta) \
51 static Weight_Profiler wp__(__FILE__, __LINE__, delta); \
55 #define WEIGHT_ADD_MUL(delta, factor) \
57 static Weight_Profiler wp__(__FILE__, __LINE__, delta); \
61 #else // !PPL_PROFILE_ADD_WEIGHT
63 #define WEIGHT_BEGIN() \
67 #define WEIGHT_ADD(delta) \
69 Weightwatch_Traits::weight += (delta); \
72 #define WEIGHT_ADD_MUL(delta, factor) \
74 Weightwatch_Traits::weight += (delta)*(factor); \
77 #endif // !PPL_PROFILE_ADD_WEIGHT
79 #else // !defined(NDEBUG)
81 #define WEIGHT_BEGIN()
83 #define WEIGHT_ADD(delta) \
85 if (!In_Assert::asserting()) { \
86 Weightwatch_Traits::weight += delta; \
90 #define WEIGHT_ADD_MUL(delta, factor) \
92 if (!In_Assert::asserting()) { \
93 Weightwatch_Traits::weight += delta * factor; \
97 #endif // !defined(NDEBUG)
106 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
107 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
112 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
119 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
120 template <
typename T>
133 #define PPL_DIRTY_TEMP_COEFFICIENT(id) \
134 PPL_DIRTY_TEMP(Parma_Polyhedra_Library::Coefficient, id)
136 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
155 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
161 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
168 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
177 static const Threshold&
get();
180 static bool less_than(
const Threshold& a,
const Threshold& b);
194 static Delta
compute_delta(
unsigned long unscaled,
unsigned scale);
197 static void from_delta(Threshold& threshold,
const Delta& delta);
273 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
293 #define PPL_STR(s) #s
295 #define PPL_XSTR(s) PPL_STR(s)
297 #define PPL_OUTPUT_DECLARATIONS \
299 void ascii_dump() const; \
301 void ascii_dump(std::ostream& s) const; \
305 #define PPL_OUTPUT_DEFINITIONS(class_name) \
307 Parma_Polyhedra_Library::class_name::ascii_dump() const { \
308 ascii_dump(std::cerr); \
312 Parma_Polyhedra_Library::class_name::print() const { \
313 using IO_Operators::operator<<; \
314 std::cerr << *this; \
317 #define PPL_OUTPUT_DEFINITIONS_ASCII_ONLY(class_name) \
319 Parma_Polyhedra_Library::class_name::ascii_dump() const { \
320 ascii_dump(std::cerr); \
324 Parma_Polyhedra_Library::class_name::print() const { \
325 std::cerr << "No user level output operator defined " \
326 << "for class " PPL_XSTR(class_name) << "." << std::endl; \
329 #define PPL_OUTPUT_TEMPLATE_DEFINITIONS(type_symbol, class_prefix) \
330 template <typename type_symbol> \
332 class_prefix::ascii_dump() const { \
333 ascii_dump(std::cerr); \
336 template <typename type_symbol> \
338 class_prefix::print() const { \
339 using IO_Operators::operator<<; \
340 std::cerr << *this; \
343 #define PPL_OUTPUT_2_PARAM_TEMPLATE_DEFINITIONS(type_symbol1, \
346 template <typename type_symbol1, typename type_symbol2> \
348 PPL_U(class_prefix)<PPL_U(type_symbol1), PPL_U(type_symbol2)> \
349 ::ascii_dump() const { \
350 ascii_dump(std::cerr); \
353 template <typename type_symbol1, typename type_symbol2> \
355 PPL_U(class_prefix)<PPL_U(type_symbol1), PPL_U(type_symbol2)> \
357 using IO_Operators::operator<<; \
358 std::cerr << *this; \
361 #define PPL_OUTPUT_3_PARAM_TEMPLATE_DEFINITIONS(type_symbol1, \
365 template <typename type_symbol1, typename type_symbol2, \
366 typename type_symbol3> \
368 PPL_U(class_prefix)<PPL_U(type_symbol1), type_symbol2, \
369 PPL_U(type_symbol3)>::ascii_dump() \
371 ascii_dump(std::cerr); \
374 template <typename type_symbol1, typename type_symbol2, \
375 typename type_symbol3> \
377 PPL_U(class_prefix)<PPL_U(type_symbol1), type_symbol2, \
378 PPL_U(type_symbol3)>::print() \
380 using IO_Operators::operator<<; \
381 std::cerr << *this; \
384 #define PPL_OUTPUT_TEMPLATE_DEFINITIONS_ASCII_ONLY(type_symbol, class_prefix) \
385 template <typename type_symbol> \
387 class_prefix::ascii_dump() const { \
388 ascii_dump(std::cerr); \
391 template <typename type_symbol> \
393 class_prefix::print() const { \
394 std::cerr << "No user level output operator defined " \
395 << "for " PPL_XSTR(class_prefix) << "." << std::endl; \
398 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
399 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
403 template <
typename T,
long long v,
typename Enable =
void>
407 template <
typename T,
long long v>
415 template <
typename T, T v>
421 template <
typename T, T v>
424 template <
typename T,
long long v,
bool prefer_signed =
true,
425 typename Enable =
void>
432 template <
typename T,
long long v,
bool prefer_
signed>
436 || !Fit<typename C_Integer<T>::smaller_unsigned_type, v>::value))>::type>
437 :
public Constant_<typename C_Integer<T>::smaller_signed_type, v, prefer_signed> {
440 template <
typename T,
long long v,
bool prefer_
signed>
441 struct Constant_<T, v, prefer_signed,
442 typename Enable_If<(Fit<typename C_Integer<T>::smaller_unsigned_type, v>
::value
444 || !Fit<typename C_Integer<T>::smaller_signed_type, v>::value))>::type>
445 :
public Constant_<typename C_Integer<T>::smaller_unsigned_type, v, prefer_signed> {
450 template <
long long v,
bool prefer_
signed = true>
454 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
457 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
459 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
464 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
465 template <
typename T>
469 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
474 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
475 template <
typename T>
479 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
480 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
485 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
486 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
491 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
492 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
497 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
498 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
503 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
505 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
508 template <
typename T,
typename Enable =
void>
511 template <
typename T>
516 template <
typename T>
522 #define FOK(T) inline bool f_OK(const T&) { return true; }
533 FOK(
signed long long)
534 FOK(
unsigned long long)
551 template <typename RA_Container>
552 typename RA_Container::iterator
555 template <typename RA_Container>
556 typename RA_Container::const_iterator
565 #ifndef PPL_USE_SPARSE_MATRIX
566 #define PPL_USE_SPARSE_MATRIX 1
571 #endif // !defined(PPL_globals_defs_hh)
void swap(CO_Tree &x, CO_Tree &y)
size_t dimension_type
An unsigned integral type for representing space dimensions.
Enable_If< Is_Native_Or_Checked< T >::value, void >::type ascii_dump(std::ostream &s, const T &t)
unsigned long long Threshold
The type used to specify thresholds for computational weight.
dimension_type not_a_dimension()
Returns a value that does not designate a valid dimension.
static bool less_than(const Threshold &a, const Threshold &b)
Compares the two weights a and b.
The standard C++ namespace.
bool is_space(char c)
Returns true if c is any kind of space character.
RA_Container::iterator nth_iter(RA_Container &cont, dimension_type n)
virtual ~Throwable()
Virtual destructor.
dimension_type compute_capacity(dimension_type requested_size, dimension_type maximum_size)
Speculative allocation function.
virtual void throw_me() const =0
Throws the user defined exception object.
#define PPL_COMPILE_TIME_CHECK(e, msg)
Produces a compilation error if the compile-time constant e does not evaluate to true ...
Traits class for the deterministic timeout mechanism.
unsigned long long Delta
The type used to specify increments of computational weight.
A class holding a constant called value that evaluates to true.
dimension_type check_space_dimension_overflow(const dimension_type dim, const dimension_type max, const char *domain, const char *method, const char *reason)
Enable_If< Is_Native< T >::value, memory_size_type >::type external_memory_in_bytes(const T &)
For native types, returns the size in bytes of the memory managed by the type of the (unused) paramet...
Enable_If< Is_Native_Or_Checked< T >::value, bool >::type ascii_load(std::istream &s, T &t)
int32_t hash_code_from_dimension(dimension_type dim)
Returns the hash code for space dimension dim.
static Threshold weight
The current computational weight.
The entire library is confined to this namespace.
static unsigned int count
Non zero during evaluation of PPL_ASSERT expression.
Enable_If< Has_OK< T >::value, bool >::type f_OK(const T &to)
static void(* check_function)(void)
A pointer to the function that has to be called when checking the reaching of thresholds.
static void from_delta(Threshold &threshold, const Delta &delta)
Sets threshold to be delta units bigger than the current weight.
size_t memory_size_type
An unsigned integral type for representing memory size in bytes.
const Throwable *volatile abandon_expensive_computations
A pointer to an exception object.
A class that provides a type member called type equivalent to T if and only if b is true...
Enable_If< Is_Native< T >::value, memory_size_type >::type total_memory_in_bytes(const T &)
For native types, returns the total size in bytes of the memory occupied by the type of the (unused) ...
User objects the PPL can throw.
A class holding a constant called value that evaluates to false.
dimension_type least_significant_one_mask(dimension_type i)
static Delta compute_delta(unsigned long unscaled, unsigned scale)
Computes a Delta value from unscaled and scale.