FACT++  1.0
int main ( int  argc,
const char **  argv 
)

Definition at line 620 of file fad.cc.

References Configuration::Get(), Configuration::HasHelp(), Configuration::HasPrint(), Configuration::HasVersion(), i, Configuration::Parse(), Dim::Setup(), SetupConfiguration(), and DimServer::start().

621 {
622  ::Configuration conf(argv[0]);
623 
624  SetupConfiguration(conf);
625 
626  po::variables_map vm;
627  try
628  {
629  vm = conf.Parse(argc, argv);
630  }
631 #if BOOST_VERSION > 104000
632  catch (po::multiple_occurrences &e)
633  {
634  cerr << "Program options invalid due to: " << e.what() << " of '" << e.get_option_name() << "'." << endl;
635  return -1;
636  }
637 #endif
638  catch (exception& e)
639  {
640  cerr << "Program options invalid due to: " << e.what() << endl;
641  return -1;
642  }
643 
644  if (conf.HasVersion() || conf.HasPrint() || conf.HasHelp())
645  return -1;
646 
647  Dim::Setup(conf.Get<string>("dns"));
648 
649  DimServer::start("FAD");
650 
651  //try
652  {
653  ba::io_service io_service;
654 
655  const uint16_t n = conf.Get<uint16_t>("num");
656  uint16_t port = conf.Get<uint16_t>("port");
657 
658  vector<shared_ptr<tcp_server>> servers;
659 
660  for (int i=0; i<n; i++)
661  {
662  shared_ptr<tcp_server> server(new tcp_server(io_service, port, i));
663  servers.push_back(server);
664 
665  port += 8;
666  }
667 
668  // ba::add_service(io_service, &server);
669  // server.add_service(...);
670  //cout << "Run..." << flush;
671 
672  // Calling run() from a single thread ensures no concurrent access
673  // of the handler which are called!!!
674  io_service.run();
675 
676  //cout << "end." << endl;
677  }
678  /*catch (std::exception& e)
679  {
680  std::cerr << e.what() << std::endl;
681  }*/
682 
683  return 0;
684 }
int i
Definition: db_dim_client.c:21
void Setup(const std::string &dns="", const std::string &host="")
Definition: DimSetup.cc:160
Commandline parsing, resource file parsing and database access.
Definition: Configuration.h:9
static void start()
Definition: discpp.cxx:512
void SetupConfiguration(::Configuration &conf)
Definition: fad.cc:599

+ Here is the call graph for this function: