int MatchingApplication::match() { try{ addOptions(); processArguments(); initConfiguration(); // Cleaning if(w_) delete w_; if(g1_) delete g1_; if(g2_) delete g2_; if(gl1_) delete gl1_; if(gl2_) delete gl2_; w_ = 0; g1_ = g2_ = 0; gl1_ = gl2_ = 0; // Check number of arguments QStringList args = positionalArguments(); if(args.size() != 2) Exception(QString("You must provide exactly two %1 (%2 given)").arg(isMultiMatching_?"directories":"graphs").arg(args.size())); // Loading weights and graphs w_ = new Weights(cfg_->substitution, cfg_->creation); if(isMultiMatching_) { gl1_ = new GraphList(QDir(args.at(0)), cfg_->ext); gl2_ = (args.at(0).compare(args.at(1)) == 0)? gl1_ : new GraphList(QDir(args.at(1)), cfg_->ext); } else { g1_ = new Graph(args.at(0)); g2_ = new Graph(args.at(1)); } initMatrix(); QThreadPool::globalInstance()->setMaxThreadCount(cfg_->parallelInstances); // Running the matching(s) if(isMultiMatching_) { for(auto i : *gl1_) for(auto j : *gl2_) if((gl1_ != gl2_) || (j->getIndex() > i->getIndex())) queue_.enqueue(qMakePair(i,j)); } else { queue_.enqueue(qMakePair(g1_, g2_)); } populate(); return exec(); } catch(std::exception &e) { error(e); } return EXIT_FAILURE; }
QStringList CommandLineParser::GetFilmsToAdd() const { return( positionalArguments() ); }