]> www.ginac.de Git - cln.git/blob - include/cln/ffloat_class.h
Make @exec_prefix@ usable in shell scripts.
[cln.git] / include / cln / ffloat_class.h
1 // Concrete class of single float numbers.
2
3 #ifndef _CL_FFLOAT_CLASS_H
4 #define _CL_FFLOAT_CLASS_H
5
6 #include "cln/number.h"
7 #include "cln/float_class.h"
8
9 namespace cln {
10
11 class cl_FF : public cl_F {
12 public:
13 // Default constructor.
14         cl_FF ();
15 // Assignment operators.
16         cl_FF& operator= (const cl_FF&);
17 // Optimization of method pointer_p().
18         cl_boolean pointer_p() const
19 #if defined(CL_WIDE_POINTERS)
20                 { return cl_false; }
21 #else
22                 { return cl_true; }
23 #endif
24 // Faster pointer_p() gives a faster copy constructor (but not destructor!!!).
25         cl_FF (const cl_FF& x);
26 // Constructors and assignment operators from C numeric types.
27         cl_FF (const float);
28         cl_FF& operator= (const float);
29 // Other constructors.
30         cl_FF (const char *);
31 // Private constructor.
32         cl_FF (cl_private_thing);
33 #if defined(CL_WIDE_POINTERS)
34         cl_FF (struct cl_heap_ffloat * /* NULL! */, cl_uint);
35 #else
36         cl_FF (struct cl_heap_ffloat *);
37 // Private pointer manipulations.
38         operator struct cl_heap_ffloat * () const;
39 #endif
40 public: // Ability to place an object at a given address.
41         void* operator new (size_t size) { return malloc_hook(size); }
42         void* operator new (size_t size, cl_FF* ptr) { (void)size; return ptr; }
43         void operator delete (void* ptr) { free_hook(ptr); }
44 };
45
46 // Private constructors.
47 inline cl_FF::cl_FF (cl_private_thing ptr) : cl_F (ptr) {}
48 // The assignment operators:
49 CL_DEFINE_ASSIGNMENT_OPERATOR(cl_FF, cl_FF)
50 // The default constructors.
51 #if defined(CL_WIDE_POINTERS)
52 inline cl_FF::cl_FF ()
53         : cl_F ((cl_private_thing) cl_combine(cl_FF_tag,0)) {}
54 #else
55 // Private pointer manipulations. Never throw away a `struct cl_heap_ffloat *'!
56 inline cl_FF::operator struct cl_heap_ffloat * () const
57 {
58         struct cl_heap_ffloat * hpointer = (struct cl_heap_ffloat *) pointer;
59         cl_inc_refcount(*this);
60         return hpointer;
61 }
62 extern const cl_FF cl_FF_0;
63 inline cl_FF::cl_FF ()
64         : cl_F ((cl_private_thing) (struct cl_heap_ffloat *) cl_FF_0) {}
65 CL_REQUIRE(cl_FF_globals)
66 #if 0 // see cl_FF.h
67 inline cl_FF::cl_FF (struct cl_heap_ffloat * ptr)
68         : cl_F ((cl_private_thing) ptr) {}
69 #endif
70 #endif
71 // The copy constructors.
72 CL_DEFINE_COPY_CONSTRUCTOR2(cl_FF,cl_F)
73 // Constructors and assignment operators from C numeric types.
74 CL_DEFINE_FLOAT_CONSTRUCTOR(cl_FF)
75
76 }  // namespace cln
77
78 #endif /* _CL_FFLOAT_CLASS_H */