size_t Path::listDir(PathList &l, bool recurse, unsigned short flags) const { EachFunc func; details::DirLister dl(l); Bind(&dl, &details::DirLister::dirItem, func); l.clear(); each(func, recurse, flags); return l.size(); }
void ModuleSettings::SetAutoLoadPaths(const PathList& paths) { PathList normalizedPaths; normalizedPaths.resize(paths.size()); std::transform(paths.begin(), paths.end(), normalizedPaths.begin(), RemoveTrailingPathSeparator); US_UNUSED(ModuleSettingsPrivate::Lock(moduleSettingsPrivate())); moduleSettingsPrivate()->autoLoadPaths.clear(); moduleSettingsPrivate()->autoLoadPaths.insert(normalizedPaths.begin(), normalizedPaths.end()); }
/* public */ void SharedPathsOp::getSharedPaths(PathList& forwDir, PathList& backDir) { PathList paths; findLinearIntersections(paths); for (size_t i=0, n=paths.size(); i<n; ++i) { LineString* path = paths[i]; if ( isSameDirection(*path) ) forwDir.push_back(path); else backDir.push_back(path); } }
// helps fill in the path matrix (see below) void add_to_vector (PathList& previous_vector, wstring* to_add) { wstring string_rep = represent_path (to_add, 2); if (previous_vector.size() == 0) { previous_vector.push_back (string_rep); } else { PathList::iterator it; // if there is more than one possible path, add to all of them for (it=previous_vector.begin(); it != previous_vector.end(); it++) { it->append (string_rep); } } }
// Run BFS to fill current gap void GapFiller::BFS(size_t left_index, size_t right_index, int gap, GapInfo* gapinfo) { int dis = gap + (_K-1+3*_DELTA) +30; //gap constraints PathList pathlist; BFS(_uniq_graph, left_index, right_index, dis, _STEP, 1000, pathlist); if (pathlist.empty()) { const std::string& lsequence = _uniq_graph._indexer[left_index].seq; const std::string& rsequence = _uniq_graph._indexer[right_index].seq; BFS(_all_graph, lsequence, rsequence, dis, _STEP, 2000, pathlist); } if (!pathlist.empty()) { if (pathlist.size() <= MAX_CHOICE) { if (gapinfo != NULL) { gapinfo->graph = 0; gapinfo->pathlist = pathlist; } } else { if (gapinfo != NULL) { gapinfo->graph = -1; } } } }
fs::path findLoggingConfigFile() { PathList configs = findLoggingConfigFiles(findExecutablePath()); if (configs.size()) return *configs.begin(); return fs::path(); }
fs::path findTextureDir() { PathList textures = findTextureDirs(findExecutablePath()); if (textures.size()) return *textures.begin(); return fs::path(); }
/** * @brief ShortPathWriter::writeShortPath - Save exist short path in open file * @param fp - open file pointer * @param pathIt - Iterator on exist short path * @param options - some options (PRINT_INDENTS) */ void ShortPathWriter::writeShortPath(FILE* fp, RootPathList::iterator pathIt, cuint options) { unsigned parentId = pathIt->first; ShortPathElem* pathElem = pathIt->second->getNodes(); PathList* pathList = pathElem->getPathList(); if (pathList == nullptr) { return; } unsigned nodeId; float weight; bool isFirst = true; std::deque <PathListItPair> pathStack; unsigned currentIndent = 1; bool printIndents = options & (unsigned) Option::PRINT_INDENTS; pathStack.push_front( PathListItPair(pathList->begin(), pathList->end()) ); fprintf(fp, "%u(", parentId); if (printIndents) { fputc('\n', fp); } while (pathStack.size()) { auto pathIt = pathStack.front().first; auto pathEnd = pathStack.front().second; if (pathIt == pathEnd) { pathStack.pop_front(); --currentIndent; if (printIndents) { for(unsigned i = 0u; i < currentIndent; ++i) { fputc('\t', fp); } fputs(")\n", fp); } else { fputc(')', fp); } continue; } nodeId = pathIt->first; pathElem = pathIt->second; pathList = pathElem->getPathList(); if (printIndents) { for(unsigned i = 0u; i < currentIndent; ++i) { fputc('\t', fp); } } else if (!isFirst) { fputc(' ', fp); } else { isFirst = false; } weight = pathElem->getWeight(); fprintf(fp, "%u[%g]", nodeId, weight); ++(pathStack.front().first); if (pathList && pathList->size()) { fputc('(', fp); // Move to next elem // go to next child pathStack.push_front( PathListItPair(pathList->begin(), pathList->end()) ); isFirst = true; ++currentIndent; } if (printIndents) { fputc('\n', fp); } } }