19 uninitialized_ring_exception::uninitialized_ring_exception ()
20 : runtime_exception("Uninitialized ring operation called.")
23 static inline const std::string
24 uninitialized_error_msg (const _cl_ring_element& obj)
26 std::ostringstream buf;
27 fprint(buf, "Uninitialized ring element @0x");
28 fprinthexadecimal(buf, (unsigned long)(void*)&obj);
30 fprinthexadecimal(buf, (unsigned long)obj.rep.word);
34 static inline const std::string
35 uninitialized_error_msg (const _cl_ring_element& obj_x, const _cl_ring_element& obj_y)
37 std::ostringstream buf;
38 fprint(buf, "Uninitialized ring elements @0x");
39 fprinthexadecimal(buf, (unsigned long)(void*)&obj_x);
41 fprinthexadecimal(buf, (unsigned long)obj_x.rep.word);
43 fprinthexadecimal(buf, (unsigned long)(void*)&obj_y);
45 fprinthexadecimal(buf, (unsigned long)obj_y.rep.word);
49 uninitialized_exception::uninitialized_exception (const _cl_ring_element& obj)
50 : runtime_exception(uninitialized_error_msg(obj))
53 uninitialized_exception::uninitialized_exception (const _cl_ring_element& obj_x, const _cl_ring_element& obj_y)
54 : runtime_exception(uninitialized_error_msg(obj_x, obj_y))
58 static const _cl_ring_element dummy_op0 (cl_heap_ring* R)
61 throw uninitialized_ring_exception();
64 static const _cl_ring_element dummy_op1 (cl_heap_ring* R, const _cl_ring_element& x)
67 throw uninitialized_exception(x);
70 static const _cl_ring_element dummy_op2 (cl_heap_ring* R, const _cl_ring_element& x, const _cl_ring_element& y)
73 throw uninitialized_exception(x, y);
76 static void dummy_fprint (cl_heap_ring* R, std::ostream& stream, const _cl_ring_element& x)
80 throw uninitialized_exception(x);
82 static bool dummy_equal (cl_heap_ring* R, const _cl_ring_element& x, const _cl_ring_element& y)
85 throw uninitialized_exception(x, y);
88 #define dummy_zero dummy_op0
89 static bool dummy_zerop (cl_heap_ring* R, const _cl_ring_element& x)
92 throw uninitialized_exception(x);
94 #define dummy_plus dummy_op2
95 #define dummy_minus dummy_op2
96 #define dummy_uminus dummy_op1
98 #define dummy_one dummy_op0
99 static const _cl_ring_element dummy_canonhom (cl_heap_ring* R, const cl_I& x)
102 (void)&x; // unused x;
103 throw uninitialized_ring_exception();
105 #define dummy_mul dummy_op2
106 #define dummy_square dummy_op1
107 static const _cl_ring_element dummy_expt_pos (cl_heap_ring* R, const _cl_ring_element& x, const cl_I& y)
110 (void)&y; // unused y;
111 throw uninitialized_exception(x);
114 static cl_ring_setops dummy_setops = {
118 static cl_ring_addops dummy_addops = {
125 static cl_ring_mulops dummy_mulops = {
133 class cl_heap_no_ring : public cl_heap_ring {
134 SUBCLASS_cl_heap_ring()
138 : cl_heap_ring (&dummy_setops,&dummy_addops,&dummy_mulops)
139 { type = &cl_class_no_ring; }
141 ~cl_heap_no_ring () {}
144 static void cl_no_ring_destructor (cl_heap* pointer)
146 (*(cl_heap_no_ring*)pointer).~cl_heap_no_ring();
149 static void cl_no_ring_dprint (cl_heap* pointer)
152 fprint(cl_debugout, "(cl_ring) cl_no_ring");
155 cl_class cl_class_no_ring = {
156 cl_no_ring_destructor,
161 const cl_ring cl_no_ring = cl_ring (new cl_heap_no_ring());
165 CL_PROVIDE_END(cl_no_ring)