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);
26 cl_R (const long long);
27 cl_R (const unsigned long long);
31 cl_R& operator= (const int); // |argument| must be < 2^29
32 cl_R& operator= (const unsigned int); // argument must be < 2^29
33 cl_R& operator= (const long);
34 cl_R& operator= (const unsigned long);
35 cl_R& operator= (const float);
36 cl_R& operator= (const double);
38 cl_R& operator= (const long long);
39 cl_R& operator= (const unsigned long long);
41 // Other constructors.
43 // Private constructor.
44 cl_R (cl_private_thing);
45 public: // Ability to place an object at a given address.
46 void* operator new (size_t size) { return malloc_hook(size); }
47 void* operator new (size_t size, void* ptr) { (void)size; return ptr; }
48 void operator delete (void* ptr) { free_hook(ptr); }
50 // Friend declarations. They are for the compiler. Just ignore them.
53 // Private constructors.
54 inline cl_R::cl_R (cl_private_thing ptr) : cl_N (ptr) {}
55 // The assignment operators:
56 CL_DEFINE_ASSIGNMENT_OPERATOR(cl_R, cl_R)
57 // The default constructors.
59 : cl_N ((cl_private_thing) cl_combine(cl_FN_tag,0)) {}
60 // The copy constructors.
61 CL_DEFINE_COPY_CONSTRUCTOR2(cl_R,cl_N)
62 // Constructors and assignment operators from C numeric types.
63 CL_DEFINE_INT_CONSTRUCTORS(cl_R)
64 CL_DEFINE_INT_ASSIGNMENT_OPERATORS(cl_R)
65 CL_DEFINE_LONG_CONSTRUCTORS(cl_R)
66 CL_DEFINE_LONG_ASSIGNMENT_OPERATORS(cl_R)
68 CL_DEFINE_LONGLONG_CONSTRUCTORS(cl_R)
69 CL_DEFINE_LONGLONG_ASSIGNMENT_OPERATORS(cl_R)
71 CL_DEFINE_FLOAT_CONSTRUCTOR(cl_R)
72 CL_DEFINE_DOUBLE_CONSTRUCTOR(cl_R)
76 #endif /* _CL_REAL_CLASS_H */