void REGNRecord::REGNEntry::IsMap(bool value) { if(value) RDAT.value.entryType = eMap; else if(IsMap()) RDAT.value.entryType = eObject; }
void mech_createbays(dbref player, void *data, char *buffer) { char *args[NUM_BAYS + 1]; int argc; dbref it; int i; MECH *ds = (MECH *) data; MAP *map; DOCHECK((argc = mech_parseattributes(buffer, args, NUM_BAYS + 1)) == (NUM_BAYS + 1), "Invalid number of arguments!"); for(i = 0; i < argc; i++) { it = match_thing(player, args[i]); DOCHECK(it == NOTHING, tprintf("Argument %d is invalid.", i + 1)); DOCHECK(!IsMap(it), tprintf("Argument %d is not a map.", i + 1)); map = FindObjectsData(it); AeroBay(ds, i) = it; map->onmap = ds->mynum; } for(i = argc; i < NUM_BAYS; i++) AeroBay(ds, i) = -1; notify_printf(player, "%d bay(s) set up!", argc); }
VectorMap<EscValue, EscValue>& EscValue::CloneMap() { LTIMING("CloneMap"); ASSERT(IsMap()); if(map->refcount != 1) { EscMap *c = new EscMap; c->map <<= map->map; map->Release(); map = c; } hash = 0; return map->map; }
nsresult HTMLImageElement::PreHandleEvent(EventChainPreVisitor& aVisitor) { // If we are a map and get a mouse click, don't let it be handled by // the Generic Element as this could cause a click event to fire // twice, once by the image frame for the map and once by the Anchor // element. (bug 39723) WidgetMouseEvent* mouseEvent = aVisitor.mEvent->AsMouseEvent(); if (mouseEvent && mouseEvent->IsLeftClickEvent() && IsMap()) { aVisitor.mEventStatus = nsEventStatus_eConsumeNoDefault; } return nsGenericHTMLElement::PreHandleEvent(aVisitor); }
void operator()(SettingMap &map) { SettingValue &value = map[myComponents[myIndex]]; if (myIndex == myComponents.size() - 1) value = myNewValue; else { if (!boost::apply_visitor(IsMap(), value)) value = SettingMap(); ++myIndex; boost::apply_visitor(*this, value); } }
NAMESPACE_UPP #define LTIMING(x) // RTIMING(x) VectorMap<EscValue, EscValue>& EscValue::CloneMap() { LTIMING("CloneMap"); ASSERT(IsMap()); if(AtomicRead(map->refcount) != 1) { EscMap *c = new EscMap; c->map <<= map->map; map->Release(); map = c; } hash = 0; return map->map; }
boost::optional<SettingValue> operator()(const SettingMap &map) const { auto it = map.find(myComponents[myIndex]); if (it == map.end()) return boost::none; const SettingValue &value = it->second; if (myIndex == myComponents.size() - 1) return value; else { if (!boost::apply_visitor(IsMap(), value)) return boost::none; ++myIndex; return boost::apply_visitor(*this, value); } }
int FWadReader::NextMap (int index) const { if (index < 0) { index = 0; } else { index++; } for (; index < Header.NumLumps; ++index) { if (IsMap (index)) { return index; } } return -1; }
//! Update map controls for changes made elsewhere void CxpGbaDlg::UpdateMap() { BOOL bMap= IsMap(); GetDlgItem(IDC_MAP_CHK)->EnableWindow(IsTiled()); GetDlgItem(IDC_MAP_FLAT)->EnableWindow(bMap); GetDlgItem(IDC_MAP_SBB)->EnableWindow(bMap); GetDlgItem(IDC_MAP_AFF)->EnableWindow(bMap); GetDlgItem(IDC_MAP_RDX)->EnableWindow(bMap); UpdateRdx(); GetDlgItem(IDC_META_PAL)->EnableWindow(bMap); GetDlgItem(IDC_MAP_CPRS)->EnableWindow(bMap); GetDlgItem(IDC_MAP_OFS)->EnableWindow(bMap); GetDlgItem(IDC_TILESET_CHK)->EnableWindow(bMap); BOOL bTileset= bMap && mbTileset; GetDlgItem(IDC_TILESET_PATH)->EnableWindow(bTileset); GetDlgItem(IDC_TILESET_BROWSE)->EnableWindow(bTileset); }
void Importer::importScenesRecursive(Node& root, const Url& sceneUrl, std::vector<Url>& sceneStack) { LOGD("Starting importing Scene: %s", sceneUrl.string().c_str()); for (const auto& s : sceneStack) { if (sceneUrl == s) { LOGE("%s will cause a cyclic import. Stopping this scene from being imported", sceneUrl.string().c_str()); return; } } sceneStack.push_back(sceneUrl); auto sceneNode = m_importedScenes[sceneUrl]; if (!sceneNode.IsDefined() || !sceneNode.IsMap()) { return; } auto imports = getResolvedImportUrls(sceneNode, sceneUrl); // Don't want to merge imports, so remove them here. sceneNode.remove("import"); for (const auto& url : imports) { importScenesRecursive(root, url, sceneStack); } sceneStack.pop_back(); mergeMapFields(root, sceneNode); resolveSceneUrls(root, sceneUrl); }
bool EscValue::HasNumberField(const char *id) const { return IsMap() && GetMap().Find(id) >= 0; }
const VectorMap<EscValue, EscValue>& EscValue::GetMap() const { ASSERT(IsMap()); return map->map; }
std::unique_ptr< i_population_wide_observer > resultant_objective::create_instance( prm::param_accessor param, std::vector< std::unique_ptr< i_observer > >& required_observations) //std::set< agent_objective::Type >& required_observations) { #if 0 auto type = prm::find_value(param, "obj_type")[0].as< i_population_wide_observer::Type >(); switch(type) { case i_population_wide_observer::Single: { auto ao_type = prm::find_value(param, "single_obj")[0].as< agent_objective::Type >(); required_observations.insert(ao_type); return new rtp_single_objective(agent_objective::Names[ao_type]); } case i_population_wide_observer::Pareto: { auto ep = prm::find_value(param, "pareto_obj").as< prm::enum_param_val >(); auto objectives = boost::any_cast<std::vector< std::string >>(ep.contents); for(auto const& obj_name : objectives) { required_observations.insert(YAML::Node(obj_name).as< agent_objective::Type >()); } /* std::vector< std::string > obj_names; for(auto const& obj : agent_objective::Names) { if(prm::find_value(param, obj).as< bool >()) { required_observations.insert(YAML::Node(obj).as< agent_objective::Type >()); obj_names.push_back(obj); } } */ return new rtp_pareto(objectives);// obj_names); } default: return nullptr; } #endif param.push_relative_path(prm::qualified_path("objective")); auto obj_type = param["obj_type"][0].as< i_population_wide_observer::Type >(); param.push_relative_path(prm::qualified_path("objective_components")); std::unique_ptr< i_population_wide_observer > result; switch(obj_type) { case i_population_wide_observer::Type::Single: { auto man_obj = manual_objective::create_instance(param, std::function< double(state_value_id) >()); // TODO: auto observation_name = std::string("SINGLE"); auto wrapped = std::make_unique< temp_manual_objective_wrapper >(std::move(man_obj), observation_name); required_observations.emplace_back(std::move(wrapped)); // TODO: auto merge = param["trial_merging"][0].as< std::string >(); rtp_single_objective::MergeMethod merge_method = rtp_single_objective::MergeMethod::Default; if(merge == "Average") { merge_method = rtp_single_objective::MergeMethod::Average; } else { merge_method = rtp_single_objective::MergeMethod::Minimum; } result = std::make_unique< rtp_single_objective >(observation_name, merge_method); } break; case i_population_wide_observer::Type::Pareto: { std::vector< std::string > components; auto node = param["pareto_components"]; //assert(node[prm::ParamNode::Value] && node[prm::ParamNode::Value].IsMap()); assert(node.IsMap()); for(auto inst : node)//[prm::ParamNode::Value]) { auto inst_num = inst.first.as< unsigned int >(); auto rel_path = prm::qualified_path("pareto_components"); rel_path.leaf().set_index(inst_num); param.push_relative_path(rel_path); auto man_obj = manual_objective::create_instance(param, std::function< double(state_value_id) >()); // TODO: ?? Currently set in every update() call, so this is not used... // TODO: For now just using unique path as observation name std::stringstream ss; ss << rel_path; auto observation_name = ss.str(); auto wrapped = std::make_unique< temp_manual_objective_wrapper >(std::move(man_obj), observation_name); required_observations.emplace_back(std::move(wrapped)); param.pop_relative_path(); components.push_back(observation_name); } result = std::make_unique< rtp_pareto >(components); } break; case i_population_wide_observer::Type::Null_Debug: { result = std::make_unique< rtp_null_objective >(); } break; } param.pop_relative_path(); param.pop_relative_path(); return result; }