Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
appbase::plugin< Impl > Class Template Reference

#include <application.hpp>

Inheritance diagram for appbase::plugin< Impl >:
Collaboration diagram for appbase::plugin< Impl >:

Public Member Functions

 plugin ()
 
virtual ~plugin ()
 
virtual state get_state () const override
 
virtual const std::string & name () const override
 
virtual void register_dependencies ()
 
virtual void initialize (const variables_map &options) override
 
virtual void handle_sighup () override
 
virtual void startup () override
 
virtual void shutdown () override
 
- Public Member Functions inherited from appbase::abstract_plugin
virtual ~abstract_plugin ()
 
virtual void set_program_options (options_description &cli, options_description &cfg)=0
 

Protected Member Functions

 plugin (const string &name)
 

Additional Inherited Members

- Public Types inherited from appbase::abstract_plugin
enum  state { registered , initialized , started , stopped }
 

Detailed Description

template<typename Impl>
class appbase::plugin< Impl >

Definition at line 48 of file plugin.hpp.

Constructor & Destructor Documentation

◆ plugin() [1/2]

template<typename Impl >
appbase::plugin< Impl >::plugin ( )
inline

Definition at line 284 of file application.hpp.

284:_name(boost::core::demangle(typeid(Impl).name())){}
virtual const std::string & name() const override

◆ ~plugin()

template<typename Impl >
virtual appbase::plugin< Impl >::~plugin ( )
inlinevirtual

Definition at line 285 of file application.hpp.

285{}

◆ plugin() [2/2]

template<typename Impl >
appbase::plugin< Impl >::plugin ( const string & name)
inlineprotected

Definition at line 327 of file application.hpp.

327: _name(name){}

Member Function Documentation

◆ get_state()

template<typename Impl >
virtual state appbase::plugin< Impl >::get_state ( ) const
inlineoverridevirtual

Implements appbase::abstract_plugin.

Definition at line 287 of file application.hpp.

287{ return _state; }
Here is the caller graph for this function:

◆ handle_sighup()

template<typename Impl >
virtual void appbase::plugin< Impl >::handle_sighup ( )
inlineoverridevirtual

◆ initialize()

template<typename Impl >
virtual void appbase::plugin< Impl >::initialize ( const variables_map & options)
inlineoverridevirtual

if initial state was not registered, final state cannot be initialized

Implements appbase::abstract_plugin.

Definition at line 294 of file application.hpp.

294 {
295 if(_state == registered) {
296 _state = initialized;
297 static_cast<Impl*>(this)->plugin_requires([&](auto& plug){ plug.initialize(options); });
298 static_cast<Impl*>(this)->plugin_initialize(options);
299 //ilog( "initializing plugin ${name}", ("name",name()) );
300 app().plugin_initialized(*this);
301 }
302 assert(_state == initialized);
303 }
@ 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
void plugin_initialized(abstract_plugin &plug)
application & app()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ name()

template<typename Impl >
virtual const std::string & appbase::plugin< Impl >::name ( ) const
inlineoverridevirtual

Implements appbase::abstract_plugin.

Definition at line 288 of file application.hpp.

288{ return _name; }

◆ register_dependencies()

template<typename Impl >
virtual void appbase::plugin< Impl >::register_dependencies ( )
inlinevirtual

Definition at line 290 of file application.hpp.

290 {
291 static_cast<Impl*>(this)->plugin_requires([&](auto& plug){});
292 }

◆ shutdown()

template<typename Impl >
virtual void appbase::plugin< Impl >::shutdown ( )
inlineoverridevirtual

Implements appbase::abstract_plugin.

Definition at line 318 of file application.hpp.

318 {
319 if(_state == started) {
320 _state = stopped;
321 //ilog( "shutting down plugin ${name}", ("name",name()) );
322 static_cast<Impl*>(this)->plugin_shutdown();
323 }
324 }
@ stopped
the plugin is no longer running
Definition plugin.hpp:34
@ started
the plugin is actively running
Definition plugin.hpp:33

◆ startup()

template<typename Impl >
virtual void appbase::plugin< Impl >::startup ( )
inlineoverridevirtual

Implements appbase::abstract_plugin.

Definition at line 308 of file application.hpp.

308 {
309 if(_state == initialized) {
310 _state = started;
311 static_cast<Impl*>(this)->plugin_requires([&](auto& plug){ plug.startup(); });
312 static_cast<Impl*>(this)->plugin_startup();
313 app().plugin_started(*this);
314 }
315 assert(_state == started); // if initial state was not initialized, final state cannot be started
316 }
void plugin_started(abstract_plugin &plug)
Here is the call graph for this function:
Here is the caller graph for this function:

The documentation for this class was generated from the following files: