]> www.ginac.de Git - cln.git/blob - include/cln/real_class.h
Make @exec_prefix@ usable in shell scripts.
[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 float);
26         cl_R (const double);
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.
34         cl_R (const char *);
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, cl_R* ptr) { (void)size; return ptr; }
40         void operator delete (void* ptr) { free_hook(ptr); }
41 private:
42 // Friend declarations. They are for the compiler. Just ignore them.
43 };
44
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.
50 inline cl_R::cl_R ()
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)
61
62 }  // namespace cln
63
64 #endif /* _CL_REAL_CLASS_H */