00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef PPL_globals_defs_hh
00024 #define PPL_globals_defs_hh 1
00025
00026 #include "globals.types.hh"
00027 #include "Coefficient.defs.hh"
00028 #include <exception>
00029
00030 namespace Parma_Polyhedra_Library {
00031
00033 dimension_type
00034 not_a_dimension();
00035
00036 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00038
00039 // FIXME: rewrite the comment.
00040 #endif // PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00041 class Coefficient_free_list_element {
00042 private:
00043 Coefficient i;
00044 Coefficient_free_list_element* p;
00045
00046 public:
00047 Coefficient_free_list_element()
00048 : i() {
00049 }
00050
00051 Coefficient& integer() {
00052 return i;
00053 }
00054
00055 Coefficient_free_list_element*& next() {
00056 return p;
00057 }
00058 };
00059
00060 extern Coefficient_free_list_element* Coefficient_free_list_first;
00061
00062 inline Coefficient&
00063 get_tmp_Coefficient() {
00064 Coefficient* p;
00065 if (Coefficient_free_list_first != 0) {
00066 p = &Coefficient_free_list_first->integer();
00067 Coefficient_free_list_first = Coefficient_free_list_first->next();
00068 }
00069 else
00070 p = reinterpret_cast<Coefficient*>(new Coefficient_free_list_element());
00071 return *p;
00072 }
00073
00074 inline void
00075 release_tmp_Coefficient(Coefficient& i) {
00076 Coefficient_free_list_element& e
00077 = reinterpret_cast<Coefficient_free_list_element&>(i);
00078 e.next() = Coefficient_free_list_first;
00079 Coefficient_free_list_first = &e;
00080 }
00081
00082 class Temp_Coefficient_Holder {
00083 private:
00084 Coefficient& hold;
00085
00086 public:
00087 Temp_Coefficient_Holder(Coefficient& i)
00088 : hold(i) {
00089 }
00090 ~Temp_Coefficient_Holder() {
00091 release_tmp_Coefficient(hold);
00092 }
00093 };
00094
00095 #if 1
00096 #define TEMP_INTEGER(id) \
00097 Coefficient& id = get_tmp_Coefficient(); \
00098 Temp_Coefficient_Holder temp_Coefficient_holder_ ## id = (id)
00099 #else
00100 #define TEMP_INTEGER(id) static Coefficient id
00101 #endif
00102
00103 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00105
00122 #endif // PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00123 dimension_type
00124 compute_capacity(dimension_type requested_size,
00125 dimension_type maximum_size);
00126
00128
00133 class Throwable {
00134 public:
00136 virtual void throw_me() const = 0;
00137
00139 virtual ~Throwable();
00140 };
00141
00165 extern const Throwable* volatile abandon_expensive_computations;
00166
00167 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00168
00174 #endif
00175 void
00176 maybe_abandon();
00177
00179
00183 struct From_Bounding_Box {
00184 };
00185
00187
00190 struct From_Covering_Box {
00191 };
00192
00193 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00194
00202 #endif
00203 void
00204 normalize2(Coefficient_traits::const_reference x,
00205 Coefficient_traits::const_reference y,
00206 Coefficient& nx, Coefficient& ny);
00207
00208 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00210 #endif
00211 template <typename T>
00212 T low_bits_mask(unsigned n);
00213
00214
00215 #define PPL_STR(s) #s
00216
00217 #define PPL_XSTR(s) PPL_STR(s)
00218
00219 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00220 #define PPL_OUTPUT_DECLARATIONS \
00221 \
00222 void ascii_dump() const; \
00223 \
00224 void ascii_dump(std::ostream& s) const; \
00225 \
00226 void print() const;
00227 #else
00228 #define PPL_OUTPUT_DECLARATIONS \
00229 void ascii_dump() const; \
00230 void ascii_dump(std::ostream& s) const; \
00231 void print() const;
00232 #endif // PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00233
00234 #define PPL_OUTPUT_DEFINITIONS(class_name) \
00235 void \
00236 Parma_Polyhedra_Library::class_name::ascii_dump() const { \
00237 ascii_dump(std::cerr); \
00238 } \
00239 \
00240 void \
00241 Parma_Polyhedra_Library::class_name::print() const { \
00242 using namespace IO_Operators; \
00243 std::cerr << *this; \
00244 }
00245
00246 #define PPL_OUTPUT_DEFINITIONS_ASCII_ONLY(class_name) \
00247 void \
00248 Parma_Polyhedra_Library::class_name::ascii_dump() const { \
00249 ascii_dump(std::cerr); \
00250 } \
00251 \
00252 void \
00253 Parma_Polyhedra_Library::class_name::print() const { \
00254 std::cerr << "No user level output operator defined " \
00255 << "for class " PPL_XSTR(class_name) << "." << std::endl; \
00256 }
00257
00258 #define PPL_OUTPUT_TEMPLATE_DEFINITIONS(type_symbol, class_prefix) \
00259 template <typename type_symbol> \
00260 void \
00261 class_prefix::ascii_dump() const { \
00262 ascii_dump(std::cerr); \
00263 } \
00264 \
00265 template <typename type_symbol> \
00266 void \
00267 class_prefix::print() const { \
00268 using namespace IO_Operators; \
00269 std::cerr << *this; \
00270 }
00271
00272 #define PPL_OUTPUT_TEMPLATE_DEFINITIONS_ASCII_ONLY(type_symbol, class_prefix) \
00273 template <typename type_symbol> \
00274 void \
00275 class_prefix::ascii_dump() const { \
00276 ascii_dump(std::cerr); \
00277 } \
00278 \
00279 template <typename type_symbol> \
00280 void \
00281 class_prefix::print() const { \
00282 std::cerr << "No user level output operator defined " \
00283 << "for " PPL_XSTR(class_prefix) << "." << std::endl; \
00284 }
00285
00286 }
00287
00288 #include "globals.inlines.hh"
00289
00290 #endif // !defined(PPL_globals_defs_hh)