You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
1.6 KiB

25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
  1. // Simple vectors of integers.
  2. #ifndef _CL_SV_INTEGER_H
  3. #define _CL_SV_INTEGER_H
  4. #include "cln/number.h"
  5. #include "cln/SV_rational.h"
  6. #include "cln/integer_class.h"
  7. #include "cln/io.h"
  8. namespace cln {
  9. // A vector of integers is just a normal vector of rational numbers.
  10. typedef cl_heap_SV<cl_I> cl_heap_SV_I;
  11. struct cl_SV_I : public cl_SV<cl_I,cl_SV_RA> {
  12. public:
  13. // Constructors.
  14. cl_SV_I () : cl_SV<cl_I,cl_SV_RA> ((cl_heap_SV_I*) (cl_heap_SV_number*) cl_null_SV_number) {};
  15. cl_SV_I (const cl_SV_I&);
  16. explicit cl_SV_I (uintL len) : cl_SV<cl_I,cl_SV_RA> ((cl_heap_SV_I*) cl_make_heap_SV_number(len)) {};
  17. // Assignment operators.
  18. cl_SV_I& operator= (const cl_SV_I&);
  19. };
  20. inline cl_SV_I::cl_SV_I (const cl_SV_I& x) : cl_SV<cl_I,cl_SV_RA> (as_cl_private_thing(x)) {}
  21. CL_DEFINE_ASSIGNMENT_OPERATOR(cl_SV_I,cl_SV_I)
  22. // Copy a simple vector.
  23. inline const cl_SV_I copy (const cl_SV_I& vector)
  24. {
  25. return The(cl_SV_I) (copy((const cl_SV_RA&) vector));
  26. }
  27. // Output.
  28. inline void fprint (cl_ostream stream, const cl_SV_I& x)
  29. {
  30. extern cl_print_flags default_print_flags;
  31. extern void print_vector (cl_ostream stream, const cl_print_flags& flags, void (* fun) (cl_ostream, const cl_print_flags&, const cl_number&), const cl_SV_number& vector);
  32. extern void print_integer (cl_ostream stream, const cl_print_flags& flags, const cl_I& z);
  33. print_vector(stream, default_print_flags,
  34. (void (*) (cl_ostream, const cl_print_flags&, const cl_number&))
  35. (void (*) (cl_ostream, const cl_print_flags&, const cl_I&))
  36. &print_integer,
  37. x);
  38. }
  39. CL_DEFINE_PRINT_OPERATOR(cl_SV_I)
  40. } // namespace cln
  41. #endif /* _CL_SV_INTEGER_H */