DECLARE_EXPORT int SolverMRP::setattro(const Attribute& attr, const PythonObject& field) { if (attr.isA(Tags::tag_constraints)) setConstraints(field.getInt()); else if (attr.isA(Tags::tag_autocommit)) setAutocommit(field.getBool()); else if (attr.isA(Tags::tag_userexit_flow)) setUserExitFlow(field); else if (attr.isA(Tags::tag_userexit_demand)) setUserExitDemand(field); else if (attr.isA(Tags::tag_userexit_buffer)) setUserExitBuffer(field); else if (attr.isA(Tags::tag_userexit_resource)) setUserExitResource(field); else if (attr.isA(Tags::tag_userexit_operation)) setUserExitOperation(field); else if (attr.isA(Tags::tag_plantype)) setPlanType(field.getInt()); // Less common parameters else if (attr.isA(tag_iterationthreshold)) setIterationThreshold(field.getDouble()); else if (attr.isA(tag_iterationaccuracy)) setIterationAccuracy(field.getDouble()); else if (attr.isA(tag_lazydelay)) setLazyDelay(field.getTimeperiod()); else if (attr.isA(tag_allowsplits)) setAllowSplits(field.getBool()); else if (attr.isA(tag_planSafetyStockFirst)) setPlanSafetyStockFirst(field.getBool()); // Default parameters else return Solver::setattro(attr, field); return 0; }
DECLARE_EXPORT int ResourceSkill::setattro(const Attribute& attr, const PythonObject& field) { if (attr.isA(Tags::tag_resource)) { if (!field.check(Resource::metadata)) { PyErr_SetString(PythonDataException, "resourceskill resource must be of type resource"); return -1; } Resource* y = static_cast<Resource*>(static_cast<PyObject*>(field)); setResource(y); } else if (attr.isA(Tags::tag_skill)) { if (!field.check(Skill::metadata)) { PyErr_SetString(PythonDataException, "resourceskill skill must be of type skill"); return -1; } Skill* y = static_cast<Skill*>(static_cast<PyObject*>(field)); setSkill(y); } else if (attr.isA(Tags::tag_priority)) setPriority(field.getInt()); else if (attr.isA(Tags::tag_effective_end)) setEffectiveEnd(field.getDate()); else if (attr.isA(Tags::tag_effective_start)) setEffectiveStart(field.getDate()); else return -1; return 0; }
DECLARE_EXPORT int Solver::setattro(const Attribute& attr, const PythonObject& field) { if (attr.isA(Tags::tag_name)) setName(field.getString()); else if (attr.isA(Tags::tag_loglevel)) setLogLevel(field.getInt()); else return -1; // Error return 0; // OK }
DECLARE_EXPORT int SetupMatrix::Rule::setattro(const Attribute& attr, const PythonObject& field) { if (attr.isA(Tags::tag_priority)) setPriority(field.getInt()); else if (attr.isA(Tags::tag_fromsetup)) setFromSetup(field.getString()); else if (attr.isA(Tags::tag_tosetup)) setToSetup(field.getString()); else if (attr.isA(Tags::tag_duration)) setDuration(field.getTimeperiod()); else if (attr.isA(Tags::tag_cost)) setCost(field.getDouble()); else return -1; // Error return 0; // OK }