]> www.ginac.de Git - cln.git/blob - include/cln/SV_ringelt.h
cl_{GV,SV}: use std::size_t for size of vectors (instead of obscure uintC).
[cln.git] / include / cln / SV_ringelt.h
1 // Simple vectors of ring elements.
2
3 #ifndef _CL_SV_RINGELT_H
4 #define _CL_SV_RINGELT_H
5
6 #include "cln/ring.h"
7 #include "cln/SV.h"
8 #include "cln/io.h"
9
10 namespace cln {
11
12 typedef cl_heap_SV<_cl_ring_element> cl_heap_SV_ringelt;
13
14 struct cl_SV_ringelt : public cl_SV<_cl_ring_element,cl_SV_any> {
15 public:
16         // Constructors.
17         cl_SV_ringelt ();
18         cl_SV_ringelt (const cl_SV_ringelt&);
19         explicit cl_SV_ringelt (std::size_t len);
20         // Assignment operators.
21         cl_SV_ringelt& operator= (const cl_SV_ringelt&);
22         // Private pointer manipulations.
23         operator cl_heap_SV_ringelt* () const;
24         cl_SV_ringelt (cl_heap_SV_ringelt* p) : cl_SV<_cl_ring_element,cl_SV_any> (p) {}
25         cl_SV_ringelt (cl_private_thing p) : cl_SV<_cl_ring_element,cl_SV_any> (p) {}
26 };
27 inline cl_SV_ringelt::cl_SV_ringelt (const cl_SV_ringelt& x) : cl_SV<_cl_ring_element,cl_SV_any> (as_cl_private_thing(x)) {}
28 CL_DEFINE_ASSIGNMENT_OPERATOR(cl_SV_ringelt,cl_SV_ringelt)
29 // Returns a new simple vector with uninitialized contents.
30 extern cl_heap_SV_ringelt* cl_make_heap_SV_ringelt_uninit (std::size_t len);
31 // Returns a new simple vector with all elements initialized to some value.
32 extern cl_heap_SV_ringelt* cl_make_heap_SV_ringelt (std::size_t len);
33 inline cl_SV_ringelt::cl_SV_ringelt (std::size_t len)
34         : cl_SV<_cl_ring_element,cl_SV_any> (cl_make_heap_SV_ringelt(len)) {}
35
36 // Private pointer manipulations.
37 // Never throw away a `struct cl_heap_SV_ringelt *'!
38 inline cl_SV_ringelt::operator cl_heap_SV_ringelt* () const
39 {
40         cl_heap_SV_ringelt* hpointer = (cl_heap_SV_ringelt*)pointer;
41         cl_inc_refcount(*this);
42         return hpointer;
43 }
44 extern const cl_SV_ringelt cl_null_SV_ringelt;
45 inline cl_SV_ringelt::cl_SV_ringelt ()
46         : cl_SV<_cl_ring_element,cl_SV_any> ((cl_heap_SV_ringelt*) cl_null_SV_ringelt) {}
47
48 class cl_SV_ringelt_init_helper
49 {
50         static int count;
51 public:
52         cl_SV_ringelt_init_helper();
53         ~cl_SV_ringelt_init_helper();
54 };
55 static cl_SV_ringelt_init_helper cl_SV_ringelt_init_helper_instance;
56
57 // Copy a simple vector.
58 inline const cl_SV_ringelt copy (const cl_SV_ringelt& vector)
59 { return The(cl_SV_ringelt) (copy((const cl_SV_any&) vector)); }
60
61 // Output.
62 extern void fprint (std::ostream& stream, const cl_ring& R, const cl_SV_ringelt& x);
63
64 // Debugging support.
65 #ifdef CL_DEBUG
66 extern int cl_SV_ringelt_debug_module;
67 CL_FORCE_LINK(cl_SV_ringelt_debug_dummy, cl_SV_ringelt_debug_module)
68 #endif
69
70 }  // namespace cln
71
72 #endif /* _CL_SV_RINGELT_H */