aboutsummaryrefslogtreecommitdiff
path: root/web/apache
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-04-09 15:44:57 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-04-09 15:44:57 +0200
commit9d346aa8894e567d2871125826488c2ca181d0f5 (patch)
tree870664c4612d246c37d687fba7156de33568bec6 /web/apache
parentcf5c6478240d8e4fe88c4abddf2234ef18b71c4f (diff)
Further interface prototyping
Diffstat (limited to 'web/apache')
-rw-r--r--web/apache/service46
1 files changed, 46 insertions, 0 deletions
diff --git a/web/apache/service b/web/apache/service
new file mode 100644
index 0000000..3c7a398
--- /dev/null
+++ b/web/apache/service
@@ -0,0 +1,46 @@
+// 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 <string>
+
+#include <web/module>
+
+namespace web
+{
+ namespace apache
+ {
+ class service_common
+ {
+ //@@ Implementation that calls handle() below goes here.
+ //
+
+ virtual void
+ handle (request&, response&, log&) = 0;
+ };
+
+ template <typename M>
+ class service: public service_common
+ {
+ public:
+ // Note that the module exemplar is stored by-reference.
+ //
+ service (const std::string& name, const M& exemplar);
+
+ virtual void
+ handle (request& rq, response& rs, log& l)
+ {
+ M m (exemplar_);
+ m.handle (rq, rs, l);
+ }
+
+ private:
+ const M& exemplar_;
+ };
+ }
+}
+
+#endif // WEB_APACHE_SERVICE