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.

58 lines
2.0 KiB

25 years ago
  1. // Simple vectors of numbers.
  2. #ifndef _CL_SV_NUMBER_H
  3. #define _CL_SV_NUMBER_H
  4. #include "cl_number.h"
  5. #include "cl_SV.h"
  6. #include "cl_io.h"
  7. typedef cl_heap_SV<cl_number> cl_heap_SV_number;
  8. struct cl_SV_number : public cl_SV<cl_number,cl_SV_any> {
  9. public:
  10. // Constructors.
  11. cl_SV_number ();
  12. cl_SV_number (const cl_SV_number&);
  13. explicit cl_SV_number (uintL len);
  14. // Assignment operators.
  15. cl_SV_number& operator= (const cl_SV_number&);
  16. // Private pointer manipulations.
  17. operator cl_heap_SV_number* () const;
  18. cl_SV_number (cl_heap_SV_number* p) : cl_SV<cl_number,cl_SV_any> (p) {}
  19. cl_SV_number (cl_private_thing p) : cl_SV<cl_number,cl_SV_any> (p) {}
  20. };
  21. inline cl_SV_number::cl_SV_number (const cl_SV_number& x) : cl_SV<cl_number,cl_SV_any> (as_cl_private_thing(x)) {}
  22. CL_DEFINE_ASSIGNMENT_OPERATOR(cl_SV_number,cl_SV_number)
  23. // Returns a new simple vector with uninitialized contents.
  24. extern cl_heap_SV_number* cl_make_heap_SV_number_uninit (uintL len);
  25. // Returns a new simple vector with all elements initialized to 0.
  26. extern cl_heap_SV_number* cl_make_heap_SV_number (uintL len);
  27. inline cl_SV_number::cl_SV_number (uintL len)
  28. : cl_SV<cl_number,cl_SV_any> (cl_make_heap_SV_number(len)) {}
  29. // Private pointer manipulations. Never throw away a `struct cl_heap_SV_number *'!
  30. inline cl_SV_number::operator cl_heap_SV_number* () const
  31. {
  32. cl_heap_SV_number* hpointer = (cl_heap_SV_number*)pointer;
  33. cl_inc_refcount(*this);
  34. return hpointer;
  35. }
  36. extern const cl_SV_number cl_null_SV_number;
  37. inline cl_SV_number::cl_SV_number ()
  38. : cl_SV<cl_number,cl_SV_any> ((cl_heap_SV_number*) cl_null_SV_number) {}
  39. CL_REQUIRE(cl_SV_number)
  40. // Copy a simple vector.
  41. inline const cl_SV_number copy (const cl_SV_number& vector)
  42. { return The(cl_SV_number) (copy((const cl_SV_any&) vector)); }
  43. // Debugging support.
  44. #ifdef CL_DEBUG
  45. extern int cl_SV_number_debug_module;
  46. static void* const cl_SV_number_debug_dummy[] = { &cl_SV_number_debug_dummy,
  47. &cl_SV_number_debug_module
  48. };
  49. #endif
  50. #endif /* _CL_SV_NUMBER_H */