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.

62 lines
2.2 KiB

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