]> www.ginac.de Git - cln.git/blob - include/cln/dfloat_class.h
* All Files have been modified for inclusion of namespace cln;
[cln.git] / include / cln / 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 "cln/number.h"
7 #include "cln/float_class.h"
8
9 namespace cln {
10
11 class cl_DF : public cl_F {
12 public:
13 // Default constructor.
14         cl_DF ();
15 // Assignment operators.
16         cl_DF& operator= (const cl_DF&);
17 // Optimization of method pointer_p().
18         cl_boolean pointer_p() const
19                 { return cl_true; }
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.
23         cl_DF (const double);
24         cl_DF& operator= (const double);
25 // Other constructors.
26         cl_DF (const char *);
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, cl_DF* ptr) { (void)size; return ptr; }
35         void operator delete (void* ptr) { free_hook(ptr); }
36 private:
37 // Friend declarations. They are for the compiler. Just ignore them.
38 };
39
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
47 {
48         struct cl_heap_dfloat * hpointer = (struct cl_heap_dfloat *) pointer;
49         cl_inc_refcount(*this);
50         return hpointer;
51 }
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 CL_REQUIRE(cl_DF_globals)
56 #if 0 // see cl_DF.h
57 inline cl_DF::cl_DF (struct cl_heap_dfloat * ptr)
58         : cl_F ((cl_private_thing) ptr) {}
59 #endif
60 // The copy constructors.
61 CL_DEFINE_COPY_CONSTRUCTOR2(cl_DF,cl_F)
62 // Constructors and assignment operators from C numeric types.
63 CL_DEFINE_DOUBLE_CONSTRUCTOR(cl_DF)
64
65 }  // namespace cln
66
67 #endif /* _CL_DFLOAT_CLASS_H */