void closeAllWindows() { if(disableAllDisplay) return; boost::unique_lock<boost::mutex> lock(openCVdisplayMutex); cv::destroyAllWindows(); openWindows.clear(); }
void displayThreadLoop() { printf("started image display thread!\n"); boost::unique_lock<boost::mutex> lock(openCVdisplayMutex); while(imageThreadKeepRunning) { openCVdisplaySignal.wait(lock); if(!imageThreadKeepRunning) break; while(displayQueue.size() > 0) { if(!displayQueue.back().autoSize) { if(openWindows.find(displayQueue.back().name) == openWindows.end()) { cv::namedWindow(displayQueue.back().name, cv::WINDOW_NORMAL); cv::resizeWindow(displayQueue.back().name, displayQueue.back().img.cols, displayQueue.back().img.rows); openWindows.insert(displayQueue.back().name); } } cv::imshow(displayQueue.back().name, displayQueue.back().img); cv::waitKey(1); displayQueue.pop_back(); } } cv::destroyAllWindows(); openWindows.clear(); printf("ended image display thread!\n"); }
bool S4Prover::isSatisfiableRefined(SddNode* alpha, SddManager* m, std::unordered_set<SddLiteral> permVars, SddNode* permSdd, std::unordered_set<SddNode*,SddHasher>& assumedSatSdds, std::unordered_set<SddLiteral>& responsibleVars) { assumedSatSdds.clear(); std::unordered_set<SddLiteral> postResponsibleVars; bool isSat; if (sdd_node_is_false(alpha)) { isSat = false; } else if (dependentSdds.count(alpha) == 1) { //Loop detected assumedSatSdds.insert(alpha); isSat = true; } else { isSat = isSatisfiable(alpha,m,permVars,permSdd,assumedSatSdds, postResponsibleVars); } if (assumedSatSdds.count(alpha) == 1) { assumedSatSdds.erase(alpha); } if (!isSat) { responsibleVars.insert(postResponsibleVars.begin(), postResponsibleVars.end()); } dependentSdds.erase(alpha); return isSat; }
void data_store_csv::get_indices(std::unordered_set<int> &indices, int p) { indices.clear(); std::vector<int> &v = m_all_minibatch_indices[p]; for (auto t : v) { indices.insert((*m_shuffled_indices)[t]); } }
box random_icp::solve(box b, double const precision ) { thread_local static std::unordered_set<std::shared_ptr<constraint>> used_constraints; used_constraints.clear(); thread_local static vector<box> solns; thread_local static vector<box> box_stack; solns.clear(); box_stack.clear(); box_stack.push_back(b); do { DREAL_LOG_INFO << "random_icp::solve - loop" << "\t" << "box stack Size = " << box_stack.size(); b = box_stack.back(); box_stack.pop_back(); try { m_ctc.prune(b, m_config); auto this_used_constraints = m_ctc.used_constraints(); used_constraints.insert(this_used_constraints.begin(), this_used_constraints.end()); } catch (contractor_exception & e) { // Do nothing } if (!b.is_empty()) { tuple<int, box, box> splits = b.bisect(precision); int const i = get<0>(splits); if (i >= 0) { box const & first = get<1>(splits); box const & second = get<2>(splits); if (random_bool()) { box_stack.push_back(second); box_stack.push_back(first); } else { box_stack.push_back(first); box_stack.push_back(second); } if (m_config.nra_proof) { m_config.nra_proof_out << "[branched on " << b.get_name(i) << "]" << endl; } } else { m_config.nra_found_soln++; if (m_config.nra_found_soln >= m_config.nra_multiple_soln) { break; } if (m_config.nra_multiple_soln > 1) { // If --multiple_soln is used output_solution(b, m_config, m_config.nra_found_soln); } solns.push_back(b); } } } while (box_stack.size() > 0); m_ctc.set_used_constraints(used_constraints); if (m_config.nra_multiple_soln > 1 && solns.size() > 0) { return solns.back(); } else { assert(!b.is_empty() || box_stack.size() == 0); return b; } }
void CLKernelParameterParser::KernelParameters::getParameterNames(std::unordered_set<std::string>& dest) const { dest.clear(); for(auto it = parametersByName.begin(); it != parametersByName.end(); ++it) { dest.insert(it->first); } }
// Add a collection of timers to the data store. The collection is emptied by // this operation, since the timers are now owned by the store. void TimerStore::add_timers(std::unordered_set<Timer*>& set) { for (auto it = set.begin(); it != set.end(); ++it) { add_timer(*it); } set.clear(); }
static bool url_module_cleanup(KviModule *) { KviConfigurationFile cfg(szConfigPath, KviConfigurationFile::Read); cfg.setGroup("ConfigDialog"); if(cfg.readBoolEntry("SaveUrlListOnUnload", false) == true) saveUrlList(); for(auto tmpitem : g_UrlDlgList) { if(tmpitem->dlg) tmpitem->dlg->close(); } g_List.clear(); g_BanList.clear(); g_UrlDlgList.clear(); return true; }
void UrlDialog::clear() { g_List.clear(); for(auto & tmpitem : g_UrlDlgList) { if(tmpitem->dlg) tmpitem->dlg->m_pUrlList->clear(); } }
void reset() { //dailySessionInterval = SimTimeInterval(0,0); content = nullptr; currentChunk = 0; highestChunkFetched = 0; chunksToBeWatched = 0; buffer.clear(); waiting = false; }
void data_store_csv::get_my_indices(std::unordered_set<int> &indices, int p) { indices.clear(); std::vector<int> &v = m_all_minibatch_indices[p]; for (auto t : v) { int index = (*m_shuffled_indices)[t]; if (m_data.find(index) != m_data.end()) { indices.insert(index); } } }
size_t Statistics::getNumberOfLoops(DFA_Automata * dfa) { std::cout << "start loop counting" << std::endl; InStack.insert(std::make_pair(dfa->m_startState, 1)); LoopDFS(dfa->m_startState); size_t cnt = LoopCnt; LoopCnt = 0; LoopVisited.clear(); InStack.clear(); return cnt; }
void TraitPrecStatement::getOtherTraitNames( std::unordered_set<std::string>& namesSet) const { std::vector<std::string> namesVec; m_otherTraitNames->getStrings(namesVec); for (unsigned int i = 0; i < namesVec.size(); i++) { namesVec[i] = toLower(namesVec[i]); } namesSet.clear(); namesSet.insert(namesVec.begin(), namesVec.end()); }
// Pop a set of timers, this function takes ownership of the timers and // thus empties the passed in set. void TimerHandler::pop(std::unordered_set<TimerPair>& timers) { for (std::unordered_set<TimerPair>::iterator it = timers.begin(); it != timers.end(); ++it) { delete it->information_timer; pop(it->active_timer); } timers.clear(); }
bool fig0_5_is_complete(int components_id) { bool complete = components_seen.count(components_id); if (complete) { components_seen.clear(); } else { components_seen.insert(components_id); } return complete; }
bool fig0_14_is_complete(int subch_id) { bool complete = subch_ids_seen.count(subch_id); if (complete) { subch_ids_seen.clear(); } else { subch_ids_seen.insert(subch_id); } return complete; }
void JsonWrapper::get(const char* name, const std::vector<std::string>& dflt, std::unordered_set<std::string>& param) const { auto it = m_config[name]; param.clear(); if (it == Json::nullValue) { param.insert(dflt.begin(), dflt.end()); } else { for (auto const& str : it) { param.emplace(str.asString()); } } }
void sampleUsers(int nUsers, std::unordered_set<int> invalidUsers, std::unordered_set<int>& sampledUsers, int sz, std::mt19937& mt) { sampledUsers.clear(); std::uniform_int_distribution<> dis(0, nUsers-1); while (sampledUsers.size() <= sz) { int u = dis(mt); if (invalidUsers.count(u) > 0) { continue; } sampledUsers.insert(u); } }
// Функция вызывается в цикле потока void displayThreadLoop() { // Сообщает о запуске потока printf("started image display thread!\n"); // Устанавливает мютекс для потока ?? boost::unique_lock<boost::mutex> lock(openCVdisplayMutex); // Пока неоходим поток изображений while(imageThreadKeepRunning) { // Останавливает поток до получения новых данных openCVdisplaySignal.wait(lock); // Если требуется остановить поток if(!imageThreadKeepRunning) // Прервать цикл break; // Если очередь не пустая while(displayQueue.size() > 0) { // Если последний элемент не поддерживает autosize if(!displayQueue.back().autoSize) { // Если последнее изображение соответствует последними окну if(openWindows.find(displayQueue.back().name) == openWindows.end()) { // Создаем какоето окно ??? cv::namedWindow ( displayQueue.back().name, cv::WINDOW_NORMAL ); cv::resizeWindow( displayQueue.back().name, displayQueue.back().img.cols, displayQueue.back().img.rows); // Добавить в вектор openWindows.insert(displayQueue.back().name); } } // Показать окно cv::imshow(displayQueue.back().name, displayQueue.back().img); // добавить в очередь displayQueue.pop_back(); } } // Удалить все окна cv::destroyAllWindows(); // Очистить вектор openWindows.clear(); // Сообщить об окончании потока printf("ended image display thread!\n"); }
bool clear() { symbol_.clear(); arguments_.clear(); frame_clobbered_ = 0; climbing_ = 0; input_ = 0; clobbered_ = 0; output_ = 0; callies_.clear(); code_.clear(); return true; }
void loadUrlList() { QString urllist; g_pApp->getLocalKvircDirectory(urllist, KviApplication::ConfigPlugins); urllist += g_pUrlListFilename; QFile file; file.setFileName(urllist); if(!file.open(QIODevice::ReadOnly)) return; QTextStream stream(&file); g_List.clear(); for(auto tmpitem : g_UrlDlgList) { if(tmpitem->dlg) tmpitem->dlg->m_pUrlList->clear(); } KviUrl * tmp; int i = 0; int num = stream.readLine().toInt(); while((!stream.atEnd()) && (i < num)) { tmp = new KviUrl(); tmp->url = stream.readLine(); tmp->window = stream.readLine(); tmp->count = stream.readLine().toInt(); tmp->timestamp = stream.readLine(); g_List.insert(tmp); for(auto tmpitem : g_UrlDlgList) { if(tmpitem->dlg) { QString tmpCount; tmpCount.setNum(tmp->count); tmpitem->dlg->addUrl(QString(tmp->url), QString(tmp->window), tmpCount, QString(tmp->timestamp)); } } i++; } file.close(); }
void Profiling::update_cto_warning(bool warn) { Profiling::cto_warning.clear(); if (!warn) return; Profiling::cto_warning = L"\nThe following commands prevented optimising out all implicit post checktextureoverrides:\n"; warned_cto_command_lists.clear(); for (auto &tolkv : G->mTextureOverrideMap) { for (TextureOverride &to : tolkv.second) cto_warn_post_commands(&to.post_command_list); } for (auto &tof : G->mFuzzyTextureOverrides) cto_warn_post_commands(&tof->texture_override->post_command_list); LogInfoNoNL("%S", Profiling::cto_warning.c_str()); }
void displayThreadLoop() { printf("started image display thread!\n"); boost::unique_lock<boost::mutex> lock(openCVdisplayMutex); while(imageThreadKeepRunning) { openCVdisplaySignal.wait(lock); if(!imageThreadKeepRunning) break; // ATTENTION // The display with opencv functions cannot be used together with qt display // In this case the processes block each other'' /*while(displayQueue.size() > 0) { if(!displayQueue.back().autoSize) { if(openWindows.find(displayQueue.back().name) == openWindows.end()) { cv::namedWindow(displayQueue.back().name, cv::WINDOW_NORMAL); cv::resizeWindow(displayQueue.back().name, displayQueue.back().img.cols, displayQueue.back().img.rows); openWindows.insert(displayQueue.back().name); } } // ASDISPLAY cv::imshow(displayQueue.back().name, displayQueue.back().img); // AS - added bellow cv::waitKey(5); displayQueue.pop_back(); }*/ } //cv::destroyAllWindows(); openWindows.clear(); printf("ended image display thread!\n"); }
void closeAllWindows() { // Заблокировать доступ к данным boost::unique_lock<boost::mutex> lock(openCVdisplayMutex); if(useImageDisplayThread) { // Если поток запущен if(imageDisplayThread != 0) { // Останавливаем поток imageThreadKeepRunning = false; // Сообщить всем ожидающим освобождения openCVdisplaySignal.notify_all(); // Сообщаем, что ожиданием окончания остановки printf("waiting for image display thread to end!\n"); // Освододить мютекс lock.unlock(); // ??? imageDisplayThread->join(); // Сообщаем об окончание потока printf("done waiting for image display thread to end!\n"); // Обнулить указатель imageDisplayThread = 0; } } else { // Очистить окна cv::destroyAllWindows(); // Очистить очередь openWindows.clear(); } }
void loadBanList() { QString banlist; g_pApp->getLocalKvircDirectory(banlist, KviApplication::ConfigPlugins); banlist += g_pBanListFilename; QFile file; file.setFileName(banlist); if(!file.open(QIODevice::ReadOnly)) return; QTextStream stream(&file); g_BanList.clear(); int i = 0; int num = stream.readLine().toInt(); while((!stream.atEnd()) && (i < num)) { QString * tmp = new QString(stream.readLine()); g_BanList.insert(tmp); i++; } file.close(); }
void closeAllWindows() { boost::unique_lock<boost::mutex> lock(openCVdisplayMutex); if(useImageDisplayThread) { if(imageDisplayThread != 0) { imageThreadKeepRunning = false; openCVdisplaySignal.notify_all(); printf("waiting for image display thread to end!\n"); lock.unlock(); imageDisplayThread->join(); printf("done waiting for image display thread to end!\n"); imageDisplayThread = 0; } } else { cv::destroyAllWindows(); openWindows.clear(); } }
void doWalkModule(Module* module) { // Intrinsics may use scratch memory, ensure it. ABI::wasm2js::ensureScratchMemoryHelpers(module); // Discover all of the intrinsics that we need to inject, lowering all // operations to intrinsic calls while we're at it. if (!builder) builder = make_unique<Builder>(*module); PostWalker<RemoveNonJSOpsPass>::doWalkModule(module); if (neededIntrinsics.size() == 0) { return; } // Parse the wast blob we have at the end of this file. // // TODO: only do this once per invocation of wasm2asm Module intrinsicsModule; std::string input(IntrinsicsModuleWast); SExpressionParser parser(const_cast<char*>(input.c_str())); Element& root = *parser.root; SExpressionWasmBuilder builder(intrinsicsModule, *root[0]); std::set<Name> neededFunctions; // Iteratively link intrinsics from `intrinsicsModule` into our destination // module, as needed. // // Note that intrinsics often use one another. For example the 64-bit // division intrinsic ends up using the 32-bit ctz intrinsic, but does so // via a native instruction. The loop here is used to continuously reprocess // injected intrinsics to ensure that they never contain non-js ops when // we're done. while (neededIntrinsics.size() > 0) { // Recursively probe all needed intrinsics for transitively used // functions. This is building up a set of functions we'll link into our // module. for (auto &name : neededIntrinsics) { addNeededFunctions(intrinsicsModule, name, neededFunctions); } neededIntrinsics.clear(); // Link in everything that wasn't already linked in. After we've done the // copy we then walk the function to rewrite any non-js operations it has // as well. for (auto &name : neededFunctions) { auto* func = module->getFunctionOrNull(name); if (!func) { func = ModuleUtils::copyFunction(intrinsicsModule.getFunction(name), *module); } doWalkFunction(func); } neededFunctions.clear(); } // Intrinsics may use memory, so ensure the module has one. MemoryUtils::ensureExists(module->memory); // Add missing globals for (auto& pair : neededImportedGlobals) { auto name = pair.first; auto type = pair.second; if (!getModule()->getGlobalOrNull(name)) { auto global = make_unique<Global>(); global->name = name; global->type = type; global->mutable_ = false; global->module = ENV; global->base = name; module->addGlobal(global.release()); } } }
void clear() { keys_to_insert.clear(); lookups.clear(); }
void clear() { for (std::pair<const Waypoint*, HGVertex*> wv : vertices) delete wv.second; vertex_names.clear(); waypoint_naming_log.clear(); vertices.clear(); }
void rho::lua::registerDrawableRect( lua_State * lua ) { s_luaRectangles.clear(); lua::register_funcs( lua, "DrawableRect", rect_funcs ); }