1 // Abstract class of floating-point numbers.
3 #ifndef _CL_FLOAT_CLASS_H
4 #define _CL_FLOAT_CLASS_H
6 #include "cln/number.h"
7 #include "cln/real_class.h"
11 class cl_F : public cl_R {
13 // Default constructor.
18 // Assignment operators.
19 cl_F& operator= (const cl_F&);
20 // Constructors and assignment operators from C numeric types.
23 cl_F& operator= (const float);
24 cl_F& operator= (const double);
25 // Other constructors.
27 // Private constructor.
28 cl_F (cl_private_thing);
29 public: // Ability to place an object at a given address.
30 void* operator new (size_t size) { return malloc_hook(size); }
31 void* operator new (size_t size, void* ptr) { (void)size; return ptr; }
32 void operator delete (void* ptr) { free_hook(ptr); }
34 // Friend declarations. They are for the compiler. Just ignore them.
37 // Private constructors.
38 inline cl_F::cl_F (cl_private_thing ptr) : cl_R (ptr) {}
39 // The assignment operators:
40 CL_DEFINE_ASSIGNMENT_OPERATOR(cl_F, cl_F)
41 // The default constructors.
43 : cl_R ((cl_private_thing) cl_combine(cl_SF_tag,0)) {}
44 // The copy constructors.
45 CL_DEFINE_COPY_CONSTRUCTOR2(cl_F,cl_R)
46 // Constructors and assignment operators from C numeric types.
47 CL_DEFINE_FLOAT_CONSTRUCTOR(cl_F)
48 CL_DEFINE_DOUBLE_CONSTRUCTOR(cl_F)
52 #endif /* _CL_FLOAT_CLASS_H */