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