Dripline-Cpp  v2.10.11
Dripline Implementation in C++
run_simple_service.cc
Go to the documentation of this file.
1 /*
2  * run_simple_service.cc
3  *
4  * Created on: Aug 23, 2018
5  * Author: N.S. Oblath
6  */
7 
8 #include "agent_config.hh"
9 #include "dripline_constants.hh"
10 #include "application.hh"
11 #include "logger.hh"
12 #include "service_config.hh"
13 #include "signal_handler.hh"
14 #include "version_store.hh"
15 #include "simple_service.hh"
16 
17 using namespace dripline;
18 
19 LOGGER( dlog, "simple_service" );
20 
21 int main( int argc, char** argv )
22 {
23  // Start handling signals
24  scarab::signal_handler t_sig_hand( true );
25 
26  scarab::main_app the_main;
27 
28  the_main.set_version( version_store::get_instance()->versions().at( "dripline-cpp" ) );
29 
30  the_main.default_config() = service_config( "simple" );
31 
32  add_dripline_options( the_main );
33  add_service_options( the_main );
34 
35  int the_return = -1;
36 
37  auto t_service_callback = [&](){
38  auto the_service = std::make_shared< simple_service >( the_main.primary_config(), the_main.auth() );
39 
40  the_service->execute();
41 
42  the_return = the_service->get_return();
43  };
44 
45  the_main.callback( t_service_callback );
46 
47  CLI11_PARSE( the_main, argc, argv );
48 
49  return the_return;
50 }
Sets the default service configuration.
void add_service_options(scarab::main_app &an_app)
Add service options to an app object.
static ::scarab::logger_type< ::scarab::spd_initializer_async_stdout_color_mt > dlog("agent", __FILE_NAME__, __LINE__)
void add_dripline_options(scarab::main_app &an_app)
Add dripline mesh CL options to an app object.
int main(int argc, char **argv)