1 #pragma once 2 3 #include <iosfwd> 4 5 #include "../sign_condition.h" 6 7 namespace poly { 8 9 /** This C++ enum class reimplements the lp_sign_condition_enum. 10 */ 11 enum class SignCondition { 12 LT = LP_SGN_LT_0, 13 LE = LP_SGN_LE_0, 14 EQ = LP_SGN_EQ_0, 15 NE = LP_SGN_NE_0, 16 GT = LP_SGN_GT_0, 17 GE = LP_SGN_GE_0 18 }; 19 20 /** Casts from SignCondition to lp_sign_condition_t. */ to_sign_condition(SignCondition sc)21 inline lp_sign_condition_t to_sign_condition(SignCondition sc) { 22 return static_cast<lp_sign_condition_t>(sc); 23 } 24 /** Casts from lp_sign_condition_t to SignCondition. */ to_sign_condition(lp_sign_condition_t sc)25 inline SignCondition to_sign_condition(lp_sign_condition_t sc) { 26 return static_cast<SignCondition>(sc); 27 } 28 29 /** Stream the given SignCondition to an output stream. */ 30 std::ostream& operator<<(std::ostream& os, const SignCondition& sc); 31 32 /** Evaluates a sign condition. 33 * Expected values of sgn: -1, 0, 1 34 */ 35 bool evaluate_sign_condition(SignCondition sc, int sgn); 36 37 } // namespace poly 38