Parma_Polyhedra_Library::Init Class Reference
[C++ Language Interface]

Class for initialization and finalization. More...

#include <Init.defs.hh>

List of all members.

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


Detailed Description

Class for initialization and finalization.

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.


Constructor & Destructor Documentation

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 }


Member Data Documentation

unsigned int Parma_Polyhedra_Library::Init::count = 0 [static, private]

Count the number of objects created.

Definition at line 46 of file Init.defs.hh.

Referenced by Init(), and ~Init().

PPL::fpu_rounding_direction_type Parma_Polyhedra_Library::Init::old_rounding_direction [static, private]

Definition at line 47 of file Init.defs.hh.

Referenced by Init(), and ~Init().


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

Generated on Wed Jul 16 22:55:44 2008 for PPL by  doxygen 1.5.6