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