1 /* $Id: ex_router_flexml.cpp,v 1.7 2006-01-16 11:22:56 adam Exp $
2 Copyright (c) 2005, Index Data.
9 #include <boost/program_options.hpp>
10 namespace po = boost::program_options;
16 #include "package.hpp"
17 #include "router_flexml.hpp"
18 #include "factory_static.hpp"
20 int main(int argc, char **argv)
24 po::options_description desc("Allowed options");
26 ("help", "produce help message")
27 ("config", po::value< std::vector<std::string> >(), "xml config")
30 po::positional_options_description p;
34 po::store(po::command_line_parser(argc, argv).
35 options(desc).positional(p).run(), vm);
38 if (vm.count("help")) {
39 std::cout << desc << "\n";
44 if (vm.count("config"))
46 std::vector<std::string> config_fnames =
47 vm["config"].as< std::vector<std::string> >();
49 if (config_fnames.size() != 1)
51 std::cerr << "Only one configuration must be given\n";
55 doc = xmlParseFile(config_fnames[0].c_str());
58 std::cerr << "xmlParseFile failed\n";
64 std::cerr << "No configuration given\n";
69 yp2::FactoryStatic factory;
70 yp2::RouterFleXML router(doc, factory);
74 pack.router(router).move();
80 std::cerr << "Unknown Exception" << std::endl;
91 * indent-tabs-mode: nil
92 * c-file-style: "stroustrup"
94 * vim: shiftwidth=4 tabstop=8 expandtab