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.0 KiB

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