1 // General vectors of integers.
3 #ifndef _CL_GV_INTEGER_H
4 #define _CL_GV_INTEGER_H
6 #include "cln/number.h"
7 #include "cln/GV_rational.h"
8 #include "cln/integer_class.h"
13 // A vector of integers is *not* just a normal vector of numbers (the vectorops
14 // support the maxbits() operation), but we treat can it like this nevertheless.
17 struct cl_heap_GV<cl_I> : cl_heap {
19 // here room for the elements
20 sintC maxbits () const;
22 typedef cl_heap_GV<cl_I> cl_heap_GV_I;
24 struct cl_GV_I : public cl_GV<cl_I,cl_GV_RA> {
28 cl_GV_I (const cl_GV_I&);
29 // Create a vector of unconstrained integers.
30 explicit cl_GV_I (std::size_t len);
31 // Create a vector of m-bit integers (>=0, <2^m).
32 cl_GV_I (std::size_t len, sintC m);
33 // Assignment operators.
34 cl_GV_I& operator= (const cl_GV_I&);
35 // Number m of bits allowed per element (-1 if unconstrained).
36 sintC maxbits () const
38 return ((const cl_heap_GV_I *) pointer)->maxbits();
40 // Private pointer manipulations.
41 cl_GV_I (cl_heap_GV_I* p) : cl_GV<cl_I,cl_GV_RA> (p) {}
42 cl_GV_I (cl_private_thing p) : cl_GV<cl_I,cl_GV_RA> (p) {}
44 inline cl_GV_I::cl_GV_I (const cl_GV_I& x) : cl_GV<cl_I,cl_GV_RA> (as_cl_private_thing(x)) {}
45 CL_DEFINE_ASSIGNMENT_OPERATOR(cl_GV_I,cl_GV_I)
46 extern cl_heap_GV_I* cl_make_heap_GV_I (std::size_t len);
47 inline cl_GV_I::cl_GV_I (std::size_t len)
48 : cl_GV<cl_I,cl_GV_RA> (cl_make_heap_GV_I(len)) {}
49 extern cl_heap_GV_I* cl_make_heap_GV_I (std::size_t len, sintC m);
50 inline cl_GV_I::cl_GV_I (std::size_t len, sintC m)
51 : cl_GV<cl_I,cl_GV_RA> (cl_make_heap_GV_I(len,m)) {}
53 // Private pointer manipulations. Never throw away a `struct cl_heap_GV_I *'!
54 extern const cl_GV_I cl_null_GV_I;
55 inline cl_GV_I::cl_GV_I ()
56 : cl_GV<cl_I,cl_GV_RA> ((cl_heap_GV_I*) cl_null_GV_I) {}
57 class cl_GV_I_init_helper
61 cl_GV_I_init_helper();
62 ~cl_GV_I_init_helper();
64 static cl_GV_I_init_helper cl_GV_I_init_helper_instance;
67 extern const cl_GV_I copy (const cl_GV_I&);
70 inline void fprint (std::ostream& stream, const cl_GV_I& x)
72 extern cl_print_flags default_print_flags;
73 extern void print_vector (std::ostream& stream, const cl_print_flags& flags, void (* fun) (std::ostream&, const cl_print_flags&, const cl_number&), const cl_GV_number& vector);
74 extern void print_integer (std::ostream& stream, const cl_print_flags& flags, const cl_I& z);
75 print_vector(stream, default_print_flags,
76 (void (*) (std::ostream&, const cl_print_flags&, const cl_number&))
77 (void (*) (std::ostream&, const cl_print_flags&, const cl_I&))
81 CL_DEFINE_PRINT_OPERATOR(cl_GV_I)
85 extern int cl_GV_I_debug_module;
86 CL_FORCE_LINK(cl_GV_I_debug_dummy, cl_GV_I_debug_module)
91 #endif /* _CL_GV_INTEGER_H */