// file : web/apache/service -*- C++ -*- // copyright : Copyright (c) 2014-2015 Code Synthesis Tools CC // license : MIT; see accompanying LICENSE file #ifndef WEB_APACHE_SERVICE #define WEB_APACHE_SERVICE #include #include namespace web { namespace apache { class service { public: // Note that the module exemplar is stored by-reference. // template service (const std::string& name, const M& exemplar) : exemplar_ (exemplar), handle_ (&handle_impl) {} //@@ Implementation calls handle_ function pointer below: // // handle_ (rq, rs, l, exemplar_); // private: template static void handle_impl (request& rq, response& rs, log& l, const module& exemplar) { M m (static_cast (exemplar)); static_cast (m).handle (rq, rs, l); } const module& exemplar_; void (*handle_) (request&, response&, log&, const module&); }; } } #endif // WEB_APACHE_SERVICE