1 // Abstract class of real numbers.
3 #ifndef _CL_REAL_CLASS_H
4 #define _CL_REAL_CLASS_H
6 #include "cln/number.h"
7 #include "cln/complex_class.h"
11 class cl_R : public cl_N {
13 // Default constructor.
18 // Assignment operators.
19 cl_R& operator= (const cl_R&);
20 // Constructors and assignment operators from C numeric types.
21 cl_R (const int); // |argument| must be < 2^29
22 cl_R (const unsigned int); // argument must be < 2^29
24 cl_R (const unsigned long);
27 cl_R& operator= (const int); // |argument| must be < 2^29
28 cl_R& operator= (const unsigned int); // argument must be < 2^29
29 cl_R& operator= (const long);
30 cl_R& operator= (const unsigned long);
31 cl_R& operator= (const float);
32 cl_R& operator= (const double);
33 // Other constructors.
35 // Private constructor.
36 cl_R (cl_private_thing);
37 public: // Ability to place an object at a given address.
38 void* operator new (size_t size) { return malloc_hook(size); }
39 void* operator new (size_t size, void* ptr) { (void)size; return ptr; }
40 void operator delete (void* ptr) { free_hook(ptr); }
42 // Friend declarations. They are for the compiler. Just ignore them.
45 // Private constructors.
46 inline cl_R::cl_R (cl_private_thing ptr) : cl_N (ptr) {}
47 // The assignment operators:
48 CL_DEFINE_ASSIGNMENT_OPERATOR(cl_R, cl_R)
49 // The default constructors.
51 : cl_N ((cl_private_thing) cl_combine(cl_FN_tag,0)) {}
52 // The copy constructors.
53 CL_DEFINE_COPY_CONSTRUCTOR2(cl_R,cl_N)
54 // Constructors and assignment operators from C numeric types.
55 CL_DEFINE_INT_CONSTRUCTORS(cl_R)
56 CL_DEFINE_INT_ASSIGNMENT_OPERATORS(cl_R)
57 CL_DEFINE_LONG_CONSTRUCTORS(cl_R)
58 CL_DEFINE_LONG_ASSIGNMENT_OPERATORS(cl_R)
59 CL_DEFINE_FLOAT_CONSTRUCTOR(cl_R)
60 CL_DEFINE_DOUBLE_CONSTRUCTOR(cl_R)
64 #endif /* _CL_REAL_CLASS_H */