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.
16 #ifdef HAVE_TEMPLATE_NULL
19 struct cl_heap_GV<cl_I> : cl_heap {
21 // here room for the elements
22 sintL maxbits () const;
24 typedef cl_heap_GV<cl_I> cl_heap_GV_I;
26 struct cl_GV_I : public cl_GV<cl_I,cl_GV_RA> {
30 cl_GV_I (const cl_GV_I&);
31 // Create a vector of unconstrained integers.
32 explicit cl_GV_I (uintL len);
33 // Create a vector of m-bit integers (>=0, <2^m).
34 cl_GV_I (uintL len, sintL m);
35 // Assignment operators.
36 cl_GV_I& operator= (const cl_GV_I&);
37 // Number m of bits allowed per element (-1 if unconstrained).
38 sintL maxbits () const
40 return ((const cl_heap_GV_I *) pointer)->maxbits();
42 // Private pointer manipulations.
43 cl_GV_I (cl_heap_GV_I* p) : cl_GV<cl_I,cl_GV_RA> (p) {}
44 cl_GV_I (cl_private_thing p) : cl_GV<cl_I,cl_GV_RA> (p) {}
46 inline cl_GV_I::cl_GV_I (const cl_GV_I& x) : cl_GV<cl_I,cl_GV_RA> (as_cl_private_thing(x)) {}
47 CL_DEFINE_ASSIGNMENT_OPERATOR(cl_GV_I,cl_GV_I)
48 extern cl_heap_GV_I* cl_make_heap_GV_I (uintL len);
49 inline cl_GV_I::cl_GV_I (uintL len)
50 : cl_GV<cl_I,cl_GV_RA> (cl_make_heap_GV_I(len)) {}
51 extern cl_heap_GV_I* cl_make_heap_GV_I (uintL len, sintL m);
52 inline cl_GV_I::cl_GV_I (uintL len, sintL m)
53 : cl_GV<cl_I,cl_GV_RA> (cl_make_heap_GV_I(len,m)) {}
55 // Private pointer manipulations. Never throw away a `struct cl_heap_GV_I *'!
56 extern const cl_GV_I cl_null_GV_I;
57 inline cl_GV_I::cl_GV_I ()
58 : cl_GV<cl_I,cl_GV_RA> ((cl_heap_GV_I*) cl_null_GV_I) {}
62 extern const cl_GV_I copy (const cl_GV_I&);
65 inline void fprint (std::ostream& stream, const cl_GV_I& x)
67 extern cl_print_flags default_print_flags;
68 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);
69 extern void print_integer (std::ostream& stream, const cl_print_flags& flags, const cl_I& z);
70 print_vector(stream, default_print_flags,
71 (void (*) (std::ostream&, const cl_print_flags&, const cl_number&))
72 (void (*) (std::ostream&, const cl_print_flags&, const cl_I&))
76 CL_DEFINE_PRINT_OPERATOR(cl_GV_I)
80 extern int cl_GV_I_debug_module;
81 static void* const cl_GV_I_debug_dummy[] = { &cl_GV_I_debug_dummy,
88 #endif /* _CL_GV_INTEGER_H */