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