Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
plugin.hpp
Go to the documentation of this file.
1#pragma once
2#include <boost/program_options.hpp>
3#include <boost/preprocessor/seq/for_each.hpp>
4#include <string>
5#include <vector>
6#include <map>
7
8#define APPBASE_PLUGIN_REQUIRES_VISIT( r, visitor, elem ) \
9 visitor( appbase::app().register_plugin<elem>() );
10
11#define APPBASE_PLUGIN_REQUIRES( PLUGINS ) \
12 template<typename Lambda> \
13 void plugin_requires( Lambda&& l ) { \
14 BOOST_PP_SEQ_FOR_EACH( APPBASE_PLUGIN_REQUIRES_VISIT, l, PLUGINS ) \
15 }
16
17namespace appbase {
18
19 using boost::program_options::options_description;
20 using boost::program_options::variables_map;
21 using std::string;
22 using std::vector;
23 using std::map;
24
25 class application;
26 application& app();
27
29 public:
36
37 virtual ~abstract_plugin(){}
38 virtual state get_state()const = 0;
39 virtual const std::string& name()const = 0;
40 virtual void set_program_options( options_description& cli, options_description& cfg ) = 0;
41 virtual void initialize(const variables_map& options) = 0;
42 virtual void handle_sighup() = 0;
43 virtual void startup() = 0;
44 virtual void shutdown() = 0;
45 };
46
47 template<typename Impl>
48 class plugin;
49}
virtual void set_program_options(options_description &cli, options_description &cfg)=0
virtual void handle_sighup()=0
virtual ~abstract_plugin()
Definition plugin.hpp:37
@ stopped
the plugin is no longer running
Definition plugin.hpp:34
@ started
the plugin is actively running
Definition plugin.hpp:33
@ initialized
the plugin has initialized any state required but is idle
Definition plugin.hpp:32
@ registered
the plugin is constructed but doesn't do anything
Definition plugin.hpp:31
virtual const std::string & name() const =0
virtual void initialize(const variables_map &options)=0
virtual state get_state() const =0
virtual void shutdown()=0
virtual void startup()=0
application & app()
void cli()