#include <Init.defs.hh>
Public Member Functions | |
Init () | |
Initializes the PPL. | |
~Init () | |
Finalizes the PPL. | |
Static Private Attributes | |
static unsigned int | count = 0 |
Count the number of objects created. | |
static fpu_rounding_direction_type | old_rounding_direction |
Nifty Counter initialization class, ensuring that the library is initialized only once and before its first use. A count of the number of translation units using the library is maintained. A static object of Init type will be declared by each translation unit using the library. As a result, only one of them will initialize and properly finalize the library.
Definition at line 43 of file Init.defs.hh.
Parma_Polyhedra_Library::Init::Init | ( | ) |
Initializes the PPL.
Definition at line 48 of file Init.cc.
References count, Parma_Polyhedra_Library::Variable::default_output_function(), old_rounding_direction, set_GMP_memory_allocation_functions(), Parma_Polyhedra_Library::Variable::set_output_function(), and Parma_Polyhedra_Library::set_rational_sqrt_precision_parameter().
00048 { 00049 // Only when the first Init object is constructed... 00050 if (count++ == 0) { 00051 // ... the GMP memory allocation functions are set, ... 00052 set_GMP_memory_allocation_functions(); 00053 // ... and the default output function for Variable objects is set. 00054 Variable::set_output_function(Variable::default_output_function); 00055 #if PPL_CAN_CONTROL_FPU 00056 old_rounding_direction = fpu_get_rounding_direction(); 00057 fpu_set_rounding_direction(ROUND_DIRECT); 00058 #endif 00059 // FIXME: is 3200 a magic number? 00060 set_rational_sqrt_precision_parameter(3200); 00061 } 00062 }
Parma_Polyhedra_Library::Init::~Init | ( | ) |
Finalizes the PPL.
Definition at line 64 of file Init.cc.
References count, and old_rounding_direction.
00064 { 00065 // Only when the last Init object is destroyed... 00066 if (--count == 0) { 00067 #if PPL_CAN_CONTROL_FPU 00068 fpu_set_rounding_direction(old_rounding_direction); 00069 #endif 00070 } 00071 }
unsigned int Parma_Polyhedra_Library::Init::count = 0 [static, private] |
PPL::fpu_rounding_direction_type Parma_Polyhedra_Library::Init::old_rounding_direction [static, private] |