breeder ++
This commit is contained in:
parent
968b0ca525
commit
e3cdb7d7d2
3 changed files with 39 additions and 6 deletions
18
Breeder.cpp
18
Breeder.cpp
|
@ -82,15 +82,21 @@ int main ( int argc, char **argv ) {
|
|||
if( !breederConfig::fexists() ) {
|
||||
breederConfig::init();
|
||||
}
|
||||
|
||||
|
||||
boost::property_tree::ptree config = breederConfig::load();
|
||||
|
||||
vector<string> pselect = vm["filters"].as< vector<string> >();
|
||||
vector<string> pavailable;
|
||||
string temp = config.get<std::string>("global.protocols");
|
||||
vector< string > pselect = vm["filters"].as< vector< string > >();
|
||||
vector< string > pavailable;
|
||||
string temp = config.get< std::string >("global.protocols");
|
||||
boost::algorithm::split ( pavailable, temp, boost::algorithm::is_any_of ( " " ) );
|
||||
|
||||
|
||||
|
||||
list< string > filters = breederConfig::protocolsValidation( pselect, pavailable );
|
||||
|
||||
if ( filters.empty() ) {
|
||||
std::cerr<<"ERROR >> You have not selected any protocol!"<<std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
// TODO
|
||||
|
||||
list<std::string> regularexpressions;
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
*/
|
||||
|
||||
#include <string>
|
||||
#include <list>
|
||||
#include <vector>
|
||||
#include <fstream>
|
||||
#include <boost/property_tree/ptree.hpp>
|
||||
#include <boost/property_tree/ini_parser.hpp>
|
||||
|
@ -77,4 +79,25 @@ bool breederConfig::fexists()
|
|||
|
||||
}
|
||||
|
||||
std::list< std::string > breederConfig::protocolsValidation(std::vector< std::string > select, std::vector< std::string > available)
|
||||
{
|
||||
|
||||
std::list< std::string > out;
|
||||
|
||||
for (std::vector< std::string >::iterator it = select.begin(); it != select.end(); ++it) {
|
||||
|
||||
for (std::vector< std::string >::iterator it2 = available.begin(); it2 != available.end(); ++it2) {
|
||||
|
||||
if( (*it).compare(*it2) == 0 ) {
|
||||
out.push_back(*it);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return out;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -31,6 +31,9 @@
|
|||
|
||||
#define FILECONFIG "breeder.conf"
|
||||
|
||||
#include <string>
|
||||
#include <list>
|
||||
#include <vector>
|
||||
#include <boost/property_tree/ptree.hpp>
|
||||
|
||||
namespace breederConfig {
|
||||
|
@ -38,6 +41,7 @@ namespace breederConfig {
|
|||
void init();
|
||||
boost::property_tree::ptree load();
|
||||
bool fexists();
|
||||
std::list<std::string> protocolsValidation(std::vector<std::string> select, std::vector<std::string> available);
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue