alaCarte Maps
Renderer for OpenStreetMap tiles
application.hpp
Go to the documentation of this file.
1 
21 #pragma once
22 #ifndef APPLICATION_HPP
23 #define APPLICATION_HPP
24 
25 #include <boost/program_options.hpp>
26 #include <boost/exception/enable_error_info.hpp>
27 #include <boost/exception/error_info.hpp>
28 
29 #include <boost/log/sinks/sync_frontend.hpp>
30 #include <boost/log/sinks/text_file_backend.hpp>
31 #include <boost/log/sinks/text_ostream_backend.hpp>
32 
33 #include "settings.hpp"
34 
35 
36 class Configuration;
37 
39 {
40 public:
41  Application();
42 
43  int start(int argc, char** argv);
44 
45 protected:
46 
47  virtual void onRun(const shared_ptr<Configuration>& config) = 0;
48  virtual void customInitLog(const shared_ptr<Configuration>& config) {};
49  virtual bool startupDiagnostic(const shared_ptr<Configuration>& config) = 0;
50 
51  boost::program_options::options_description cmd_desc;
52  boost::program_options::options_description config_desc;
53  boost::program_options::positional_options_description pos_desc;
54 
55  bool diagnosticCheckFile(const shared_ptr<Configuration>& config, const string& key);
56 
57  shared_ptr< logging::sinks::synchronous_sink< logging::sinks::text_file_backend > > fileLogger;
58  shared_ptr< logging::sinks::synchronous_sink< logging::sinks::basic_text_ostream_backend< char > >> consoleLogger;
59 
60 private:
61  void appRun(int argc, char** argv);
62 
63  void initLog(const shared_ptr<Configuration>& config);
64 };
65 
66 
67 #endif
boost::program_options::positional_options_description pos_desc
Definition: application.hpp:53
virtual bool startupDiagnostic(const shared_ptr< Configuration > &config)=0
virtual void onRun(const shared_ptr< Configuration > &config)=0
shared_ptr< logging::sinks::synchronous_sink< logging::sinks::basic_text_ostream_backend< char > > > consoleLogger
Definition: application.hpp:58
Application()
Inits the new Application.
shared_ptr< logging::sinks::synchronous_sink< logging::sinks::text_file_backend > > fileLogger
Definition: application.hpp:57
virtual void customInitLog(const shared_ptr< Configuration > &config)
Definition: application.hpp:48
bool diagnosticCheckFile(const shared_ptr< Configuration > &config, const string &key)
boost::program_options::options_description config_desc
Definition: application.hpp:52
void appRun(int argc, char **argv)
Creates the Configuration and runs the application.
boost::program_options::options_description cmd_desc
Definition: application.hpp:51
static const char * config
Option to get the configuration filename (type: string)
Represents a set of options accessible via strings.
int start(int argc, char **argv)
Starts the aplication with or without Exceptionhandling.
void initLog(const shared_ptr< Configuration > &config)
Inits the logfile.