24 #ifndef PPL_ppl_java_common_defs_hh
25 #define PPL_ppl_java_common_defs_hh 1
27 #define PPL_NO_AUTOMATIC_INITIALIZATION
31 #include "interfaced_boxes.hh"
32 #include "marked_pointers.hh"
34 #define PPL_JAVA_UNEXPECTED \
35 throw std::runtime_error("PPL Java interface internal error")
38 catch(const Java_ExceptionOccurred& e) { \
40 catch(const std::overflow_error& e) { \
41 handle_exception(env, e); \
43 catch(const std::length_error& e) { \
44 handle_exception(env, e); \
46 catch (const std::bad_alloc& e) { \
47 handle_exception(env, e); \
49 catch (const std::domain_error& e) { \
50 handle_exception(env, e); \
52 catch (const std::invalid_argument& e) { \
53 handle_exception(env, e); \
55 catch(const std::logic_error& e) { \
56 handle_exception(env, e); \
58 catch (const std::exception& e) { \
59 handle_exception(env, e); \
61 catch (const timeout_exception& e) { \
62 handle_exception(env, e); \
64 catch (const deterministic_timeout_exception& e) { \
65 handle_exception(env, e); \
68 handle_exception(env); \
71 #define CHECK_EXCEPTION_ASSERT(env) \
72 assert(!env->ExceptionOccurred())
73 #define CHECK_EXCEPTION_THROW(env) \
75 if (env->ExceptionOccurred()) \
76 throw Java_ExceptionOccurred(); \
78 #define CHECK_EXCEPTION_RETURN(env, val) \
80 if (env->ExceptionOccurred()) \
83 #define CHECK_EXCEPTION_RETURN_VOID(env) \
85 if (env->ExceptionOccurred()) \
88 #define CHECK_RESULT_ABORT(env, cond) \
93 #define CHECK_RESULT_ASSERT(env, cond) \
95 #define CHECK_RESULT_THROW(env, cond) \
98 throw Java_ExceptionOccurred(); \
100 #define CHECK_RESULT_RETURN(env, cond, val) \
105 #define CHECK_RESULT_RETURN_VOID(env, cond) \
114 namespace Interfaces {
149 extern Weightwatch* p_deterministic_timeout_object;
151 void reset_timeout();
153 void reset_deterministic_timeout();
156 handle_exception(JNIEnv* env,
const std::logic_error& e);
159 handle_exception(JNIEnv* env,
const std::invalid_argument& e);
162 handle_exception(JNIEnv* env,
const std::domain_error& e);
165 handle_exception(JNIEnv* env,
const std::overflow_error& e);
168 handle_exception(JNIEnv* env,
const std::length_error& e);
171 handle_exception(JNIEnv* env,
const std::bad_alloc&);
174 handle_exception(JNIEnv* env,
const std::exception& e);
177 handle_exception(JNIEnv* env,
const timeout_exception& e);
180 handle_exception(JNIEnv* env,
const deterministic_timeout_exception& e);
183 handle_exception(JNIEnv* env);
249 void init_cache(JNIEnv* env, jclass& field,
const char* name);
435 template <
typename U,
typename V>
437 jtype_to_unsigned(
const V&
value);
441 bool_to_j_boolean_class(JNIEnv* env,
const bool value);
445 j_integer_to_j_int(JNIEnv* env, jobject j_integer);
449 j_int_to_j_integer(JNIEnv* env, jint
value);
453 j_long_class_to_j_long(JNIEnv* env, jobject j_long);
457 j_long_to_j_long_class(JNIEnv* env, jlong
value);
464 is_java_marked(JNIEnv* env, jobject ppl_object);
486 build_cxx_variables_set(JNIEnv* env, jobject v_set);
493 build_java_variables_set(JNIEnv* env,
const Variables_Set& v_set);
500 build_cxx_relsym(JNIEnv* env, jobject j_relsym);
508 build_cxx_bounded_overflow(JNIEnv* env, jobject j_bounded_overflow);
516 build_cxx_bounded_width(JNIEnv* env, jobject j_bounded_width);
524 build_cxx_bounded_rep(JNIEnv* env, jobject j_bounded_rep);
531 build_cxx_optimization_mode(JNIEnv* env, jobject j_opt_mode);
545 build_cxx_control_parameter_name(JNIEnv* env, jobject j_cp_name);
552 build_java_control_parameter_name
560 build_cxx_control_parameter_value(JNIEnv* env, jobject j_cp_value);
567 build_java_control_parameter_value
576 build_cxx_pip_problem_control_parameter_name(JNIEnv* env, jobject j_cp_name);
583 build_java_pip_problem_control_parameter_name
592 build_cxx_pip_problem_control_parameter_value(JNIEnv* env, jobject j_cp_value);
599 build_java_pip_problem_control_parameter_value
621 build_cxx_variable(JNIEnv* env, jobject j_var);
628 build_java_variable(JNIEnv* env,
const Variable var);
638 Java_Variable_output_function(std::ostream& s,
Variable v);
645 build_cxx_coeff(JNIEnv* env, jobject j_coeff);
652 build_java_coeff(JNIEnv* env,
const Coefficient& ppl_coeff);
659 build_cxx_constraint(JNIEnv* env, jobject j_constraint);
666 PIP_Tree_Node::Artificial_Parameter
667 build_cxx_artificial_parameter(JNIEnv* env, jobject j_ap);
674 build_cxx_linear_expression(JNIEnv* env, jobject j_le);
681 build_cxx_congruence(JNIEnv* env, jobject j_cg);
688 build_cxx_generator(JNIEnv* env, jobject j_g);
695 build_cxx_grid_generator(JNIEnv* env, jobject j_g);
702 build_cxx_grid_generator_system(JNIEnv* env, jobject j_gs);
709 build_cxx_constraint_system(JNIEnv* env, jobject j_cs);
715 PIP_Tree_Node::Artificial_Parameter
716 build_cxx_artificial_parameter(JNIEnv* env, jobject j_art_param);
723 build_cxx_artificial_parameter_sequence(JNIEnv* env, jobject j_aps);
730 build_cxx_generator_system(JNIEnv* env, jobject j_gs);
737 build_cxx_congruence_system(JNIEnv* env, jobject j_cgs);
744 build_java_constraint(JNIEnv* env,
const Constraint& c);
751 build_java_artificial_parameter(JNIEnv* env,
752 const PIP_Tree_Node::Artificial_Parameter& ap);
759 build_java_congruence(JNIEnv* env,
const Congruence& cg);
766 build_java_generator(JNIEnv* env,
const Generator& g);
787 build_java_artificial_parameter_sequence
816 build_java_linear_expression_coefficient(JNIEnv* env,
const Coefficient& coeff);
823 set_generator(JNIEnv* env, jobject dst, jobject src);
829 set_coefficient(JNIEnv* env, jobject dst, jobject src);
836 set_by_reference(JNIEnv* env, jobject by_ref_dst, jobject src);
843 get_by_reference(JNIEnv* env, jobject by_reference);
857 set_pair_element(JNIEnv* env, jobject dst_pair,
int arg, jobject src);
870 get_pair_element(JNIEnv* env,
int arg, jobject pair);
874 get_ptr(JNIEnv* env, jobject ppl_object);
877 template <
typename T>
879 set_ptr(JNIEnv* env, jobject ppl_object,
880 const T* address,
bool to_be_marked =
false);
886 template <
typename R>
888 build_linear_expression(JNIEnv* env,
const R& r);
899 #endif // !defined(PPL_ppl_prolog_common_defs_hh)
jmethodID Linear_Expression_Variable_var_id_ID
jmethodID Optimization_Mode_ordinal_ID
jfieldID Generator_div_ID
jfieldID Relation_Symbol_GREATER_OR_EQUAL_ID
jmethodID Linear_Expression_Variable_init_ID
jfieldID PIP_Problem_Control_Parameter_Name_PIVOT_ROW_STRATEGY
jmethodID Coefficient_toString_ID
jmethodID Coefficient_init_from_String_ID
jmethodID Poly_Gen_Relation_init_ID
jmethodID Variable_init_ID
jfieldID Bounded_Integer_Type_Overflow_OVERFLOW_WRAPS_ID
jfieldID Congruence_lhs_ID
jmethodID Grid_Generator_Type_ordinal_ID
jmethodID Congruence_System_add_ID
jclass Artificial_Parameter
jmethodID Congruence_init_ID
jfieldID Congruence_mod_ID
jfieldID Variable_stringifier_ID
jmethodID Boolean_valueOf_ID
jfieldID Linear_Expression_Coefficient_coeff_ID
jmethodID Generator_System_init_ID
jfieldID Coefficient_value_ID
jfieldID Relation_Symbol_GREATER_THAN_ID
jclass Variable_Stringifier
jfieldID Artificial_Parameter_den_ID
jmethodID Variables_Set_init_ID
jmethodID Complexity_Class_ordinal_ID
A cache for global references to Java classes.
jmethodID Degenerate_Element_ordinal_ID
jfieldID Constraint_kind_ID
jfieldID PIP_Problem_Control_Parameter_Value_PIVOT_ROW_STRATEGY_FIRST_ID
jfieldID Optimization_Mode_MINIMIZATION_ID
jmethodID Variables_Set_Iterator_has_next_ID
jclass Grid_Generator_Type
jclass Bounded_Integer_Type_Width
jmethodID Linear_Expression_times_ID
jclass Linear_Expression_Coefficient
jfieldID PIP_Problem_Control_Parameter_Value_CUTTING_STRATEGY_DEEPEST_ID
jmethodID MIP_Problem_Status_ordinal_ID
jmethodID Variables_Set_iterator_ID
jclass Bounded_Integer_Type_Representation
jmethodID Generator_Type_ordinal_ID
Java_Class_Cache()
Default constructor.
jclass PIP_Problem_Status
jfieldID Linear_Expression_Unary_Minus_arg_ID
jmethodID Linear_Expression_sum_ID
jfieldID Bounded_Integer_Type_Representation_UNSIGNED_ID
jmethodID Poly_Con_Relation_init_ID
jfieldID Grid_Generator_div_ID
Bounded_Integer_Type_Overflow
jfieldID PIP_Problem_Control_Parameter_Value_CUTTING_STRATEGY_FIRST_ID
std::vector< Artificial_Parameter > Artificial_Parameter_Sequence
jmethodID Generator_System_add_ID
jfieldID Relation_Symbol_EQUAL_ID
jfieldID By_Reference_obj_ID
jfieldID Congruence_rhs_ID
jfieldID Bounded_Integer_Type_Overflow_OVERFLOW_UNDEFINED_ID
A cache for field and method IDs of Java classes.
jmethodID Constraint_System_init_ID
jmethodID PIP_Problem_Control_Parameter_Value_ordinal_ID
jmethodID Grid_Generator_System_init_ID
jmethodID Bounded_Integer_Type_Width_ordinal_ID
jmethodID Linear_Expression_Coefficient_init_ID
Bounded_Integer_Type_Width
jmethodID Grid_Generator_System_add_ID
jmethodID Linear_Expression_Times_init_from_coeff_var_ID
jfieldID PIP_Problem_Control_Parameter_Value_CUTTING_STRATEGY_ALL_ID
jfieldID PIP_Problem_Status_UNFEASIBLE_PIP_PROBLEM_ID
jfieldID Linear_Expression_Sum_rhs_ID
jclass Artificial_Parameter_Sequence
jmethodID Generator_ray_ID
jclass Bounded_Integer_Type_Overflow
PPL_COEFFICIENT_TYPE Coefficient
jfieldID MIP_Problem_Status_OPTIMIZED_MIP_PROBLEM_ID
jfieldID Constraint_lhs_ID
jfieldID Bounded_Integer_Type_Overflow_OVERFLOW_IMPOSSIBLE_ID
jmethodID Artificial_Parameter_init_ID
jmethodID Relation_Symbol_ordinal_ID
jfieldID Bounded_Integer_Type_Width_BITS_16_ID
jfieldID PPL_Object_ptr_ID
void clear_cache(JNIEnv *env)
Resets all fields to NULL.
jclass Linear_Expression_Sum
jfieldID Artificial_Parameter_le_ID
jfieldID MIP_Problem_Status_UNBOUNDED_MIP_PROBLEM_ID
jmethodID Grid_Generator_grid_point_ID
jmethodID System_Iterator_next_ID
jmethodID Artificial_Parameter_Sequence_add_ID
jfieldID Optimization_Mode_MAXIMIZATION_ID
jmethodID Bounded_Integer_Type_Overflow_ordinal_ID
jmethodID Long_valueOf_ID
jclass Grid_Generator_System
jfieldID Grid_Generator_gt_ID
jmethodID Boolean_boolValue_ID
jclass Linear_Expression_Variable
jclass MIP_Problem_Status
jmethodID Constraint_System_add_ID
jmethodID Congruence_System_init_ID
jmethodID Variables_Set_add_ID
jmethodID Generator_closure_point_ID
jmethodID Generator_point_ID
jfieldID Linear_Expression_Difference_rhs_ID
jfieldID Constraint_rhs_ID
jmethodID Grid_Generator_parameter_ID
jfieldID Variable_varid_ID
jclass Linear_Expression_Difference
jfieldID MIP_Problem_Status_UNFEASIBLE_MIP_PROBLEM_ID
jmethodID System_iterator_ID
jmethodID By_Reference_init_ID
Java_Class_Cache & operator=(const Java_Class_Cache &)
jmethodID PIP_Problem_Control_Parameter_Name_ordinal_ID
jclass Linear_Expression_Times
jmethodID PIP_Problem_Status_ordinal_ID
jclass PIP_Problem_Control_Parameter_Value
jfieldID PIP_Problem_Control_Parameter_Value_PIVOT_ROW_STRATEGY_MAX_COLUMN_ID
jmethodID Artificial_Parameter_Sequence_init_ID
jmethodID Integer_valueOf_ID
jmethodID Grid_Generator_grid_line_ID
jclass PIP_Problem_Control_Parameter_Name
jclass Linear_Expression_Unary_Minus
jmethodID Integer_intValue_ID
jfieldID Bounded_Integer_Type_Width_BITS_64_ID
jmethodID Variables_Set_Iterator_next_ID
void init_cache(JNIEnv *env)
Initializes all cache fields.
jfieldID Linear_Expression_Difference_lhs_ID
jmethodID Constraint_init_ID
jfieldID Bounded_Integer_Type_Width_BITS_128_ID
jfieldID PIP_Problem_Status_OPTIMIZED_PIP_PROBLEM_ID
jmethodID System_Iterator_has_next_ID
jmethodID Variable_Stringifier_stringify_ID
jfieldID Bounded_Integer_Type_Width_BITS_32_ID
jfieldID Grid_Generator_le_ID
jmethodID Bounded_Integer_Type_Representation_ordinal_ID
jfieldID Linear_Expression_Sum_lhs_ID
Bounded_Integer_Type_Representation
jmethodID Long_longValue_ID
jfieldID Linear_Expression_Times_coeff_ID
jfieldID PIP_Problem_Control_Parameter_Name_CUTTING_STRATEGY_ID
jmethodID Generator_line_ID
jfieldID Bounded_Integer_Type_Width_BITS_8_ID
jfieldID Bounded_Integer_Type_Representation_SIGNED_2_COMPLEMENT_ID
jfieldID Linear_Expression_Times_lin_expr_ID