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.

72 lines
2.3 KiB

25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
  1. // Simple vectors of ring elements.
  2. #ifndef _CL_SV_RINGELT_H
  3. #define _CL_SV_RINGELT_H
  4. #include "cln/ring.h"
  5. #include "cln/SV.h"
  6. #include "cln/io.h"
  7. namespace cln {
  8. typedef cl_heap_SV<_cl_ring_element> cl_heap_SV_ringelt;
  9. struct cl_SV_ringelt : public cl_SV<_cl_ring_element,cl_SV_any> {
  10. public:
  11. // Constructors.
  12. cl_SV_ringelt ();
  13. cl_SV_ringelt (const cl_SV_ringelt&);
  14. explicit cl_SV_ringelt (std::size_t len);
  15. // Assignment operators.
  16. cl_SV_ringelt& operator= (const cl_SV_ringelt&);
  17. // Private pointer manipulations.
  18. operator cl_heap_SV_ringelt* () const;
  19. cl_SV_ringelt (cl_heap_SV_ringelt* p) : cl_SV<_cl_ring_element,cl_SV_any> (p) {}
  20. cl_SV_ringelt (cl_private_thing p) : cl_SV<_cl_ring_element,cl_SV_any> (p) {}
  21. };
  22. inline cl_SV_ringelt::cl_SV_ringelt (const cl_SV_ringelt& x) : cl_SV<_cl_ring_element,cl_SV_any> (as_cl_private_thing(x)) {}
  23. CL_DEFINE_ASSIGNMENT_OPERATOR(cl_SV_ringelt,cl_SV_ringelt)
  24. // Returns a new simple vector with uninitialized contents.
  25. extern cl_heap_SV_ringelt* cl_make_heap_SV_ringelt_uninit (std::size_t len);
  26. // Returns a new simple vector with all elements initialized to some value.
  27. extern cl_heap_SV_ringelt* cl_make_heap_SV_ringelt (std::size_t len);
  28. inline cl_SV_ringelt::cl_SV_ringelt (std::size_t len)
  29. : cl_SV<_cl_ring_element,cl_SV_any> (cl_make_heap_SV_ringelt(len)) {}
  30. // Private pointer manipulations.
  31. // Never throw away a `struct cl_heap_SV_ringelt *'!
  32. inline cl_SV_ringelt::operator cl_heap_SV_ringelt* () const
  33. {
  34. cl_heap_SV_ringelt* hpointer = (cl_heap_SV_ringelt*)pointer;
  35. cl_inc_refcount(*this);
  36. return hpointer;
  37. }
  38. extern const cl_SV_ringelt cl_null_SV_ringelt;
  39. inline cl_SV_ringelt::cl_SV_ringelt ()
  40. : cl_SV<_cl_ring_element,cl_SV_any> ((cl_heap_SV_ringelt*) cl_null_SV_ringelt) {}
  41. class cl_SV_ringelt_init_helper
  42. {
  43. static int count;
  44. public:
  45. cl_SV_ringelt_init_helper();
  46. ~cl_SV_ringelt_init_helper();
  47. };
  48. static cl_SV_ringelt_init_helper cl_SV_ringelt_init_helper_instance;
  49. // Copy a simple vector.
  50. inline const cl_SV_ringelt copy (const cl_SV_ringelt& vector)
  51. { return The(cl_SV_ringelt) (copy((const cl_SV_any&) vector)); }
  52. // Output.
  53. extern void fprint (std::ostream& stream, const cl_ring& R, const cl_SV_ringelt& x);
  54. // Debugging support.
  55. #ifdef CL_DEBUG
  56. extern int cl_SV_ringelt_debug_module;
  57. CL_FORCE_LINK(cl_SV_ringelt_debug_dummy, cl_SV_ringelt_debug_module)
  58. #endif
  59. } // namespace cln
  60. #endif /* _CL_SV_RINGELT_H */