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.

67 lines
2.1 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
  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 (std::size_t 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 (std::size_t len);
  26. // Returns a new simple vector with all elements initialized to 0.
  27. extern cl_heap_SV_number* cl_make_heap_SV_number (std::size_t len);
  28. inline cl_SV_number::cl_SV_number (std::size_t 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. class cl_SV_number_init_helper
  41. {
  42. static int count;
  43. public:
  44. cl_SV_number_init_helper();
  45. ~cl_SV_number_init_helper();
  46. };
  47. static cl_SV_number_init_helper cl_SV_number_init_helper_instance;
  48. // Copy a simple vector.
  49. inline const cl_SV_number copy (const cl_SV_number& vector)
  50. { return The(cl_SV_number) (copy((const cl_SV_any&) vector)); }
  51. // Debugging support.
  52. #ifdef CL_DEBUG
  53. extern int cl_SV_number_debug_module;
  54. CL_FORCE_LINK(cl_SV_number_debug_dummy, cl_SV_number_debug_module)
  55. #endif
  56. } // namespace cln
  57. #endif /* _CL_SV_NUMBER_H */