]> www.ginac.de Git - cln.git/blob - include/cln/SV_integer.h
cl_{GV,SV}: use std::size_t for size of vectors (instead of obscure uintC).
[cln.git] / include / cln / SV_integer.h
1 // Simple vectors of integers.
2
3 #ifndef _CL_SV_INTEGER_H
4 #define _CL_SV_INTEGER_H
5
6 #include "cln/number.h"
7 #include "cln/SV_rational.h"
8 #include "cln/integer_class.h"
9 #include "cln/io.h"
10
11 namespace cln {
12
13 // A vector of integers is just a normal vector of rational numbers.
14
15 typedef cl_heap_SV<cl_I> cl_heap_SV_I;
16
17 struct cl_SV_I : public cl_SV<cl_I,cl_SV_RA> {
18 public:
19         // Constructors.
20         cl_SV_I () : cl_SV<cl_I,cl_SV_RA> ((cl_heap_SV_I*) (cl_heap_SV_number*) cl_null_SV_number) {};
21         cl_SV_I (const cl_SV_I&);
22         explicit cl_SV_I (std::size_t len) : cl_SV<cl_I,cl_SV_RA> ((cl_heap_SV_I*) cl_make_heap_SV_number(len)) {};
23         // Assignment operators.
24         cl_SV_I& operator= (const cl_SV_I&);
25 };
26 inline cl_SV_I::cl_SV_I (const cl_SV_I& x) : cl_SV<cl_I,cl_SV_RA> (as_cl_private_thing(x)) {}
27 CL_DEFINE_ASSIGNMENT_OPERATOR(cl_SV_I,cl_SV_I)
28
29 // Copy a simple vector.
30 inline const cl_SV_I copy (const cl_SV_I& vector)
31 {
32         return The(cl_SV_I) (copy((const cl_SV_RA&) vector));
33 }
34
35 // Output.
36 inline void fprint (std::ostream& stream, const cl_SV_I& x)
37 {
38         extern cl_print_flags default_print_flags;
39         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_SV_number& vector);
40         extern void print_integer (std::ostream& stream, const cl_print_flags& flags, const cl_I& z);
41         print_vector(stream, default_print_flags,
42                      (void (*) (std::ostream&, const cl_print_flags&, const cl_number&))
43                      (void (*) (std::ostream&, const cl_print_flags&, const cl_I&))
44                      &print_integer,
45                      x);
46 }
47 CL_DEFINE_PRINT_OPERATOR(cl_SV_I)
48
49 }  // namespace cln
50
51 #endif /* _CL_SV_INTEGER_H */