bool CreateDesertFormulaSet(FormulaSet &fs, UdmDesertMap &des_map, DesertUdmMap &inv_des_map ) { CustomFormula ft; Element owner; long fts_id; set<CustomFormula> fomula_set = fs.CustomFormula_kind_children(); set<CustomFormula>::iterator fit; ASSERT(!fomula_set.empty()); //create constraint set fts_id = CreateFormulaSet(((string)fs.name()).c_str()); DoMap(fs, des_map, inv_des_map, fts_id); for(fit = fomula_set.begin(); fit != fomula_set.end(); fit++) { //get owner element ft = *(fit); owner = ft.context(); //lookup in the map long owner_id = GetID(owner, des_map); //create constraint long ft_id = CreateFormula(((string)ft.name()).c_str(), fts_id, owner_id, ((string)ft.expression()).c_str()); DoMap(ft, des_map, inv_des_map, ft_id); }//eo for (fit) return true; };//eo bool CreateDesertConstrainSet
bool CreateVariableProperties(UdmDesertMap& des_map, DesertUdmMap &inv_des_map, UdmElementSet& elements) { UdmElementSet::iterator i; //progress bar indication CDesertStatusDlg * st_dlg = GetStatusDlg(NULL); int pos = 0; for (i = elements.begin(); i != elements.end(); i++) { Element e= *i; std::string ename = e.name(); set<VariableProperty> vp_set = e.VariableProperty_kind_children(); set<VariableProperty>::iterator vp_i; for (vp_i = vp_set.begin(); vp_i != vp_set.end(); vp_i++) { VariableProperty vp = *vp_i; std::string nnvp = vp.name(); long owner_id = GetID(e, des_map); if(!vp.parametric()) { Domain vp_d = vp.domain(); long domain_id = GetID(vp_d, des_map); CString cpfn; if ( strcmp(((string)vp.PCM_STR()).c_str() , "PCM_CUST") ) { //no match cpfn = ((string)vp.PCM_STR()).c_str(); } else cpfn = ((string)vp.CUSTName()).c_str(); long vp_id = CreateVariableProperty( utf82cstring((string)vp.name()), //const char *name, (LPCTSTR)cpfn, //const char *cpfn owner_id, //long owner, domain_id ); //long domain); /* long vp_id = CreateVariableProperty( ((string)vp.name()).c_str(), //const char *name, (LPCTSTR)cpfn, //const char *cpfn owner_id, //long owner, domain_id, //long domain); vp.id(), vp.externalID()); */ DoMap(vp, des_map, inv_des_map, vp_id); TRACE("Added VariableProperty: (name %s, owner: %d, domain: %d) :%d\n", ((string)vp.name()).c_str(), owner_id, domain_id, long(vp_id)); } else //parametric { set<Formula> fs = vp.formula_end(); for(set<Formula>::iterator fit = fs.begin();fit!=fs.end();++fit) { Formula currf = *fit; if(currf.type()==CustomFormula::meta) { CustomFormula customf = CustomFormula::Cast(currf); long pvp_id = createParametricVariableProperty(utf82cstring((string)vp.name()), owner_id, utf82cstring((string)customf.expression())); DoMap(vp, des_map, inv_des_map, pvp_id); TRACE("Added VariableProperty: (name %s, owner: %d, domain: %d) :%d\n", ((string)vp.name()).c_str(), owner_id, long(pvp_id)); } else { SimpleFormula simplef = SimpleFormula::Cast(currf); CString cpfn = ((string)simplef.ComputationType()).c_str(); long vp_id = CreateVariableProperty( utf82cstring((string)vp.name()), //const char *name, (LPCTSTR)cpfn, //const char *cpfn owner_id //long owner, ); DoMap(vp, des_map, inv_des_map, vp_id); TRACE("Added VariableProperty: (name %s, owner: %d) :%d\n", ((string)vp.name()).c_str(), owner_id,long(vp_id)); } } } };//eo for(vp_i) //progress bar status update pos++; //st_dlg->StepInState((short) (float)pos *100.00 /(float)elements.size()); };//end for(i) return true; };