1 // Abstract class of integers.
3 #ifndef _CL_INTEGER_CLASS_H
4 #define _CL_INTEGER_CLASS_H
6 #include "cln/number.h"
7 #include "cln/rational_class.h"
11 class cl_I : public cl_RA {
13 // Default constructor.
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
23 cl_I (const unsigned long);
24 cl_I (const long long);
25 cl_I (const unsigned long long);
26 cl_I& operator= (const int); // |argument| must be < 2^29
27 cl_I& operator= (const unsigned int); // argument must be < 2^29
28 cl_I& operator= (const long);
29 cl_I& operator= (const unsigned long);
30 cl_I& operator= (const long long);
31 cl_I& operator= (const unsigned long long);
32 // Other constructors.
34 // Private constructor.
35 cl_I (cl_private_thing);
36 cl_I (struct cl_fixnum * /* NULL! */, cl_uint);
37 cl_I (struct cl_heap_bignum *);
38 public: // Ability to place an object at a given address.
39 void* operator new (size_t size) { return malloc_hook(size); }
40 void* operator new (size_t size, void* ptr) { (void)size; return ptr; }
41 void operator delete (void* ptr) { free_hook(ptr); }
44 // Private constructors.
45 inline cl_I::cl_I (cl_private_thing ptr) : cl_RA (ptr) {}
46 // The assignment operators:
47 CL_DEFINE_ASSIGNMENT_OPERATOR(cl_I, cl_I)
48 // The default constructors.
50 : cl_RA ((cl_private_thing) cl_combine(cl_FN_tag,0)) {}
51 // The copy constructors.
52 CL_DEFINE_COPY_CONSTRUCTOR2(cl_I,cl_RA)
53 // Constructors and assignment operators from C numeric types.
54 CL_DEFINE_INT_CONSTRUCTORS(cl_I)
55 CL_DEFINE_INT_ASSIGNMENT_OPERATORS(cl_I)
56 CL_DEFINE_LONG_CONSTRUCTORS(cl_I)
57 CL_DEFINE_LONG_ASSIGNMENT_OPERATORS(cl_I)
58 CL_DEFINE_LONGLONG_CONSTRUCTORS(cl_I)
59 CL_DEFINE_LONGLONG_ASSIGNMENT_OPERATORS(cl_I)
63 #endif /* _CL_INTEGER_CLASS_H */