1 // Abstract class of complex numbers.
3 #ifndef _CL_COMPLEX_CLASS_H
4 #define _CL_COMPLEX_CLASS_H
6 #include "cln/number.h"
10 class cl_N : public cl_number {
12 // Default constructor.
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
23 cl_N (const unsigned long);
25 cl_N (const long long);
26 cl_N (const unsigned long long);
30 cl_N& operator= (const int); // |argument| must be < 2^29
31 cl_N& operator= (const unsigned int); // argument must be < 2^29
32 cl_N& operator= (const long);
33 cl_N& operator= (const unsigned long);
34 cl_N& operator= (const float);
35 cl_N& operator= (const double);
37 cl_N& operator= (const long long);
38 cl_N& operator= (const unsigned long long);
40 // Other constructors.
42 // Private constructor.
43 cl_N (cl_private_thing);
44 cl_N (struct cl_heap_complex *);
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_N::cl_N (cl_private_thing ptr) : cl_number (ptr) {}
55 // The assignment operators:
56 CL_DEFINE_ASSIGNMENT_OPERATOR(cl_N, cl_N)
57 // The default constructors.
59 : cl_number ((cl_private_thing) cl_combine(cl_FN_tag,0)) {}
60 // The copy constructors.
61 CL_DEFINE_COPY_CONSTRUCTOR2(cl_N,cl_number)
62 // Constructors and assignment operators from C numeric types.
63 CL_DEFINE_INT_CONSTRUCTORS(cl_N)
64 CL_DEFINE_INT_ASSIGNMENT_OPERATORS(cl_N)
65 CL_DEFINE_LONG_CONSTRUCTORS(cl_N)
66 CL_DEFINE_LONG_ASSIGNMENT_OPERATORS(cl_N)
68 CL_DEFINE_LONGLONG_CONSTRUCTORS(cl_N)
69 CL_DEFINE_LONGLONG_ASSIGNMENT_OPERATORS(cl_N)
71 CL_DEFINE_FLOAT_CONSTRUCTOR(cl_N)
72 CL_DEFINE_DOUBLE_CONSTRUCTOR(cl_N)
76 #endif /* _CL_COMPLEX_CLASS_H */