source: trunk/GDE/SINA/builddir/src/search.cpp

Last change on this file was 19170, checked in by westram, 2 years ago
  • sina source
    • unpack + remove tarball
    • no longer ignore sina builddir.
File size: 1008 bytes
Line 
1#include "search.h"
2#include <ostream>
3
4#include <boost/program_options.hpp>
5namespace po = boost::program_options;
6
7#include <boost/algorithm/string/predicate.hpp>
8using boost::algorithm::istarts_with;
9using boost::algorithm::iequals;
10
11namespace sina {
12
13void validate(boost::any& v,
14              const std::vector<std::string>& values,
15              ENGINE_TYPE* /*tt*/, int /*unused*/) {
16    using namespace boost::program_options;
17    validators::check_first_occurrence(v);
18    const std::string& s = validators::get_single_string(values);
19    if (iequals(s, "pt-server")) {
20        v = ENGINE_ARB_PT;
21    } else if (iequals(s, "internal")) {
22        v = ENGINE_SINA_KMER;
23    } else {
24        throw po::invalid_option_value(s);
25    }
26}
27
28std::ostream& operator<<(std::ostream& out, const ENGINE_TYPE& t) {
29    switch(t) {
30    case ENGINE_ARB_PT: out << "pt-server"; break;
31    case ENGINE_SINA_KMER: out << "internal"; break;
32    default: out << "[UNKNOWN!]";
33    }
34    return out;
35}
36} // namespace sina
Note: See TracBrowser for help on using the repository browser.