]> www.ginac.de Git - cln.git/blob - include/cl_dfloat_class.h
Make @exec_prefix@ usable in shell scripts.
[cln.git] / include / cl_dfloat_class.h
1 // Concrete class of double float numbers.
2
3 #ifndef _CL_DFLOAT_CLASS_H
4 #define _CL_DFLOAT_CLASS_H
5
6 #include "cl_number.h"
7 #include "cl_float_class.h"
8
9
10 class cl_DF : public cl_F {
11 public:
12 // Default constructor.
13         cl_DF ();
14 // Assignment operators.
15         cl_DF& operator= (const cl_DF&);
16 // Optimization of method pointer_p().
17         cl_boolean pointer_p() const
18                 { return cl_true; }
19 // Faster pointer_p() gives a faster copy constructor (but not destructor!!!).
20         cl_DF (const cl_DF& x);
21 // Constructors and assignment operators from C numeric types.
22         cl_DF (const double);
23         cl_DF& operator= (const double);
24 // Other constructors.
25         cl_DF (const char *);
26 // Private constructor.
27         cl_DF (cl_private_thing);
28         cl_DF (struct cl_heap_dfloat *);
29 // Private pointer manipulations.
30         operator struct cl_heap_dfloat * () const;
31 public: // Ability to place an object at a given address.
32         void* operator new (size_t size) { return cl_malloc_hook(size); }
33         void* operator new (size_t size, cl_DF* ptr) { (void)size; return ptr; }
34         void operator delete (void* ptr) { cl_free_hook(ptr); }
35 private:
36 // Friend declarations. They are for the compiler. Just ignore them.
37 };
38
39 // Private constructors.
40 inline cl_DF::cl_DF (cl_private_thing ptr) : cl_F (ptr) {}
41 // The assignment operators:
42 CL_DEFINE_ASSIGNMENT_OPERATOR(cl_DF, cl_DF)
43 // The default constructors.
44 // Private pointer manipulations. Never throw away a `struct cl_heap_dfloat *'!
45 inline cl_DF::operator struct cl_heap_dfloat * () const
46 {
47         struct cl_heap_dfloat * hpointer = (struct cl_heap_dfloat *) pointer;
48         cl_inc_refcount(*this);
49         return hpointer;
50 }
51 extern const cl_DF cl_DF_0;
52 inline cl_DF::cl_DF ()
53         : cl_F ((cl_private_thing) (struct cl_heap_dfloat *) cl_DF_0) {}
54 CL_REQUIRE(cl_DF_globals)
55 #if 0 // see cl_DF.h
56 inline cl_DF::cl_DF (struct cl_heap_dfloat * ptr)
57         : cl_F ((cl_private_thing) ptr) {}
58 #endif
59 // The copy constructors.
60 CL_DEFINE_COPY_CONSTRUCTOR2(cl_DF,cl_F)
61 // Constructors and assignment operators from C numeric types.
62 CL_DEFINE_DOUBLE_CONSTRUCTOR(cl_DF)
63
64
65 #endif /* _CL_DFLOAT_CLASS_H */