1 // Concrete class of single float numbers.
3 #ifndef _CL_FFLOAT_CLASS_H
4 #define _CL_FFLOAT_CLASS_H
6 #include "cln/number.h"
7 #include "cln/float_class.h"
11 class cl_FF : public cl_F {
13 // Default constructor.
15 // Assignment operators.
16 cl_FF& operator= (const cl_FF&);
17 // Optimization of method pointer_p().
18 bool pointer_p() const
19 #if defined(CL_WIDE_POINTERS)
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.
28 cl_FF& operator= (const float);
29 // Other constructors.
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);
36 cl_FF (struct cl_heap_ffloat *);
37 // Private pointer manipulations.
38 operator struct cl_heap_ffloat * () const;
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, void* ptr) { (void)size; return ptr; }
43 void operator delete (void* ptr) { free_hook(ptr); }
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)) {}
55 // Private pointer manipulations. Never throw away a `struct cl_heap_ffloat *'!
56 inline cl_FF::operator struct cl_heap_ffloat * () const
58 struct cl_heap_ffloat * hpointer = (struct cl_heap_ffloat *) pointer;
59 cl_inc_refcount(*this);
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)
67 inline cl_FF::cl_FF (struct cl_heap_ffloat * ptr)
68 : cl_F ((cl_private_thing) ptr) {}
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)
78 #endif /* _CL_FFLOAT_CLASS_H */