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
9namespace cln {
10
11class cl_FF : public cl_F {
12public:
13// Default constructor.
14 cl_FF ();
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)
20 { return false; }
21#else
22 { return 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
40public: // 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); }
44};
45
46// Private constructors.
47inline cl_FF::cl_FF (cl_private_thing ptr) : cl_F (ptr) {}
48// The assignment operators:
49CL_DEFINE_ASSIGNMENT_OPERATOR(cl_FF, cl_FF)
50// The default constructors.
51#if defined(CL_WIDE_POINTERS)
52inline 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 *'!
56inline 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}
62extern const cl_FF cl_FF_0;
63inline cl_FF::cl_FF ()
64 : cl_F ((cl_private_thing) (struct cl_heap_ffloat *) cl_FF_0) {}
65class cl_FF_globals_init_helper
66{
67 static int count;
68public:
69 cl_FF_globals_init_helper();
70 ~cl_FF_globals_init_helper();
71};
72static cl_FF_globals_init_helper cl_FF_globals_init_helper_instance;
73#if 0 // see cl_FF.h
74inline cl_FF::cl_FF (struct cl_heap_ffloat * ptr)
75 : cl_F ((cl_private_thing) ptr) {}
76#endif
77#endif
78// The copy constructors.
79CL_DEFINE_COPY_CONSTRUCTOR2(cl_FF,cl_F)
80// Constructors and assignment operators from C numeric types.
81CL_DEFINE_FLOAT_CONSTRUCTOR(cl_FF)
82
83} // namespace cln
84
85#endif /* _CL_FFLOAT_CLASS_H */
86