diff options
author | Andreas Baumann <mail@andreasbaumann.cc> | 2015-04-17 21:09:36 +0200 |
---|---|---|
committer | Andreas Baumann <mail@andreasbaumann.cc> | 2015-04-17 21:09:36 +0200 |
commit | d4c3033adcfa359ae0c82a0d3b1bee6a96245ba1 (patch) | |
tree | 5aa9045bd218ff3d7e8022bfb465e7bc4afa8bfb /src | |
download | aCms-d4c3033adcfa359ae0c82a0d3b1bee6a96245ba1.tar.gz aCms-d4c3033adcfa359ae0c82a0d3b1bee6a96245ba1.tar.bz2 |
first raw empty classes and structure
Diffstat (limited to 'src')
-rw-r--r-- | src/content.hpp | 6 | ||||
-rw-r--r-- | src/main.cpp | 58 | ||||
-rw-r--r-- | src/master_content.hpp | 16 | ||||
-rw-r--r-- | src/strusCms.cpp | 5 | ||||
-rw-r--r-- | src/strusCms.hpp | 11 |
5 files changed, 96 insertions, 0 deletions
diff --git a/src/content.hpp b/src/content.hpp new file mode 100644 index 0000000..e476702 --- /dev/null +++ b/src/content.hpp @@ -0,0 +1,6 @@ +#ifndef CONTENT_HPP +#define CONTENT_HPP + +#include "master_content.hpp" + +#endif diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..9005e20 --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,58 @@ +#include <cppcms/service.h> +#include <cppcms/applications_pool.h> +#include <booster/log.h> + +#include <signal.h> + +#include "strusCms.hpp" + +static bool terminate = false; +static bool got_sighup = false; +static cppcms::service *global_srv = 0; + +static void handle_signal( int sig ) +{ + switch( sig ) { + case SIGHUP: + got_sighup = true; + if( global_srv ) global_srv->shutdown( ); + break; + + default: + // unknown signal, ignore + break; + } +} + +int main( int argc, char *argv[] ) +{ + signal( SIGHUP, handle_signal ); + while( !terminate ) { + cppcms::service srv( argc, argv ); + global_srv = &srv; + + try { + BOOSTER_INFO( "strusCms" ) << "Restarting application.."; + + srv.applications_pool( ).mount( cppcms::applications_factory<strusCms>( ) ); + + srv.run( ); + + if( got_sighup ) { + BOOSTER_INFO( "strusCms" ) << "Reloading configuration on SIGHUP.."; + got_sighup = false; + } else { + terminate = true; + } + + } catch( std::exception const &e ) { + BOOSTER_ERROR( "strusCms" ) << e.what() ; + srv.shutdown( ); + continue; + } + + srv.shutdown( ); + } + + return 0; +} diff --git a/src/master_content.hpp b/src/master_content.hpp new file mode 100644 index 0000000..af331d0 --- /dev/null +++ b/src/master_content.hpp @@ -0,0 +1,16 @@ +#ifndef MASTER_CONTENT_HPP +#define MASTER_CONTENT_HPP + +#include <cppcms/view.h> + +#include <string> + +namespace content { + +struct master : public cppcms::base_content { + std::string title; +}; + +} + +#endif diff --git a/src/strusCms.cpp b/src/strusCms.cpp new file mode 100644 index 0000000..da535ef --- /dev/null +++ b/src/strusCms.cpp @@ -0,0 +1,5 @@ +#include "strusCms.hpp" + +strusCms::strusCms( cppcms::service &srv ) : cppcms::application( srv ) +{ +} diff --git a/src/strusCms.hpp b/src/strusCms.hpp new file mode 100644 index 0000000..6dff31f --- /dev/null +++ b/src/strusCms.hpp @@ -0,0 +1,11 @@ +#ifndef STRUS_CMS_HPP +#define STRUS_CMS_HPP + +#include <cppcms/application.h> + +class strusCms : public cppcms::application { + public: + strusCms( cppcms::service &srv ); +}; + +#endif |