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.

64 lines
2.2 KiB

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 (uintL 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 (uintL 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 (uintL len);
  28. inline cl_SV_ringelt::cl_SV_ringelt (uintL 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. CL_REQUIRE(cl_SV_ringelt)
  42. // Copy a simple vector.
  43. inline const cl_SV_ringelt copy (const cl_SV_ringelt& vector)
  44. { return The(cl_SV_ringelt) (copy((const cl_SV_any&) vector)); }
  45. // Output.
  46. extern void fprint (std::ostream& stream, const cl_ring& R, const cl_SV_ringelt& x);
  47. // Debugging support.
  48. #ifdef CL_DEBUG
  49. extern int cl_SV_ringelt_debug_module;
  50. CL_FORCE_LINK(cl_SV_ringelt_debug_dummy, cl_SV_ringelt_debug_module)
  51. #endif
  52. } // namespace cln
  53. #endif /* _CL_SV_RINGELT_H */