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.

64 lines
1.9 KiB

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