]> www.ginac.de Git - cln.git/blob - include/cl_float_class.h
Distinguish between cl_word_size and the ABI's pointer size.
[cln.git] / include / cl_float_class.h
1 // Abstract class of floating-point numbers.
2
3 #ifndef _CL_FLOAT_CLASS_H
4 #define _CL_FLOAT_CLASS_H
5
6 #include "cl_number.h"
7 #include "cl_real_class.h"
8
9
10 class cl_F : public cl_R {
11 public:
12 // Default constructor.
13         cl_F ();
14 // Copy constructor.
15         cl_F (const cl_F&);
16 // Converters.
17 // Assignment operators.
18         cl_F& operator= (const cl_F&);
19 // Constructors and assignment operators from C numeric types.
20         cl_F (const float);
21         cl_F (const double);
22         cl_F& operator= (const float);
23         cl_F& operator= (const double);
24 // Other constructors.
25         cl_F (const char *);
26 // Private constructor.
27         cl_F (cl_private_thing);
28 public: // Ability to place an object at a given address.
29         void* operator new (size_t size) { return cl_malloc_hook(size); }
30         void* operator new (size_t size, cl_F* ptr) { (void)size; return ptr; }
31         void operator delete (void* ptr) { cl_free_hook(ptr); }
32 private:
33 // Friend declarations. They are for the compiler. Just ignore them.
34 };
35
36 // Private constructors.
37 inline cl_F::cl_F (cl_private_thing ptr) : cl_R (ptr) {}
38 // The assignment operators:
39 CL_DEFINE_ASSIGNMENT_OPERATOR(cl_F, cl_F)
40 // The default constructors.
41 inline cl_F::cl_F ()
42         : cl_R ((cl_private_thing) cl_combine(cl_SF_tag,0)) {}
43 // The copy constructors.
44 CL_DEFINE_COPY_CONSTRUCTOR2(cl_F,cl_R)
45 // Constructors and assignment operators from C numeric types.
46 CL_DEFINE_FLOAT_CONSTRUCTOR(cl_F)
47 CL_DEFINE_DOUBLE_CONSTRUCTOR(cl_F)
48
49
50 #endif /* _CL_FLOAT_CLASS_H */