]> www.ginac.de Git - cln.git/blob - src/vector/cl_SV_ringelt.cc
Remove exception hooks in favor of real C++ exceptions:
[cln.git] / src / vector / cl_SV_ringelt.cc
1 // cl_make_heap_SV_ringelt().
2
3 // General includes.
4 #include "cl_sysdep.h"
5
6 CL_PROVIDE(cl_SV_ringelt)
7
8 // Specification.
9 #include "cln/SV_ringelt.h"
10
11
12 // Implementation.
13
14 namespace cln {
15
16 static void cl_svector_ringelt_destructor (cl_heap* pointer)
17 {
18 #if (defined(__mips__) || defined(__mips64__)) && !defined(__GNUC__) // workaround SGI CC bug
19         (*(cl_heap_SV_ringelt*)pointer).~cl_heap_SV();
20 #else
21         (*(cl_heap_SV_ringelt*)pointer).~cl_heap_SV_ringelt();
22 #endif
23 }
24
25 cl_class cl_class_svector_ringelt = {
26         cl_svector_ringelt_destructor,
27         0
28 };
29
30 cl_heap_SV_ringelt* cl_make_heap_SV_ringelt_uninit (uintC len)
31 {
32         var cl_heap_SV_ringelt* hv = (cl_heap_SV_ringelt*) malloc_hook(sizeof(cl_heap_SV_ringelt)+sizeof(_cl_ring_element)*len);
33         hv->refcount = 1;
34         hv->type = &cl_class_svector_ringelt;
35         new (&hv->v) cl_SV_inner<_cl_ring_element> (len);
36         // Have to fill hv->v[i] (0 <= i < len) yourself.
37         return hv;
38 }
39
40 cl_heap_SV_ringelt* cl_make_heap_SV_ringelt (uintC len)
41 {
42         var cl_heap_SV_ringelt* hv = (cl_heap_SV_ringelt*) malloc_hook(sizeof(cl_heap_SV_ringelt)+sizeof(_cl_ring_element)*len);
43         hv->refcount = 1;
44         hv->type = &cl_class_svector_ringelt;
45         new (&hv->v) cl_SV_inner<_cl_ring_element> (len);
46         for (var uintC i = 0; i < len; i++)
47                 init1(_cl_ring_element, hv->v[i]) ();
48         return hv;
49 }
50
51 // An empty vector.
52 const cl_SV_ringelt cl_null_SV_ringelt = cl_SV_ringelt((uintC)0);
53
54 }  // namespace cln
55
56 CL_PROVIDE_END(cl_SV_ringelt)