]> www.ginac.de Git - cln.git/blob - include/cln/integer_class.h
Make @exec_prefix@ usable in shell scripts.
[cln.git] / include / cln / integer_class.h
1 // Abstract class of integers.
2
3 #ifndef _CL_INTEGER_CLASS_H
4 #define _CL_INTEGER_CLASS_H
5
6 #include "cln/number.h"
7 #include "cln/rational_class.h"
8
9 namespace cln {
10
11 class cl_I : public cl_RA {
12 public:
13 // Default constructor.
14         cl_I ();
15 // Copy constructor.
16         cl_I (const cl_I&);
17 // Assignment operators.
18         cl_I& operator= (const cl_I&);
19 // Constructors and assignment operators from C numeric types.
20         cl_I (const int);               // |argument| must be < 2^29
21         cl_I (const unsigned int);      // argument must be < 2^29
22         cl_I (const long);
23         cl_I (const unsigned long);
24         cl_I& operator= (const int);            // |argument| must be < 2^29
25         cl_I& operator= (const unsigned int);   // argument must be < 2^29
26         cl_I& operator= (const long);
27         cl_I& operator= (const unsigned long);
28 // Other constructors.
29         cl_I (const char *);
30 // Private constructor.
31         cl_I (cl_private_thing);
32         cl_I (struct cl_fixnum * /* NULL! */, cl_uint);
33         cl_I (struct cl_heap_bignum *);
34 public: // Ability to place an object at a given address.
35         void* operator new (size_t size) { return malloc_hook(size); }
36         void* operator new (size_t size, cl_I* ptr) { (void)size; return ptr; }
37         void operator delete (void* ptr) { free_hook(ptr); }
38 };
39
40 // Private constructors.
41 inline cl_I::cl_I (cl_private_thing ptr) : cl_RA (ptr) {}
42 // The assignment operators:
43 CL_DEFINE_ASSIGNMENT_OPERATOR(cl_I, cl_I)
44 // The default constructors.
45 inline cl_I::cl_I ()
46         : cl_RA ((cl_private_thing) cl_combine(cl_FN_tag,0)) {}
47 // The copy constructors.
48 CL_DEFINE_COPY_CONSTRUCTOR2(cl_I,cl_RA)
49 // Constructors and assignment operators from C numeric types.
50 CL_DEFINE_INT_CONSTRUCTORS(cl_I)
51 CL_DEFINE_INT_ASSIGNMENT_OPERATORS(cl_I)
52 CL_DEFINE_LONG_CONSTRUCTORS(cl_I)
53 CL_DEFINE_LONG_ASSIGNMENT_OPERATORS(cl_I)
54
55 }  // namespace cln
56
57 #endif /* _CL_INTEGER_CLASS_H */