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.

63 lines
1.9 KiB

25 years ago
  1. // Abstract class of real numbers.
  2. #ifndef _CL_REAL_CLASS_H
  3. #define _CL_REAL_CLASS_H
  4. #include "cl_number.h"
  5. #include "cl_complex_class.h"
  6. class cl_R : public cl_N {
  7. public:
  8. // Default constructor.
  9. cl_R ();
  10. // Copy constructor.
  11. cl_R (const cl_R&);
  12. // Converters.
  13. // Assignment operators.
  14. cl_R& operator= (const cl_R&);
  15. // Constructors and assignment operators from C numeric types.
  16. cl_R (const int); // |argument| must be < 2^29
  17. cl_R (const unsigned int); // argument must be < 2^29
  18. cl_R (const long);
  19. cl_R (const unsigned long);
  20. cl_R (const float);
  21. cl_R (const double);
  22. cl_R& operator= (const int); // |argument| must be < 2^29
  23. cl_R& operator= (const unsigned int); // argument must be < 2^29
  24. cl_R& operator= (const long);
  25. cl_R& operator= (const unsigned long);
  26. cl_R& operator= (const float);
  27. cl_R& operator= (const double);
  28. // Other constructors.
  29. cl_R (const char *);
  30. // Private constructor.
  31. cl_R (cl_private_thing);
  32. public: // Ability to place an object at a given address.
  33. void* operator new (size_t size) { return cl_malloc_hook(size); }
  34. void* operator new (size_t size, cl_R* ptr) { (void)size; return ptr; }
  35. void operator delete (void* ptr) { cl_free_hook(ptr); }
  36. private:
  37. // Friend declarations. They are for the compiler. Just ignore them.
  38. };
  39. // Private constructors.
  40. inline cl_R::cl_R (cl_private_thing ptr) : cl_N (ptr) {}
  41. // The assignment operators:
  42. CL_DEFINE_ASSIGNMENT_OPERATOR(cl_R, cl_R)
  43. // The default constructors.
  44. inline cl_R::cl_R ()
  45. : cl_N ((cl_private_thing) cl_combine(cl_FN_tag,0)) {}
  46. // The copy constructors.
  47. CL_DEFINE_COPY_CONSTRUCTOR2(cl_R,cl_N)
  48. // Constructors and assignment operators from C numeric types.
  49. CL_DEFINE_INT_CONSTRUCTORS(cl_R)
  50. CL_DEFINE_INT_ASSIGNMENT_OPERATORS(cl_R)
  51. CL_DEFINE_LONG_CONSTRUCTORS(cl_R)
  52. CL_DEFINE_LONG_ASSIGNMENT_OPERATORS(cl_R)
  53. CL_DEFINE_FLOAT_CONSTRUCTOR(cl_R)
  54. CL_DEFINE_DOUBLE_CONSTRUCTOR(cl_R)
  55. #endif /* _CL_REAL_CLASS_H */