📄 conflict.cxx
字号:
}// ----------------------------------------------------------------------------// Inference is implemented. The actual inference code is in infer.cxxboolCdlConflict_IllegalValueBody::resolution_implemented() const{ CYG_REPORT_FUNCNAME("CdlConflict_IllegalValue::resolution_implemented"); CYG_REPORT_FUNCARG1XV(this); CYG_PRECONDITION_THISC(); CYG_REPORT_RETURN(); return true;}// ----------------------------------------------------------------------------boolCdlConflict_IllegalValueBody::check_this(cyg_assert_class_zeal zeal) const{ if (CdlConflict_IllegalValueBody_Magic != cdlconflict_illegalvaluebody_cookie) { return false; } CYGDBG_MEMLEAK_CHECKTHIS(); return CdlConflictBody::check_this(zeal);}boolCdlConflict_IllegalValueBody::test(CdlConflict conf){ CYG_REPORT_FUNCNAMETYPE("CdlConflict_IllegalValue::test", "result %d"); CYG_REPORT_FUNCARG1XV(conf); CYG_PRECONDITION_CLASSC(conf); bool result = false; CdlConflict_IllegalValue tmp = dynamic_cast<CdlConflict_IllegalValue>(conf); if (0 != tmp) { result = true; } CYG_REPORT_RETVAL(result); return result;}//}}}//{{{ CdlConflict_EvalException // ----------------------------------------------------------------------------// Run-time expression failures are possible because of division by// zero, if for no other reason. The evaluation code should have// stored a suitable diagnostic with the conflict. This is not part// of the constructor, allowing the conflict object to be re-used// if the detailed reason changesvoidCdlConflict_EvalExceptionBody::make(CdlTransaction trans, CdlNode node_arg, CdlProperty prop_arg, std::string msg_arg){ CdlConflict_EvalException tmp = new CdlConflict_EvalExceptionBody(trans, node_arg, prop_arg, msg_arg); CYG_UNUSED_PARAM(CdlConflict_EvalException, tmp);}CdlConflict_EvalExceptionBody::CdlConflict_EvalExceptionBody(CdlTransaction trans, CdlNode node_arg, CdlProperty prop_arg, std::string msg_arg) : CdlConflictBody(trans, node_arg, prop_arg, false){ CYG_REPORT_FUNCNAME("CdlConflict_EvalException"); CYG_REPORT_FUNCARG1XV(this); explanation = msg_arg; cdlconflict_evalexceptionbody_cookie = CdlConflict_EvalExceptionBody_Magic; CYGDBG_MEMLEAK_CONSTRUCTOR(); CYG_POSTCONDITION_THISC(); CYG_REPORT_RETURN();}CdlConflict_EvalExceptionBody::~CdlConflict_EvalExceptionBody(){ CYG_REPORT_FUNCNAME("CdlConflict_EvalException"); CYG_REPORT_FUNCARG1XV(this); CYG_PRECONDITION_THISC(); cdlconflict_evalexceptionbody_cookie = CdlConflict_EvalExceptionBody_Invalid; explanation = ""; CYGDBG_MEMLEAK_DESTRUCTOR(); CYG_REPORT_RETURN();}// If there has been an eval exception then the property must be an// ordinary expression, a list expression, or a goal expressionstd::stringCdlConflict_EvalExceptionBody::get_explanation() const{ CYG_REPORT_FUNCNAME("CdlConflict_EvalException::get_explanation"); CYG_REPORT_FUNCARG1XV(this); CYG_PRECONDITION_THISC(); std::string result = node->get_name() + ", property " + property->get_property_name() + "\n"; result += "Error while evaluation expression: "; if ("" != explanation) { result += explanation; } result += "\n"; if (CdlConstProperty_Expression expr = dynamic_cast<CdlConstProperty_Expression>(property)) { result += "Expression: " + expr->get_original_string(); } else if (CdlConstProperty_ListExpression lexpr = dynamic_cast<CdlConstProperty_ListExpression>(property)) { result += "List expression: " + lexpr->get_original_string(); } else if (CdlConstProperty_GoalExpression gexpr = dynamic_cast<CdlConstProperty_GoalExpression>(property)) { result += "Goal expression: " + gexpr->get_original_string(); } else { CYG_FAIL("Unknown expression type"); } CYG_REPORT_RETURN(); return result;}voidCdlConflict_EvalExceptionBody::set_explanation(std::string explanation_arg){ CYG_REPORT_FUNCNAME("CdlConflict_EvalException::set_explanation"); CYG_REPORT_FUNCARG1XV(this); CYG_PRECONDITION_THISC(); explanation = explanation_arg; CYG_REPORT_RETURN();}boolCdlConflict_EvalExceptionBody::check_this(cyg_assert_class_zeal zeal) const{ if (CdlConflict_EvalExceptionBody_Magic != cdlconflict_evalexceptionbody_cookie) { return false; } CYGDBG_MEMLEAK_CHECKTHIS(); return CdlConflictBody::check_this(zeal);}boolCdlConflict_EvalExceptionBody::test(CdlConflict conf){ CYG_REPORT_FUNCNAMETYPE("CdlConflict_EvalException::test", "result %d"); CYG_REPORT_FUNCARG1XV(conf); CYG_PRECONDITION_CLASSC(conf); bool result = false; CdlConflict_EvalException tmp = dynamic_cast<CdlConflict_EvalException>(conf); if (0 != tmp) { result = true; } CYG_REPORT_RETVAL(result); return result;}//}}}//{{{ CdlConflict_Requires // ----------------------------------------------------------------------------// A requires constraint is not satisfied. Producing a decent diagnostic// here requires a detailed understanding of goal expressions. For now// there is no extra data associated with goal expressions.voidCdlConflict_RequiresBody::make(CdlTransaction trans, CdlNode node_arg, CdlProperty prop_arg){ CdlConflict_Requires tmp = new CdlConflict_RequiresBody(trans, node_arg, prop_arg); CYG_UNUSED_PARAM(CdlConflict_Requires, tmp);}CdlConflict_RequiresBody::CdlConflict_RequiresBody(CdlTransaction trans, CdlNode node_arg, CdlProperty prop_arg) : CdlConflictBody(trans, node_arg, prop_arg, false){ CYG_REPORT_FUNCNAME("CdlConflict_Requires:: constructor"); CYG_REPORT_FUNCARG1XV(this); CYG_PRECONDITIONC(0 != dynamic_cast<CdlProperty_GoalExpression>(prop_arg)); cdlconflict_requiresbody_cookie = CdlConflict_RequiresBody_Magic; CYGDBG_MEMLEAK_CONSTRUCTOR(); CYG_POSTCONDITION_THISC(); CYG_REPORT_RETURN();}CdlConflict_RequiresBody::~CdlConflict_RequiresBody(){ CYG_REPORT_FUNCNAME("CdlConflict_Requires:: destructor"); CYG_REPORT_FUNCARG1XV(this); CYG_PRECONDITION_THISC(); cdlconflict_requiresbody_cookie = CdlConflict_RequiresBody_Invalid; CYGDBG_MEMLEAK_DESTRUCTOR(); CYG_REPORT_RETURN();}// FIXME: implement properlystd::stringCdlConflict_RequiresBody::get_explanation() const{ CYG_REPORT_FUNCNAME("CdlConflict::get_explanation"); CYG_REPORT_FUNCARG1XV(this); CYG_PRECONDITION_THISC(); CdlConstProperty_GoalExpression gexpr = dynamic_cast<CdlConstProperty_GoalExpression>(property); CYG_ASSERTC(0 != gexpr); std::string result = ""; result += "Requires constraint not satisfied: " + gexpr->get_original_string(); CYG_REPORT_RETURN(); return result;}// Inference is implemented, see infer.cxxboolCdlConflict_RequiresBody::resolution_implemented() const{ CYG_REPORT_FUNCNAME("CdlConflict_Requires"); CYG_REPORT_FUNCARG1XV(this); CYG_PRECONDITION_THISC(); CYG_REPORT_RETURN(); return true;}boolCdlConflict_RequiresBody::check_this(cyg_assert_class_zeal zeal) const{ if (CdlConflict_RequiresBody_Magic != cdlconflict_requiresbody_cookie) { return false; } CYGDBG_MEMLEAK_CHECKTHIS(); return CdlConflictBody::check_this(zeal);}boolCdlConflict_RequiresBody::test(CdlConflict conf){ CYG_REPORT_FUNCNAMETYPE("CdlConflict_Requires::test", "result %d"); CYG_REPORT_FUNCARG1XV(conf); CYG_PRECONDITION_CLASSC(conf); bool result = false; CdlConflict_Requires tmp = dynamic_cast<CdlConflict_Requires>(conf); if (0 != tmp) { result = true; } CYG_REPORT_RETVAL(result); return result;}//}}}//{{{ CdlConflict_Data // ----------------------------------------------------------------------------// There is some strange problem in the configuration data, for example// a parent property that is resolved but the target is not a container.voidCdlConflict_DataBody::make(CdlTransaction trans, CdlNode node_arg, CdlProperty prop_arg, std::string message_arg){ CdlConflict_Data tmp = new CdlConflict_DataBody(trans, node_arg, prop_arg, message_arg); CYG_UNUSED_PARAM(CdlConflict_Data, tmp);}CdlConflict_DataBody::CdlConflict_DataBody(CdlTransaction trans, CdlNode node_arg, CdlProperty prop_arg, std::string message_arg) : CdlConflictBody(trans, node_arg, prop_arg, true){ CYG_REPORT_FUNCNAME("CdlConflict_Data:: constructor"); CYG_REPORT_FUNCARG1XV(this); CYG_PRECONDITIONC("" != message_arg); message = message_arg; cdlconflict_databody_cookie = CdlConflict_DataBody_Magic; CYGDBG_MEMLEAK_CONSTRUCTOR(); CYG_POSTCONDITION_THISC(); CYG_REPORT_RETURN();}CdlConflict_DataBody::~CdlConflict_DataBody(){ CYG_REPORT_FUNCNAME("CdlConflict_ata: destructor"); CYG_REPORT_FUNCARG1XV(this); CYG_PRECONDITION_THISC(); cdlconflict_databody_cookie = CdlConflict_DataBody_Invalid; CYGDBG_MEMLEAK_DESTRUCTOR(); CYG_REPORT_RETURN();}std::stringCdlConflict_DataBody::get_explanation() const{ CYG_REPORT_FUNCNAME("CdlConflict_Data::get_explanation"); CYG_REPORT_FUNCARG1XV(this); CYG_PRECONDITION_THISC(); std::string result = message; CYG_REPORT_RETURN(); return result;}boolCdlConflict_DataBody::check_this(cyg_assert_class_zeal zeal) const{ if (CdlConflict_DataBody_Magic != cdlconflict_databody_cookie) { return false; } CYGDBG_MEMLEAK_CHECKTHIS(); return CdlConflictBody::check_this(zeal);}boolCdlConflict_DataBody::test(CdlConflict conf){ CYG_REPORT_FUNCNAMETYPE("CdlConflict_Data::test", "result %d"); CYG_REPORT_FUNCARG1XV(conf); CYG_PRECONDITION_CLASSC(conf); bool result = false; CdlConflict_Data tmp = dynamic_cast<CdlConflict_Data>(conf); if (0 != tmp) { result = true; } CYG_REPORT_RETVAL(result); return result;}//}}}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -