More CGAL_STATIC_THREAD_LOCAL_VARIABLE

This commit is contained in:
Andreas Fabri 2018-02-20 11:22:32 +00:00
parent d5523f80c0
commit faa2866763
5 changed files with 29 additions and 23 deletions

View File

@ -36,6 +36,7 @@
#include <CGAL/config.h>
#include <CGAL/tags.h>
#include <CGAL/tss.h>
#include <CGAL/intersections.h>
#include <CGAL/Arr_tags.h>
#include <CGAL/Arr_enums.h>
@ -93,7 +94,7 @@ protected:
*/
inline static const Direction_3& pos_pole()
{
static const Direction_3 d(0, 0, 1);
CGAL_STATIC_THREAD_LOCAL_VARIABLE_3(Direction_3, d, 0, 0, 1);
return d;
}
@ -135,11 +136,11 @@ protected:
inline static const Direction_3& identification_normal()
{
#if (CGAL_IDENTIFICATION_XY == CGAL_X_MINUS_1_Y_0)
static const Direction_3 d(0, 1, 0);
CGAL_STATIC_THREAD_LOCAL_VARIABLE_3(Direction_3, d, 0, 1, 0);
#elif (CGAL_IDENTIFICATION_XY == CGAL_X_MINUS_8_Y_6)
static const Direction_3 d(6, 8, 0);
CGAL_STATIC_THREAD_LOCAL_VARIABLE_3(Direction_3, d, 6, 8, 0);
#elif (CGAL_IDENTIFICATION_XY == CGAL_X_MINUS_11_Y_7)
static const Direction_3 d(7, 11, 0);
CGAL_STATIC_THREAD_LOCAL_VARIABLE_3(Direction_3, d,7, 11, 0);
#else
#error CGAL_IDENTIFICATION_XY is not defined
#endif
@ -151,7 +152,7 @@ protected:
*/
inline static const Direction_2& neg_x_2()
{
static const Direction_2 d(-1, 0);
CGAL_STATIC_THREAD_LOCAL_VARIABLE_2(Direction_2, d, -1, 0);
return d;
}
@ -160,7 +161,7 @@ protected:
*/
inline static const Direction_2& neg_y_2()
{
static const Direction_2 d(0, -1);
CGAL_STATIC_THREAD_LOCAL_VARIABLE_2(Direction_2, d, 0, -1);
return d;
}

View File

@ -26,6 +26,7 @@
#include <ostream>
#include <CGAL/tss.h>
#include <CGAL/Arr_rat_arc/Base_rational_arc_ds_1.h>
#include <CGAL/Arr_rat_arc/Cache.h>
@ -349,15 +350,15 @@ public:
private:
static Self& get_default_instance()
{
static Algebraic_kernel_d_1 kernel;
static typename Rational_function::Polynomial_1 numer(0);
static typename Rational_function::Polynomial_1 denom(1);
static Rational_function rational_function(numer, denom, &kernel);
CGAL_STATIC_THREAD_LOCAL_VARIABLE_0(Algebraic_kernel_d_1, kernel);
typedef typename Rational_function::Polynomial_1 Poly;
CGAL_STATIC_THREAD_LOCAL_VARIABLE(Poly, numer,0);
CGAL_STATIC_THREAD_LOCAL_VARIABLE(Poly, denom, 1);
CGAL_STATIC_THREAD_LOCAL_VARIABLE_3(Rational_function, rational_function, numer, denom, &kernel);
static Algebraic_real_1 x_coordinate =
kernel.construct_algebraic_real_1_object()(Rational(0));
CGAL_STATIC_THREAD_LOCAL_VARIABLE(Algebraic_real_1, x_coordinate,kernel.construct_algebraic_real_1_object()(Rational(0)));
static Self default_instance(rational_function,x_coordinate);
CGAL_STATIC_THREAD_LOCAL_VARIABLE_2(Self, default_instance, rational_function, x_coordinate);
return default_instance;

View File

@ -25,6 +25,7 @@
#include <CGAL/license/Arrangement_on_surface_2.h>
#include <CGAL/tss.h>
#include <CGAL/Arr_rat_arc/Base_rational_arc_ds_1.h>
#include <CGAL/Handle_with_policy.h>
namespace CGAL {
@ -213,8 +214,8 @@ public:
private:
static Self& get_default_instance()
{
static Algebraic_kernel_d_1 kernel;
static Self x = Self(Polynomial_1(0), Polynomial_1(1), &kernel);
CGAL_STATIC_THREAD_LOCAL_VARIABLE_0(Algebraic_kernel_d_1, kernel);
CGAL_STATIC_THREAD_LOCAL_VARIABLE_3(Self, x, Polynomial_1(0), Polynomial_1(1), &kernel);
return x;
}
public:

View File

@ -67,12 +67,14 @@
#define STILL_ALIVE std::cout << __LINE__ << "\n";
#include <CGAL/basic.h>
#include <CGAL/tss.h>
#include <CGAL/Bbox_2.h>
#include <CGAL/Arithmetic_kernel.h>
#include <boost/array.hpp>
#include <CGAL/Curved_kernel_via_analysis_2/gfx/Curve_renderer_2.h>
namespace CGAL {
template <class CurvedKernelViaAnalysis_2, class Float_>
@ -98,7 +100,7 @@ public:
Interval_double > Curve_renderer;
static Curve_renderer& instance() {
static Curve_renderer _this;
CGAL_STATIC_THREAD_LOCAL_VARIABLE_0(Curve_renderer, _this);
return _this;
}
@ -177,20 +179,20 @@ public:
#ifdef CGAL_CKVA_USE_STATIC_RENDERER
static Default_renderer_2& renderer()
{
static Default_renderer_2 rend;
CGAL_STATIC_THREAD_LOCAL_VARIABLE_0(Default_renderer_2, rend);
return rend;
}
#ifdef CGAL_CKVA_USE_MULTIPREC_ARITHMETIC
static Bigfloat_renderer_2& bigfloat_renderer()
{
static Bigfloat_renderer_2 rend;
CGAL_STATIC_THREAD_LOCAL_VARIABLE_0(Bigfloat_renderer_2, rend);
return rend;
}
#endif
#ifdef CGAL_CKVA_USE_RATIONAL_ARITHMETIC
static Exact_renderer_2& exact_renderer()
{
static Exact_renderer_2 rend;
CGAL_STATIC_THREAD_LOCAL_VARIABLE_0(Exact_renderer_2, rend);
return rend;
}
#endif

View File

@ -31,6 +31,7 @@
#include <CGAL/config.h>
#include <CGAL/tss.h>
#include <CGAL/Arr_enums.h>
#include <CGAL/Arr_tags.h>
#include <CGAL/Curved_kernel_via_analysis_2/Point_2.h>
@ -185,8 +186,8 @@ public:
static NewCKvA& set_instance(
const NewCKvA& ckva
) {
static NewCKvA instance;
static NewCKvA binstance;
CGAL_STATIC_THREAD_LOCAL_VARIABLE_0(NewCKvA, instance);
CGAL_STATIC_THREAD_LOCAL_VARIABLE_0(NewCKvA, binstance);
if (&ckva == &_reset_instance()) {
instance = binstance;
@ -210,7 +211,7 @@ private:
* sets instance to default for internal purposes
*/
static NewCKvA& _set_instance() {
static NewCKvA instance;
CGAL_STATIC_THREAD_LOCAL_VARIABLE_0(NewCKvA, instance);
return instance;
}
@ -219,7 +220,7 @@ private:
* sets instance to default for internal purposes
*/
static NewCKvA& _reset_instance() {
static NewCKvA instance;
CGAL_STATIC_THREAD_LOCAL_VARIABLE_0(NewCKvA, instance);
return instance;
}