]> www.ginac.de Git - cln.git/blob - include/cln/complex_class.h
Make @exec_prefix@ usable in shell scripts.
[cln.git] / include / cln / complex_class.h
1 // Abstract class of complex numbers.
2
3 #ifndef _CL_COMPLEX_CLASS_H
4 #define _CL_COMPLEX_CLASS_H
5
6 #include "cln/number.h"
7
8 namespace cln {
9
10 class cl_N : public cl_number {
11 public:
12 // Default constructor.
13         cl_N ();
14 // Copy constructor.
15         cl_N (const cl_N&);
16 // Converters.
17 // Assignment operators.
18         cl_N& operator= (const cl_N&);
19 // Constructors and assignment operators from C numeric types.
20         cl_N (const int);               // |argument| must be < 2^29
21         cl_N (const unsigned int);      // argument must be < 2^29
22         cl_N (const long);
23         cl_N (const unsigned long);
24         cl_N (const float);
25         cl_N (const double);
26         cl_N& operator= (const int);            // |argument| must be < 2^29
27         cl_N& operator= (const unsigned int);   // argument must be < 2^29
28         cl_N& operator= (const long);
29         cl_N& operator= (const unsigned long);
30         cl_N& operator= (const float);
31         cl_N& operator= (const double);
32 // Other constructors.
33         cl_N (const char *);
34 // Private constructor.
35         cl_N (cl_private_thing);
36         cl_N (struct cl_heap_complex *);
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_N* 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_N::cl_N (cl_private_thing ptr) : cl_number (ptr) {}
47 // The assignment operators:
48 CL_DEFINE_ASSIGNMENT_OPERATOR(cl_N, cl_N)
49 // The default constructors.
50 inline cl_N::cl_N ()
51         : cl_number ((cl_private_thing) cl_combine(cl_FN_tag,0)) {}
52 // The copy constructors.
53 CL_DEFINE_COPY_CONSTRUCTOR2(cl_N,cl_number)
54 // Constructors and assignment operators from C numeric types.
55 CL_DEFINE_INT_CONSTRUCTORS(cl_N)
56 CL_DEFINE_INT_ASSIGNMENT_OPERATORS(cl_N)
57 CL_DEFINE_LONG_CONSTRUCTORS(cl_N)
58 CL_DEFINE_LONG_ASSIGNMENT_OPERATORS(cl_N)
59 // Constructors and assignment operators from C numeric types.
60 CL_DEFINE_FLOAT_CONSTRUCTOR(cl_N)
61 CL_DEFINE_DOUBLE_CONSTRUCTOR(cl_N)
62
63 }  // namespace cln
64
65 #endif /* _CL_COMPLEX_CLASS_H */