void acl_ethertype::event_handler::handle_populate(const client_db::key_t& key) { /* * dump VPP acl ethertypes */ std::shared_ptr<acl_ethertype_cmds::dump_cmd> cmd = std::make_shared<acl_ethertype_cmds::dump_cmd>(~0); HW::enqueue(cmd); HW::write(); for (auto& record : *cmd) { auto& payload = record.get_payload(); handle_t hdl(payload.sw_if_index); std::shared_ptr<interface> itf = interface::find(hdl); uint8_t n_input = payload.n_input; uint8_t count = payload.count; ethertype_rules_t ler; if (itf) { for (int i = 0; i < count; i++) { ethertype_t e = ethertype_t::from_numeric_val(payload.whitelist[i]); if (n_input) { ethertype_rule_t er(e, direction_t::INPUT); ler.insert(er); n_input--; } else { ethertype_rule_t er(e, direction_t::OUTPUT); ler.insert(er); } } if (!ler.empty()) { acl_ethertype a_e(*itf, ler); VOM_LOG(log_level_t::DEBUG) << "ethertype dump: " << a_e.to_string(); OM::commit(key, a_e); } } else { VOM_LOG(log_level_t::ERROR) << "no interface:" << payload.sw_if_index; } } }
vec_type Polyhedron<plane_itt>::TestContour(const contour_t &cnt, VecContour<> *subcont, Vector_3 *subcenter) const{ /// testing bounding box Vector_3 bc1, bc2; cnt.GetBoundingBox(&bc1,&bc2); Vector_3 p1=box.get_p1(), p2=box.get_p2(); for(int i=0;i<3;i++){ if(bc1[i]>p2[i] || bc2[i]<p1[i])return 0.; } aggregate_it<plane_it, typename contour_t::plane_it, Plane_3> a_b(b,e,cnt.planes_begin()),a_e(e,e,cnt.planes_end()); // solving for intersection VecContour<> s_cont; int res=ProjectSimplex(cnt.GetPlane(),a_b,a_e,s_cont); if(res==1){ vec_type a=s_cont.Area(); if(subcenter)*subcenter=s_cont.GetCenter(); if(subcont)subcont->GetPoints().swap(s_cont.GetPoints()); return a; } return 0.; }