]> www.ginac.de Git - cln.git/blob - include/cln/real_class.h
Ensure that makeinfo ≥ 6.8 checks the @menu structure.
[cln.git] / include / cln / real_class.h
1 // Abstract class of real numbers.
2
3 #ifndef _CL_REAL_CLASS_H
4 #define _CL_REAL_CLASS_H
5
6 #include "cln/number.h"
7 #include "cln/complex_class.h"
8
9 namespace cln {
10
11 class cl_R : public cl_N {
12 public:
13 // Default constructor.
14         cl_R ();
15 // Copy constructor.
16         cl_R (const cl_R&);
17 // Converters.
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
23         cl_R (const long);
24         cl_R (const unsigned long);
25         cl_R (const long long);
26         cl_R (const unsigned long long);
27         cl_R (const float);
28         cl_R (const double);
29         cl_R& operator= (const int);            // |argument| must be < 2^29
30         cl_R& operator= (const unsigned int);   // argument must be < 2^29
31         cl_R& operator= (const long);
32         cl_R& operator= (const unsigned long);
33         cl_R& operator= (const float);
34         cl_R& operator= (const double);
35         cl_R& operator= (const long long);
36         cl_R& operator= (const unsigned long long);
37 // Other constructors.
38         cl_R (const char *);
39 // Private constructor.
40         cl_R (cl_private_thing);
41 public: // Ability to place an object at a given address.
42         void* operator new (size_t size) { return malloc_hook(size); }
43         void* operator new (size_t size, void* ptr) { (void)size; return ptr; }
44         void operator delete (void* ptr) { free_hook(ptr); }
45 private:
46 // Friend declarations. They are for the compiler. Just ignore them.
47 };
48
49 // Private constructors.
50 inline cl_R::cl_R (cl_private_thing ptr) : cl_N (ptr) {}
51 // The assignment operators:
52 CL_DEFINE_ASSIGNMENT_OPERATOR(cl_R, cl_R)
53 // The default constructors.
54 inline cl_R::cl_R ()
55         : cl_N ((cl_private_thing) cl_combine(cl_FN_tag,0)) {}
56 // The copy constructors.
57 CL_DEFINE_COPY_CONSTRUCTOR2(cl_R,cl_N)
58 // Constructors and assignment operators from C numeric types.
59 CL_DEFINE_INT_CONSTRUCTORS(cl_R)
60 CL_DEFINE_INT_ASSIGNMENT_OPERATORS(cl_R)
61 CL_DEFINE_LONG_CONSTRUCTORS(cl_R)
62 CL_DEFINE_LONG_ASSIGNMENT_OPERATORS(cl_R)
63 CL_DEFINE_LONGLONG_CONSTRUCTORS(cl_R)
64 CL_DEFINE_LONGLONG_ASSIGNMENT_OPERATORS(cl_R)
65 CL_DEFINE_FLOAT_CONSTRUCTOR(cl_R)
66 CL_DEFINE_DOUBLE_CONSTRUCTOR(cl_R)
67
68 }  // namespace cln
69
70 #endif /* _CL_REAL_CLASS_H */