本文整理汇总了C++中FileSet类的典型用法代码示例。如果您正苦于以下问题:C++ FileSet类的具体用法?C++ FileSet怎么用?C++ FileSet使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FileSet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: list
void MFindDialog::FindAll(
const string& inWhat,
bool inIgnoreCase,
bool inRegex,
MMultiMethod inMethod,
fs::path inDirectory,
bool inRecursive,
bool inTextFilesOnly,
const string& inFileNameFilter)
{
mStopFindAll = false;
try
{
FileSet files;
auto_ptr<MMessageList> list(new MMessageList);
GetFilesForFindAll(inMethod, inDirectory,
inRecursive, inTextFilesOnly, inFileNameFilter, files);
for (FileSet::iterator file = files.begin(); file != files.end(); ++file)
{
if (mStopFindAll)
break;
SetStatusString(file->string());
MUrl url(*file);
bool searched = false;
gdk_threads_enter();
MTextDocument* doc = dynamic_cast<MTextDocument*>(MDocument::GetDocumentForURL(url));
if (doc != nil)
{
doc->FindAll(inWhat, inIgnoreCase, inRegex, false, *list.get());
searched = true;
}
gdk_threads_leave();
if (not searched)
MTextDocument::FindAll(*file, inWhat, inIgnoreCase, inRegex, false, *list.get());
}
mFindAllResult = list.release();
}
catch (exception& e)
{
mFindAllResult = new MMessageList; // flag failure... sucks.. I know
mFindAllResult->AddMessage(kMsgKindError, fs::path(), 0, 0, 0, "Error in find all, sorry");
mFindAllResult->AddMessage(kMsgKindError, fs::path(), 0, 0, 0, e.what());
}
catch (...)
{
mFindAllResult = new MMessageList; // flag failure... sucks.. I know
mFindAllResult->AddMessage(kMsgKindError, fs::path(), 0, 0, 0, "Error in find all, sorry");
}
}
示例2:
bool
PathHandler::_HasFile(const node_ref& nodeRef) const
{
FileEntry setEntry;
setEntry.ref.device = nodeRef.device;
setEntry.node = nodeRef.node;
// name does not need to be set, since it's not used for comparing
FileSet::const_iterator iterator = fFiles.find(setEntry);
return iterator != fFiles.end();
}
示例3: FromManifestsInDir
FileSet FileSet::FromManifestsInDir(const boost::filesystem::path &path) {
FileSet ret;
directory_iterator end_iter;
for (directory_iterator iter(path); iter != end_iter; ++iter)
if (!is_directory(iter->status()) && iter->path().stem() == "MANIFEST")
ret.ParseAndAddEntries(read_file(iter->path()));
return ret;
}
示例4: strcpy
void FileSystem::GetDirectoryFiles(FileSet &outFileSet, const char *inPath,
const char *inMsk, bool inIsCase /*= true*/, bool inRecurs /*= false*/,
bool inGetDir /*= false*/)
{
// Quit if there is an incorrect path
if (!inPath || *inPath == 0)
return;
// Replace the directory separator
char path[MAX_PATH + 1], *s;
strcpy(path, inPath);
while ((s = strchr(path, '\\')) != NULL)
*s = DEF_DirectorySeparator;
// Clear the last directory separator if it exists
s = path + strlen(path) - 1;
if (*s == DEF_DirectorySeparator)
*s = 0;
DIR *dir;
struct dirent *ent;
// Open the directory
if ((dir = opendir(path)) == NULL)
return;
// Get directory content
char buf[MAX_PATH + 1];
rewinddir(dir);
while ((ent = readdir(dir)) != NULL) {
// Clear names begining with a dot (hidden files, current and parent directory)
if (*(ent->d_name) == '.')
continue;
// Get sub directories or recurse or clear them
DIR *nextdir;
sprintf(buf, "%s%c%s", path, DEF_DirectorySeparator, ent->d_name);
nextdir = opendir(buf);
if (nextdir) {
closedir(nextdir);
if (inGetDir) {
if (!inMsk || PatternMatch(ent->d_name, inMsk, inIsCase))
outFileSet.insert(buf);
}
// Recursive call ?
if (inRecurs)
GetDirectoryFiles(outFileSet, buf, inMsk, inIsCase, inRecurs, inGetDir);
continue;
}
if (inGetDir)
continue;
if (!inMsk || PatternMatch(ent->d_name, inMsk, inIsCase))
outFileSet.insert(buf);
}
if (closedir(dir) != 0)
gLog.log(eTypLogError, "Err > Unable to close directory: %s", inPath);
}
示例5: Entries
FileSet FileSet::MinusExactMatches(const FileSet &other) const
{
FileSet diff;
FileSet::EntrySet::const_iterator iter = Entries().begin();
for(; iter != Entries().end(); ++iter)
if (!other.HasMatchingEntry(*iter))
diff.AddEntry(*iter);
return diff;
}
示例6: lock
FileSystem::FileSet BlockFileSystem::listFiles()
{
ScopedLock<FastMutex> lock(m_lock);
FX_NS(utility)::File f(m_sFsPath);
vector<tstring> files;
f.list(files, true);
FileSet fileSet;
for (vector<tstring>::const_iterator it = files.begin();
it != files.end(); ++it)
{
fileSet.insert(*it);
}
return fileSet;
}
示例7: TRACE
status_t
PathHandler::_RemoveFile(const node_ref& nodeRef)
{
TRACE(" REMOVE FILE %ld:%Ld\n", nodeRef.device, nodeRef.node);
FileEntry setEntry;
setEntry.ref.device = nodeRef.device;
setEntry.node = nodeRef.node;
// name does not need to be set, since it's not used for comparing
FileSet::iterator iterator = fFiles.find(setEntry);
if (iterator == fFiles.end())
return B_ENTRY_NOT_FOUND;
watch_node(&nodeRef, B_STOP_WATCHING, this);
fFiles.erase(iterator);
return B_OK;
}
示例8: update
void
PathHandler::_NotifyTarget(BMessage* message, const node_ref& nodeRef) const
{
BMessage update(*message);
update.what = B_PATH_MONITOR;
TRACE("_NotifyTarget(): node ref %ld.%Ld\n", nodeRef.device, nodeRef.node);
WatchedDirectory directory;
directory.node = nodeRef;
DirectorySet::const_iterator iterator = fDirectories.find(directory);
if (iterator != fDirectories.end()) {
if (_WatchFilesOnly()) {
// stat or attr notification for a directory
return;
}
BDirectory nodeDirectory(&nodeRef);
BEntry entry;
if (nodeDirectory.GetEntry(&entry) == B_OK) {
BPath path(&entry);
update.AddString("path", path.Path());
}
} else {
if (_WatchFoldersOnly()) {
// this is bound to be a notification for a file
return;
}
FileEntry setEntry;
setEntry.ref.device = nodeRef.device;
setEntry.node = nodeRef.node;
// name does not need to be set, since it's not used for comparing
FileSet::const_iterator i = fFiles.find(setEntry);
if (i != fFiles.end()) {
BPath path(&(i->ref));
update.AddString("path", path.Path());
}
}
// This is in case the target is interested in figuring out which
// BPathMonitor::StartWatching() call the message is resulting from.
update.AddString("watched_path", fPath.Path());
fTarget.SendMessage(&update);
}
示例9: dirFiles
void LocalProcess::directoryChanged(const QString &str)
{
FileSet fs = dirFiles(openstudio::toQString(m_outdir));
std::vector<FileSet::value_type> diff;
{
QMutexLocker l(&m_mutex);
std::set_symmetric_difference(fs.begin(), fs.end(),
m_outfiles.begin(), m_outfiles.end(),
std::back_inserter(diff));
m_outfiles = fs;
}
std::for_each(diff.begin(), diff.end(), boost::bind(&LocalProcess::emitUpdatedFileInfo, this, _1));
m_process.checkProcessStatus();
}
示例10: create_MSB_query_for_file_list
void create_MSB_query_for_file_list(const FileManager& fm,
AllScoreModels *model,
int max_query_size)
{
Config *config = model->get_config();
FileSet fs;
fs.select_all_files(fm);
while (1)
{
Spectrum spec;
PrmGraph prm;
SingleSpectrumFile *ssf;
vector<MSBSequence> msb_sequences;
if (! fs.get_next_spectrum(fm,config,&spec,&ssf))
break;
model->init_model_for_scoring_spectrum(&spec);
/*
AllScoreModels *_model,
Spectrum *spectrum,
mass_t _pm_with_19,
int spec_charge,
bool add_all_pepitde_nodes,
bool only_basic_score*/
prm.create_graph_from_spectrum(model, &spec, spec.get_org_pm_with_19());
model->score_graph_edges(prm);
spec.print_expected_by();
prm.print_with_multi_edges();
//\\ generate_MSB_sequences_from_PrmGraph(prm,msb_sequences,10);
exit(0);
}
}
示例11: main
int main (int argc, char *argv[])
{
bool skip_decrypted = false;
FileSet fileSet;
PathCrawler crawler(&fileSet);
printf("---------------------------\n");
printf("DMA recon v1.4\n");
printf("---------------------------\n");
if (argc >= 2 && argv[1][0] == '1') {
skip_decrypted = true;
printf("Skipping decrypted!\n");
}
crawler.listDir(crawler.startPath, skip_decrypted);
printf("listing finished...\n");
fileSet.printSummary();
system("pause");
return 0;
}
示例12: subdirs
LocalProcess::FileSet LocalProcess::dirFiles(const QString &dir) const
{
QFileInfoList fil;
QDir subdirs(dir, "mergedjob-*", QDir::Name, QDir::Dirs);
QFileInfoList mergedjobdirs = subdirs.entryInfoList();
for (QFileInfoList::const_iterator itr = mergedjobdirs.begin();
itr != mergedjobdirs.end();
++itr)
{
QDir mergeddir(itr->absoluteFilePath(), "", QDir::Name, QDir::Files);
fil.append(mergeddir.entryInfoList());
}
QDir d(dir, "", QDir::Name, QDir::Files);
fil.append(d.entryInfoList());
QFileInfoList filtered;
// Filter out all files that are part of the set of input files. Everything remaining should be an outputfile
for (QFileInfoList::const_iterator itr = fil.begin();
itr != fil.end();
++itr)
{
bool partofinput = false;
for (std::vector<std::pair<openstudio::path, openstudio::path> >::const_iterator itr2 = m_requiredFiles.begin();
itr2 != m_requiredFiles.end();
++itr2)
{
QString fileName = itr->fileName();
QString fileName2 = toQString(itr2->second.filename());
if (fileName == fileName2)
{
partofinput = true;
break;
}
}
if (!partofinput)
{
filtered.push_back(*itr);
}
}
FileSet out;
typedef FileInfo (*filetransform)(QFileInfo);
try{
std::transform(filtered.begin(), filtered.end(), std::inserter(out, out.end()),
static_cast<filetransform>(&RunManager_Util::dirFile));
} catch(openstudio::Exception& e) {
LOG_AND_THROW("Exception caught " << e.what());
}
return out;
}
示例13: main
int main()
{
Config *config=NULL;
FileManager fm;
FileSet fs;
AdvancedScoreModel model;
EdgeModel edge_model;
PeptideRankScorer drs;
rand_seed(112233);
// train_all();
model.read_model("CID_IT_TRYP");
config = model.get_config();
config->apply_selected_PTMs("C+57:M+16:Q-17");
// fm.init_from_file(config,"C:\\Work\\msms5\\DnvScore\\all_ds\\HEK_98_3_unique_30.mgf");
fs.select_files_in_mz_range(fm,300,2000,3);
fs.randomly_reduce_ssfs(100);
vector<int> cc(4,0);
cc[3]=100;
fs.create_mgf_file(fm,config,"HEK_4_30e.mgf",cc);
exit(0);
// model.get_config()->apply_selected_PTMs("C+57:M+16:Q-17");
PMCSQS_Scorer *pmcsqs = (PMCSQS_Scorer *)model.get_pmcsqs_ptr();
fm.init_from_list_file(config,"C:\\Work\\msms5\\PepNovoHQ\\train3.txt");
pmcsqs->benchmark_pm_selection(config,fm,0.3);
exit(0);
/* benchmark_shew(model,"C:\\Work\\msms5\\PepNovoHQ\\Shew_test_10.mgf");
exit(0);
drs.set_model_type(0);
drs.read_denovo_rank_scorer_model("C:\\Work\\msms5\\PepNovoHQ\\Models\\DBSCORE\\DBSCORE_rank_model.txt");
drs.give_de_novo_and_peak_match_examples("C:\\Work\\msms5\\DnvScore\\all_db_hits",
"C:\\Work\\msms5\\DnvScore\\seq_freqs\\sequences",
"C:\\Work\\msms5\\DnvScore\\dnv_full_parts",
"C:\\Work\\msms5\\DnvScore\\dicty2_all.txt",
2,2);
exit(0);
drs.read_denovo_rank_scorer_model("C:\\Work\\msms5\\PepNovoHQ\\Models\\DBSCORE\\DBSCORE_rank_model.txt");
drs.rescore_inspect_results("C:\\Work\\msms5\\DnvScore\\inspect_res\\H293-40ul-08.mzXML",
"C:\\Work\\msms5\\DnvScore\\inspect_res\\H293-40ul-08.txt",
"C:\\Work\\msms5\\DnvScore\\inspect_res\\H293-40ul-08_new.txt");
exit(0);
// test_denovo_integrity(model,"C:\\Work\\msms5\\DnvScore\\all_ds\\Dicty_98_2_unique_8.mgf", 20000, 8);
// benchmark_ranking_on_denovo("C:\\Work\\msms5\\PepNovoHQ\\Models\\DNVSCORE5\\DNVSCORE5_rank_model.txt",
// "C:\\Work\\msms5\\DnvScore\\test\\DNVSCORE4_test_10.mgf",400,10); //
// benchmark_ranking_on_full_denovo("C:\\Work\\msms5\\PepNovoHQ\\Models\\DNVFULL\\DNVFULL_rank_model.txt",
// "C:\\Work\\msms5\\DnvScore\\test\\FULL_test_10.mgf",1000);
// exit(0);
fm.init_from_list_file(config,//"C:\\Work\\msms5\\DnvScore\\short2_train_mgf_list.txt");
"C:\\Work\\msms5\\DnvScore\\comp2_train_mgf_list.txt");
// "C:\\Work\\msms5\\NewScore\\lists\\Shew_98_3_unique_mgf_list.txt");
fs.select_files(fm,0,2500,-1,-1,2);
find_special_PTM_frags_using_offset_counts("S",fm,fs.get_ssf_pointers(),&model,2);
exit(0);
drs.read_denovo_rank_scorer_model("C:\\Work\\msms5\\PepNovoHQ\\Models\\DNVSC_RANK\\LTQ_DNVRANK_model.txt");
drs.test_model("C:\\Work\\msms5\\DnvScore\\test_sets\\LTQ_DNVRANK_test_10.mgf",2000);
drs.train_denovo_partition_model("C:\\Work\\msms5\\DnvScore\\all_db_hits",
"C:\\Work\\msms5\\DnvScore\\seq_freqs\\sequences",
"C:\\Work\\msms5\\DnvScore\\comp_all_parts",
// "C:\\Work\\msms5\\DnvScore\\short2_train_mgf_list.txt",
"C:\\Work\\msms5\\DnvScore\\comp2_train_mgf_list.txt",
2,
1,
30000,
5);
// model.read_model("ETD");
// config = model.get_config();
// config->apply_selected_PTMs("M+16:Q-17:N+1:C+57");
// fm.init_from_list_file(config,"C:\\Work\\msms5\\PepNovoHQ\\ETD2\\ETD_unique_train.txt");
//.........这里部分代码省略.........
示例14: add_to_fileset
void LibraryFile::add_to_fileset(FileSet& fileset) { fileset.add_library(this); }
示例15: set_frag_pair_sum_offset
void PMCSQS_Scorer::train_sqs_models(Config *config,
const FileManager& fm_pos,
const char *neg_list,
int specificCharge,
vector<vector<float> > *inputWeights)
{
vector< vector< vector<ME_Regression_Sample> > > samples; // neg, p1, p2, p3 / sizeIndex
FileManager fm_neg;
const vector<int>& spectra_counts = fm_pos.get_spectra_counts();
maximalChargeWithModels_ = (inputWeights ? inputWeights->size()-1 : 3);
int charge;
set_frag_pair_sum_offset(MASS_PROTON); // b+y - PM+19
set_bin_increment(0.1);
this->set_sqs_mass_thresholds();
if (this->pmcMassThresholds_.size() == 0)
{
pmcMassThresholds_=config->get_size_thresholds();
}
vector<vector<float> > classWeights;
if (inputWeights)
{
classWeights = *inputWeights;
}
else
{
classWeights.resize(maximalChargeWithModels_+1);
int i;
for (i=0; i<classWeights.size(); i++)
classWeights[i].resize(maximalChargeWithModels_+1,1.0);
}
const int numSizes = this->sqsMassThresholds_.size();
cout << "NUM SIZE MODELS: " << numSizes+1 << endl;
samples.resize(maximalChargeWithModels_+1);
fm_neg.init_from_list_file(config, neg_list);
const int max_to_read_per_file = 8000;
for (charge=0; charge<=maximalChargeWithModels_; charge++)
{
if (charge>0 && specificCharge>0 && charge != specificCharge)
continue;
int sizeIndex;
for (sizeIndex=0; sizeIndex<=numSizes; sizeIndex++)
{
const mass_t minMass = (sizeIndex == 0 ? 0 : sqsMassThresholds_[sizeIndex-1]);
const mass_t maxMass = (sizeIndex == numSizes ? POS_INF : sqsMassThresholds_[sizeIndex]);
samples[charge].resize(numSizes+1);
BasicSpecReader bsr;
QCPeak peaks[5000];
FileSet fs;
if (charge == 0)
{
fs.select_files_in_mz_range(fm_neg,minMass, maxMass,0);
}
else
{
fs.select_files_in_mz_range(fm_pos, minMass, maxMass, charge);
}
cout << "Found " << fs.get_total_spectra() << " for charge " << charge << " ranges:" <<
minMass << " - " << maxMass << endl;
fs.randomly_reduce_ssfs(max_to_read_per_file);
const vector<SingleSpectrumFile *>& all_ssf = fs.get_ssf_pointers();
const int label = (charge == 0 ? 1 : 0);
const int num_samples = all_ssf.size();
samples[charge][sizeIndex].resize(num_samples);
int i;
for (i=0; i<num_samples; i++)
{
SingleSpectrumFile* ssf = all_ssf[i];
BasicSpectrum bs;
bs.peaks = peaks;
bs.ssf = ssf;
if (charge==0)
{
bs.num_peaks = bsr.read_basic_spec(config,fm_neg,ssf,peaks);
bs.ssf->charge=0;
}
else
bs.num_peaks = bsr.read_basic_spec(config,fm_pos,ssf,peaks);
init_for_current_spec(config,bs);
calculate_curr_spec_pmc_values(bs, bin_increment);
//.........这里部分代码省略.........