bool SingleServerEdgeCursor::readAll(std::unordered_set<VPackSlice>& result, size_t& cursorId) { if (_currentCursor >= _cursors.size()) { return false; } if (_internalCursorMapping != nullptr) { TRI_ASSERT(_currentCursor < _internalCursorMapping->size()); cursorId = _internalCursorMapping->at(_currentCursor); } else { cursorId = _currentCursor; } auto& cursorSet = _cursors[_currentCursor]; for (auto& cursor : cursorSet) { LogicalCollection* collection = cursor->collection(); while (cursor->hasMore()) { // NOTE: We cannot clear the cache, // because the cursor expect's it to be filled. cursor->getMoreMptr(_cache); for (auto const& element : _cache) { TRI_voc_rid_t revisionId = element.revisionId(); if (collection->readRevision(_trx, *_mmdr, revisionId)) { result.emplace(_mmdr->vpack()); } } } } _currentCursor++; return true; }
void inifile_manager::load_ini_category(size_t file, size_t category, std::unordered_set<game_driver const *> &result) const { std::string const &filename(m_ini_index[file].first); emu_file fp(m_options.categoryini_path(), OPEN_FLAG_READ); if (fp.open(filename) != osd_file::error::NONE) { osd_printf_error("Failed to open category file %s for reading\n", filename.c_str()); return; } int64_t const offset(m_ini_index[file].second[category].second); if (fp.seek(offset, SEEK_SET) || (fp.tell() != offset)) { fp.close(); osd_printf_error("Failed to seek to category offset in file %s\n", filename.c_str()); return; } char rbuf[MAX_CHAR_INFO]; while (fp.gets(rbuf, MAX_CHAR_INFO) && rbuf[0] && ('[' != rbuf[0])) { auto const tail(std::find_if(std::begin(rbuf), std::prev(std::end(rbuf)), [] (char ch) { return !ch || ('\r' == ch) || ('\n' == ch); })); *tail = '\0'; int const dfind(driver_list::find(rbuf)); if (0 <= dfind) result.emplace(&driver_list::driver(dfind)); } fp.close(); }
VectorCodec(std::string corpus, int vecLength = 0) { for (int i = 0; i < corpus.length(); i++) { alphabet.emplace(corpus[i]); } nSymbols = alphabet.size(); if (vecLength == 0) { //auto N = nSymbols; } else { N = vecLength; } vector.resize(N, 0.0f); for (int i = 0; i < 256; i++) { tableStoI[i] = 0; tableItoS[i] = 0; } int index = 0; for (auto itr = alphabet.begin(); itr != alphabet.end(); ++itr) { tableStoI[*itr] = index; tableItoS[index] = *itr; index++; } symbol = 0; symIndex = 0; }
void ServerApplicationsTree::collectApplicationSettings(std::unordered_set<ServerApplicationSettings *> &set) const { for (auto l : list) { if (nullptr != l.second->app_sets) { set.emplace(l.second->app_sets); } l.second->collectApplicationSettings(set); } }
/// @brief getVariablesUsedHere, modifying the set in-place void CollectNode::getVariablesUsedHere( std::unordered_set<Variable const*>& vars) const { for (auto const& p : _groupVariables) { vars.emplace(p.second); } for (auto const& p : _aggregateVariables) { if (Aggregator::requiresInput(p.second.second)) { vars.emplace(p.second.first); } } if (_expressionVariable != nullptr) { vars.emplace(_expressionVariable); } if (_outVariable != nullptr && !_count) { if (_keepVariables.empty()) { // Here we have to find all user defined variables in this query // amongst our dependencies: UserVarFinder finder(1); auto myselfAsNonConst = const_cast<CollectNode*>(this); myselfAsNonConst->walk(&finder); if (finder.depth == 1) { // we are top level, let's run again with mindepth = 0 finder.userVars.clear(); finder.mindepth = 0; finder.depth = -1; finder.reset(); myselfAsNonConst->walk(&finder); } for (auto& x : finder.userVars) { vars.emplace(x); } } else { for (auto& x : _keepVariables) { vars.emplace(x); } } } }
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 ServerApplicationsTree::collectApplicationSettings(std::unordered_set<ServerApplicationSettings *> &set) const { for (auto &node : this->list) { const ServerApplicationsTree *tree = node.second; if (nullptr != tree->app_sets) { set.emplace(tree->app_sets); } tree->collectApplicationSettings(set); } }
void addCow(xtype x, ytype y) { cows.emplace(x,y); }