From 36adc76235fb0a38e7042bc751f988b71627e2a0 Mon Sep 17 00:00:00 2001 From: jsdelfino Date: Tue, 11 Dec 2012 06:13:02 +0000 Subject: Changes to get successful C++11 based build. Code cleanup, dependency upgrades, and const + inline optimizations in components, samples, and app hosting server. git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1420007 13f79535-47bb-0310-9956-ffa450edef68 --- sca-cpp/trunk/components/log/log.cpp | 37 +++++++++++------------------------- 1 file changed, 11 insertions(+), 26 deletions(-) (limited to 'sca-cpp/trunk/components/log/log.cpp') diff --git a/sca-cpp/trunk/components/log/log.cpp b/sca-cpp/trunk/components/log/log.cpp index f7f7086192..11d24c8da5 100644 --- a/sca-cpp/trunk/components/log/log.cpp +++ b/sca-cpp/trunk/components/log/log.cpp @@ -38,7 +38,7 @@ namespace log { /** * Post an item to the Scribe log. */ -const failable post(const list& params, const value& host, const value& category, scribe::Scribe& sc) { +const failable post(const list& params, const value& host, const value& category, const scribe::Scribe& sc) { debug(cadr(params), "log::post::value"); const failable val = scribe::log(cadr(params), host, category, sc); if (!hasContent(val)) @@ -46,42 +46,27 @@ const failable post(const list& params, const value& host, const v return value(mklist(true)); } -/** - * Component implementation lambda function. - */ -class applyLog { -public: - applyLog(const value& host, const value& category, scribe::Scribe& sc) : host(host), category(category), sc(sc) { - } - - const value operator()(const list& params) const { - const value func(car(params)); - if (func == "post") - return post(cdr(params), host, category, sc); - return mkfailure(); - } - -private: - const value host; - const value category; - scribe::Scribe& sc; -}; - /** * Start the component. */ const failable start(const list& params) { // Connect to Scribe - scribe::Scribe& sc = *(new (gc_new()) scribe::Scribe("localhost", 1464)); + const scribe::Scribe& sc = *(new (gc_new()) scribe::Scribe("localhost", 1464)); // Extract the configured category - const value host = ((lambda&)>)car(params))(list()); - const value category = ((lambda&)>)cadr(params))(list()); + const value host = ((lvvlambda)car(params))(nilListValue); + const value category = ((lvvlambda)cadr(params))(nilListValue); debug(host, "log::start::host"); debug(category, "log::start::category"); // Return the component implementation lambda function - return value(lambda&)>(applyLog(host, category, sc))); + const lvvlambda applyLog = [host, category, sc](const list& params) -> const value { + const value func(car(params)); + if (func == "post") + return post(cdr(params), host, category, sc); + return mkfailure(); + }; + return value(applyLog); } } -- cgit v1.2.3