1 // Concrete class of double float numbers.
3 #ifndef _CL_DFLOAT_CLASS_H
4 #define _CL_DFLOAT_CLASS_H
6 #include "cln/number.h"
7 #include "cln/float_class.h"
11 class cl_DF : public cl_F {
13 // Default constructor.
15 // Assignment operators.
16 cl_DF& operator= (const cl_DF&);
17 // Optimization of method pointer_p().
18 bool pointer_p() const
20 // Faster pointer_p() gives a faster copy constructor (but not destructor!!!).
21 cl_DF (const cl_DF& x);
22 // Constructors and assignment operators from C numeric types.
24 cl_DF& operator= (const double);
25 // Other constructors.
27 // Private constructor.
28 cl_DF (cl_private_thing);
29 cl_DF (struct cl_heap_dfloat *);
30 // Private pointer manipulations.
31 operator struct cl_heap_dfloat * () const;
32 public: // Ability to place an object at a given address.
33 void* operator new (size_t size) { return malloc_hook(size); }
34 void* operator new (size_t size, void* ptr) { (void)size; return ptr; }
35 void operator delete (void* ptr) { free_hook(ptr); }
37 // Friend declarations. They are for the compiler. Just ignore them.
40 // Private constructors.
41 inline cl_DF::cl_DF (cl_private_thing ptr) : cl_F (ptr) {}
42 // The assignment operators:
43 CL_DEFINE_ASSIGNMENT_OPERATOR(cl_DF, cl_DF)
44 // The default constructors.
45 // Private pointer manipulations. Never throw away a `struct cl_heap_dfloat *'!
46 inline cl_DF::operator struct cl_heap_dfloat * () const
48 struct cl_heap_dfloat * hpointer = (struct cl_heap_dfloat *) pointer;
49 cl_inc_refcount(*this);
52 extern const cl_DF cl_DF_0;
53 inline cl_DF::cl_DF ()
54 : cl_F ((cl_private_thing) (struct cl_heap_dfloat *) cl_DF_0) {}
55 class cl_DF_globals_init_helper
59 cl_DF_globals_init_helper();
60 ~cl_DF_globals_init_helper();
62 static cl_DF_globals_init_helper cl_DF_globals_init_helper_instance;
65 inline cl_DF::cl_DF (struct cl_heap_dfloat * ptr)
66 : cl_F ((cl_private_thing) ptr) {}
68 // The copy constructors.
69 CL_DEFINE_COPY_CONSTRUCTOR2(cl_DF,cl_F)
70 // Constructors and assignment operators from C numeric types.
71 CL_DEFINE_DOUBLE_CONSTRUCTOR(cl_DF)
75 #endif /* _CL_DFLOAT_CLASS_H */