summaryrefslogtreecommitdiffstats
path: root/sca-cpp/trunk/components
diff options
context:
space:
mode:
authorjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2012-07-16 06:48:11 +0000
committerjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2012-07-16 06:48:11 +0000
commit574ccee478b9da9457cdf0e476b8df6eb584b580 (patch)
tree5a8166f47057ed322294db7816e2732d1d18f7bc /sca-cpp/trunk/components
parent419f903ff44a22debba43976baae1e86c1e5d871 (diff)
Minor memory management, performance, and tracing improvements.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1361917 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-cpp/trunk/components')
-rw-r--r--sca-cpp/trunk/components/cache/datacache.cpp8
-rw-r--r--sca-cpp/trunk/components/cache/memcache-test.cpp2
-rw-r--r--sca-cpp/trunk/components/cache/memcache.cpp2
-rw-r--r--sca-cpp/trunk/components/cache/memcache.hpp34
-rw-r--r--sca-cpp/trunk/components/cache/memocache.cpp2
-rw-r--r--sca-cpp/trunk/components/cache/partitioner.cpp10
-rw-r--r--sca-cpp/trunk/components/chat/chat-sender.cpp4
-rw-r--r--sca-cpp/trunk/components/chat/chat-sender2.cpp4
-rw-r--r--sca-cpp/trunk/components/chat/chat-sendreceiver.cpp4
-rw-r--r--sca-cpp/trunk/components/chat/xmpp.hpp16
-rw-r--r--sca-cpp/trunk/components/constdb/constdb.cpp2
-rw-r--r--sca-cpp/trunk/components/constdb/tinycdb.hpp13
-rw-r--r--sca-cpp/trunk/components/filedb/filedb.cpp4
-rw-r--r--sca-cpp/trunk/components/filedb/filedb.hpp12
-rw-r--r--sca-cpp/trunk/components/kvdb/client-test.cpp4
-rw-r--r--sca-cpp/trunk/components/kvdb/kvdb.cpp2
-rw-r--r--sca-cpp/trunk/components/kvdb/leveldb.hpp11
-rw-r--r--sca-cpp/trunk/components/log/log.cpp4
-rw-r--r--sca-cpp/trunk/components/log/logger.cpp4
-rw-r--r--sca-cpp/trunk/components/log/scribe-cat.cpp4
-rw-r--r--sca-cpp/trunk/components/log/scribe.hpp12
-rw-r--r--sca-cpp/trunk/components/queue/qpid.hpp9
-rw-r--r--sca-cpp/trunk/components/queue/queue-listener.cpp4
-rw-r--r--sca-cpp/trunk/components/queue/queue-sender.cpp2
-rw-r--r--sca-cpp/trunk/components/sqldb/pgsql.hpp13
-rw-r--r--sca-cpp/trunk/components/sqldb/sqldb.cpp4
-rw-r--r--sca-cpp/trunk/components/webservice/axis2.hpp9
27 files changed, 142 insertions, 57 deletions
diff --git a/sca-cpp/trunk/components/cache/datacache.cpp b/sca-cpp/trunk/components/cache/datacache.cpp
index c26e6eb868..c259ec33c6 100644
--- a/sca-cpp/trunk/components/cache/datacache.cpp
+++ b/sca-cpp/trunk/components/cache/datacache.cpp
@@ -44,7 +44,7 @@ namespace datacache {
/**
* Get an item from the cache.
*/
-const failable<value> get(const value& key, const lambda<value(const list<value>&)> rcache1, const lambda<value(const list<value>&)> wcache1, const lambda<value(const list<value>&)> rcache2, unused const lambda<value(const list<value>&)> wcache2) {
+const failable<value> get(const value& key, const lambda<value(const list<value>&)>& rcache1, const lambda<value(const list<value>&)>& wcache1, const lambda<value(const list<value>&)>& rcache2, unused const lambda<value(const list<value>&)>& wcache2) {
// Lookup level1 cache
const value val1 = rcache1(mklist<value>("get", key));
@@ -68,7 +68,7 @@ const failable<value> get(const value& key, const lambda<value(const list<value>
/**
* Post an item to the cache.
*/
-const failable<value> post(const value& key, const value& val, unused const lambda<value(const list<value>&)> rcache1, const lambda<value(const list<value>&)> wcache1, unused const lambda<value(const list<value>&)> rcache2, const lambda<value(const list<value>&)> wcache2) {
+const failable<value> post(const value& key, const value& val, unused const lambda<value(const list<value>&)>& rcache1, const lambda<value(const list<value>&)>& wcache1, unused const lambda<value(const list<value>&)>& rcache2, const lambda<value(const list<value>&)>& wcache2) {
const value id = append<value>(key, mklist(mkuuid()));
// Update level1 cache
@@ -83,7 +83,7 @@ const failable<value> post(const value& key, const value& val, unused const lamb
/**
* Put an item into the cache.
*/
-const failable<value> put(const value& key, const value& val, unused const lambda<value(const list<value>&)> rcache1, const lambda<value(const list<value>&)> wcache1, unused const lambda<value(const list<value>&)> rcache2, const lambda<value(const list<value>&)> wcache2) {
+const failable<value> put(const value& key, const value& val, unused const lambda<value(const list<value>&)>& rcache1, const lambda<value(const list<value>&)>& wcache1, unused const lambda<value(const list<value>&)>& rcache2, const lambda<value(const list<value>&)>& wcache2) {
// Update level1 cache
wcache1(mklist<value>("put", key, val));
@@ -97,7 +97,7 @@ const failable<value> put(const value& key, const value& val, unused const lambd
/**
* Delete an item from the cache.
*/
-const failable<value> del(const value& key, unused const lambda<value(const list<value>&)> rcache1, const lambda<value(const list<value>&)> wcache1, unused const lambda<value(const list<value>&)> rcache2, const lambda<value(const list<value>&)> wcache2) {
+const failable<value> del(const value& key, unused const lambda<value(const list<value>&)>& rcache1, const lambda<value(const list<value>&)>& wcache1, unused const lambda<value(const list<value>&)>& rcache2, const lambda<value(const list<value>&)>& wcache2) {
// Delete from level1 cache
wcache1(mklist<value>("delete", key));
diff --git a/sca-cpp/trunk/components/cache/memcache-test.cpp b/sca-cpp/trunk/components/cache/memcache-test.cpp
index 49848dd2a7..85fc339f1a 100644
--- a/sca-cpp/trunk/components/cache/memcache-test.cpp
+++ b/sca-cpp/trunk/components/cache/memcache-test.cpp
@@ -52,6 +52,7 @@ struct getLoop {
getLoop(const value& k, MemCached& ch) : k(k), ch(ch) {
}
const bool operator()() const {
+ gc_scoped_pool p;
assert(get(k, ch) == value(string("CCC")));
return true;
}
@@ -71,6 +72,7 @@ bool testGetPerf() {
}
int main() {
+ tuscany::gc_scoped_pool p;
tuscany::cout << "Testing..." << tuscany::endl;
tuscany::memcache::testMemCached();
diff --git a/sca-cpp/trunk/components/cache/memcache.cpp b/sca-cpp/trunk/components/cache/memcache.cpp
index af710696b3..738a6ddd5a 100644
--- a/sca-cpp/trunk/components/cache/memcache.cpp
+++ b/sca-cpp/trunk/components/cache/memcache.cpp
@@ -103,7 +103,7 @@ private:
const list<string> servers(const list<value>& params) {
if (isNil(params))
return list<string>();
- const value s = ((lambda<value(list<value>)>)car(params))(list<value>());
+ const value s = ((lambda<value(const list<value>&)>)car(params))(list<value>());
return cons<string>(s, servers(cdr(params)));
}
diff --git a/sca-cpp/trunk/components/cache/memcache.hpp b/sca-cpp/trunk/components/cache/memcache.hpp
index fe77c26671..f18405b2ec 100644
--- a/sca-cpp/trunk/components/cache/memcache.hpp
+++ b/sca-cpp/trunk/components/cache/memcache.hpp
@@ -49,38 +49,41 @@ namespace memcache {
class MemCached {
public:
MemCached() : owner(false) {
- debug("memcache::memcached");
}
- MemCached(const string host, const int port) : owner(true) {
+ MemCached(const string host, const int port) : p(), owner(true) {
debug(host, "memcache::memcached::host");
debug(port, "memcache::memcached::port");
- apr_pool_create(&pool, NULL);
- apr_memcache_create(pool, 1, 0, &mc);
+ apr_memcache_create(pool(p), 1, 0, &mc);
addServer(host, port);
}
- MemCached(const list<string>& servers) : owner(true) {
+ MemCached(const list<string>& servers) : p(), owner(true) {
debug(servers, "memcache::memcached::servers");
- apr_pool_create(&pool, NULL);
- apr_memcache_create(pool, (apr_uint16_t)length(servers), 0, &mc);
+ apr_memcache_create(pool(p), (apr_uint16_t)length(servers), 0, &mc);
addServers(servers);
}
- MemCached(const MemCached& c) : owner(false), pool(c.pool), mc(c.mc) {
+ MemCached(const MemCached& c) : p(c.p), owner(false), mc(c.mc) {
debug("memcache::memcached::copy");
}
+ const MemCached& operator=(const MemCached& c) {
+ debug("memcache::memcached::operator=");
+ if(this == &c)
+ return *this;
+ p = c.p;
+ owner = false;
+ mc = c.mc;
+ return *this;
+ }
+
~MemCached() {
- debug("memcache::~memcached");
- if (!owner)
- return;
- apr_pool_destroy(pool);
}
private:
+ gc_child_pool p;
bool owner;
- apr_pool_t* pool;
apr_memcache_t* mc;
friend const failable<bool> post(const value& key, const value& val, const MemCached& cache);
@@ -93,7 +96,7 @@ private:
*/
const failable<bool> addServer(const string& host, const int port) {
apr_memcache_server_t *server;
- const apr_status_t sc = apr_memcache_server_create(pool, c_str(host), (apr_port_t)port, 1, 1, 1, 600, &server);
+ const apr_status_t sc = apr_memcache_server_create(pool(p), c_str(host), (apr_port_t)port, 1, 1, 1, 600, &server);
if (sc != APR_SUCCESS) {
ostringstream os;
os << "Couldn't connect to memcached server: " << host << ":" << port;
@@ -176,7 +179,8 @@ const failable<value> get(const value& key, const MemCached& cache) {
const string ks(scheme::writeValue(key));
char *data;
apr_size_t size;
- const apr_status_t rc = apr_memcache_getp(cache.mc, cache.pool, nospaces(c_str(ks)), &data, &size, NULL);
+ gc_local_pool lp;
+ const apr_status_t rc = apr_memcache_getp(cache.mc, pool(lp), nospaces(c_str(ks)), &data, &size, NULL);
if (rc != APR_SUCCESS) {
ostringstream os;
os << "Couldn't get memcached entry: " << key;
diff --git a/sca-cpp/trunk/components/cache/memocache.cpp b/sca-cpp/trunk/components/cache/memocache.cpp
index 054638e275..e7e52cdc59 100644
--- a/sca-cpp/trunk/components/cache/memocache.cpp
+++ b/sca-cpp/trunk/components/cache/memocache.cpp
@@ -42,7 +42,7 @@ namespace memocache {
/**
* Memoize the value of a function application in a cache.
*/
-const failable<value> memoize(const list<value>& params, const lambda<value(const list<value>&)> relay, const lambda<value(const list<value>&)> cache) {
+const failable<value> memoize(const list<value>& params, const lambda<value(const list<value>&)>& relay, const lambda<value(const list<value>&)>& cache) {
debug(params, "memocache::memoize::params");
// Lookup memoized value from cache
diff --git a/sca-cpp/trunk/components/cache/partitioner.cpp b/sca-cpp/trunk/components/cache/partitioner.cpp
index ea12699977..e3f04ba112 100644
--- a/sca-cpp/trunk/components/cache/partitioner.cpp
+++ b/sca-cpp/trunk/components/cache/partitioner.cpp
@@ -40,7 +40,7 @@ namespace partitioner {
/**
* Return the target partition for a key.
*/
-const failable<lambda<value(const list<value>&)> > partition(const value& key, const lambda<value(const list<value>&)> selector, const list<value>& partitions) {
+const failable<lambda<value(const list<value>&)> > partition(const value& key, const lambda<value(const list<value>&)>& selector, const list<value>& partitions) {
// Call the selector component to convert the given key to a partition number
const value p = selector(mklist<value>("get", key, partitions));
@@ -55,7 +55,7 @@ const failable<lambda<value(const list<value>&)> > partition(const value& key, c
/**
* Get an item from a partition.
*/
-const failable<value> get(const value& key, const lambda<value(const list<value>&)> selector, const list<value>& partitions) {
+const failable<value> get(const value& key, const lambda<value(const list<value>&)>& selector, const list<value>& partitions) {
// Select partition
const failable<lambda<value(const list<value>&)> > p = partition(key, selector, partitions);
@@ -76,7 +76,7 @@ const failable<value> get(const value& key, const lambda<value(const list<value>
/**
* Post an item to a partition.
*/
-const failable<value> post(const value& key, const value& val, const lambda<value(const list<value>&)> selector, const list<value>& partitions) {
+const failable<value> post(const value& key, const value& val, const lambda<value(const list<value>&)>& selector, const list<value>& partitions) {
const value id = append<value>(key, mklist(mkuuid()));
// Select partition
@@ -93,7 +93,7 @@ const failable<value> post(const value& key, const value& val, const lambda<valu
/**
* Put an item into a partition.
*/
-const failable<value> put(const value& key, const value& val, const lambda<value(const list<value>&)> selector, const list<value>& partitions) {
+const failable<value> put(const value& key, const value& val, const lambda<value(const list<value>&)>& selector, const list<value>& partitions) {
// Select partition
const failable<lambda<value(const list<value>&)> > p = partition(key, selector, partitions);
@@ -109,7 +109,7 @@ const failable<value> put(const value& key, const value& val, const lambda<value
/**
* Delete an item from a partition.
*/
-const failable<value> del(const value& key, const lambda<value(const list<value>&)> selector, const list<value>& partitions) {
+const failable<value> del(const value& key, const lambda<value(const list<value>&)>& selector, const list<value>& partitions) {
// Select partition
const failable<lambda<value(const list<value>&)> > p = partition(key, selector, partitions);
diff --git a/sca-cpp/trunk/components/chat/chat-sender.cpp b/sca-cpp/trunk/components/chat/chat-sender.cpp
index 0672292a06..a4cabef8de 100644
--- a/sca-cpp/trunk/components/chat/chat-sender.cpp
+++ b/sca-cpp/trunk/components/chat/chat-sender.cpp
@@ -118,8 +118,8 @@ private:
const failable<value> start(const list<value>& params) {
// Extract the the XMPP JID and password
const list<value> props = params;
- const value jid = ((lambda<value(list<value>)>)car(props))(list<value>());
- const value pass = ((lambda<value(list<value>)>)cadr(props))(list<value>());
+ const value jid = ((lambda<value(const list<value>&)>)car(props))(list<value>());
+ const value pass = ((lambda<value(const list<value>&)>)cadr(props))(list<value>());
// Create an XMPP client session
XMPPClient xc(jid, pass, false);
diff --git a/sca-cpp/trunk/components/chat/chat-sender2.cpp b/sca-cpp/trunk/components/chat/chat-sender2.cpp
index b230d130c1..0e00728022 100644
--- a/sca-cpp/trunk/components/chat/chat-sender2.cpp
+++ b/sca-cpp/trunk/components/chat/chat-sender2.cpp
@@ -41,7 +41,7 @@ namespace sender {
/**
* Post an item to an XMPP JID.
*/
-const failable<value> post(const lambda<value(const list<value>&)> jid, const lambda<value(const list<value>&)> pass, const lambda<value(const list<value>&)> to, const lambda<value(const list<value>&)> msg, const list<value>& params) {
+const failable<value> post(const lambda<value(const list<value>&)>& jid, const lambda<value(const list<value>&)>& pass, const lambda<value(const list<value>&)>& to, const lambda<value(const list<value>&)>& msg, const list<value>& params) {
const value vjid = jid(mklist<value>("get", params));
const value vpass = pass(mklist<value>("get", params));
@@ -69,7 +69,7 @@ const failable<value> post(const lambda<value(const list<value>&)> jid, const la
*/
class chatSender {
public:
- chatSender(const lambda<value(const list<value>&)> jid, const lambda<value(const list<value>&)> pass, const lambda<value(const list<value>&)> to, const lambda<value(const list<value>&)> msg) : jid(jid), pass(pass), to(to), msg(msg) {
+ chatSender(const lambda<value(const list<value>&)>& jid, const lambda<value(const list<value>&)>& pass, const lambda<value(const list<value>&)>& to, const lambda<value(const list<value>&)>& msg) : jid(jid), pass(pass), to(to), msg(msg) {
}
const value operator()(const list<value>& params) const {
diff --git a/sca-cpp/trunk/components/chat/chat-sendreceiver.cpp b/sca-cpp/trunk/components/chat/chat-sendreceiver.cpp
index aac8d69f6c..bfbd32b9ae 100644
--- a/sca-cpp/trunk/components/chat/chat-sendreceiver.cpp
+++ b/sca-cpp/trunk/components/chat/chat-sendreceiver.cpp
@@ -131,8 +131,8 @@ const failable<value> start(const list<value>& params) {
const bool hasRelay = !isNil(cddr(params));
const value rel = hasRelay? car(params) : value(lambda<value(const list<value>&)>());
const list<value> props = hasRelay? cdr(params) : params;
- const value jid = ((lambda<value(list<value>)>)car(props))(list<value>());
- const value pass = ((lambda<value(list<value>)>)cadr(props))(list<value>());
+ const value jid = ((lambda<value(const list<value>&)>)car(props))(list<value>());
+ const value pass = ((lambda<value(const list<value>&)>)cadr(props))(list<value>());
// Create an XMPP client session
XMPPClient xc(jid, pass, false);
diff --git a/sca-cpp/trunk/components/chat/xmpp.hpp b/sca-cpp/trunk/components/chat/xmpp.hpp
index e5f423c270..aa006029fa 100644
--- a/sca-cpp/trunk/components/chat/xmpp.hpp
+++ b/sca-cpp/trunk/components/chat/xmpp.hpp
@@ -76,6 +76,20 @@ public:
debug("chat::xmppclient::copy");
}
+ const XMPPClient& operator=(const XMPPClient& xc) {
+ debug("chat::xmppclient::operator=");
+ if(this == &xc)
+ return *this;
+ owner = false;
+ ctx = xc.ctx;
+ conn = xc.conn;
+ listener = xc.listener;
+ connecting = xc.connecting;
+ connected = xc.connected;
+ disconnecting = xc.disconnecting;
+ return *this;
+ }
+
~XMPPClient() {
debug("chat::~xmppclient");
extern const failable<bool> disconnect(XMPPClient& xc);
@@ -98,7 +112,7 @@ private:
friend const failable<bool> disconnect(XMPPClient& xc);
friend const failable<bool> listen(const lambda<failable<bool>(const value&, const value&, XMPPClient&)>& listener, XMPPClient& xc);
- const bool owner;
+ bool owner;
xmpp_ctx_t* ctx;
xmpp_conn_t* conn;
lambda<failable<bool>(const value&, const value&, XMPPClient&)> listener;
diff --git a/sca-cpp/trunk/components/constdb/constdb.cpp b/sca-cpp/trunk/components/constdb/constdb.cpp
index c3b9d63284..6d1cb15baf 100644
--- a/sca-cpp/trunk/components/constdb/constdb.cpp
+++ b/sca-cpp/trunk/components/constdb/constdb.cpp
@@ -102,7 +102,7 @@ private:
*/
const failable<value> start(unused const list<value>& params) {
// Connect to the configured database and table
- const value dbname = ((lambda<value(list<value>)>)car(params))(list<value>());
+ const value dbname = ((lambda<value(const list<value>&)>)car(params))(list<value>());
tinycdb::TinyCDB& cdb = *(new (gc_new<tinycdb::TinyCDB>()) tinycdb::TinyCDB(dbname));
// Return the component implementation lambda function
diff --git a/sca-cpp/trunk/components/constdb/tinycdb.hpp b/sca-cpp/trunk/components/constdb/tinycdb.hpp
index c7d4cf520b..68be0a09dc 100644
--- a/sca-cpp/trunk/components/constdb/tinycdb.hpp
+++ b/sca-cpp/trunk/components/constdb/tinycdb.hpp
@@ -107,7 +107,6 @@ const string absdbname(const string& name) {
class TinyCDB {
public:
TinyCDB() : owner(false), fd(-1) {
- debug("tinycdb::tinycdb");
st.st_ino = 0;
}
@@ -121,8 +120,18 @@ public:
st.st_ino = c.st.st_ino;
}
+ const TinyCDB& operator=(const TinyCDB& c) {
+ debug("tinycdb::tinycdb::operator=");
+ if(this == &c)
+ return *this;
+ owner = false;
+ name = c.name;
+ fd = c.fd;
+ st.st_ino = c.st.st_ino;
+ return *this;
+ }
+
~TinyCDB() {
- debug("tinycdb::~tinycdb");
if (!owner)
return;
if (fd == -1)
diff --git a/sca-cpp/trunk/components/filedb/filedb.cpp b/sca-cpp/trunk/components/filedb/filedb.cpp
index 21b509a3b7..8644a78574 100644
--- a/sca-cpp/trunk/components/filedb/filedb.cpp
+++ b/sca-cpp/trunk/components/filedb/filedb.cpp
@@ -102,8 +102,8 @@ private:
*/
const failable<value> start(const list<value>& params) {
// Connect to the configured database and table
- const value dbname = ((lambda<value(list<value>)>)car(params))(list<value>());
- const value format = ((lambda<value(list<value>)>)cadr(params))(list<value>());
+ const value dbname = ((lambda<value(const list<value>&)>)car(params))(list<value>());
+ const value format = ((lambda<value(const list<value>&)>)cadr(params))(list<value>());
filedb::FileDB& db = *(new (gc_new<filedb::FileDB>()) filedb::FileDB(absdbname(dbname), format));
diff --git a/sca-cpp/trunk/components/filedb/filedb.hpp b/sca-cpp/trunk/components/filedb/filedb.hpp
index a7151eade1..9c3017d0d8 100644
--- a/sca-cpp/trunk/components/filedb/filedb.hpp
+++ b/sca-cpp/trunk/components/filedb/filedb.hpp
@@ -57,7 +57,6 @@ const string absdbname(const string& name) {
class FileDB {
public:
FileDB() : owner(false) {
- debug("filedb::filedb");
}
FileDB(const string& name, const string& format) : owner(true), name(absdbname(name)), format(format) {
@@ -69,8 +68,17 @@ public:
debug("filedb::filedb::copy");
}
+ const FileDB& operator=(const FileDB& c) {
+ debug("filedb::filedb::operator=");
+ if(this == &c)
+ return *this;
+ owner = false;
+ name = c.name;
+ format = c.format;
+ return *this;
+ }
+
~FileDB() {
- debug("filedb::~filedb");
}
private:
diff --git a/sca-cpp/trunk/components/kvdb/client-test.cpp b/sca-cpp/trunk/components/kvdb/client-test.cpp
index fc31a99e69..5f0ef21d00 100644
--- a/sca-cpp/trunk/components/kvdb/client-test.cpp
+++ b/sca-cpp/trunk/components/kvdb/client-test.cpp
@@ -93,8 +93,8 @@ bool testNoSqlDb() {
struct getLoop {
const string path;
const value entry;
- http::CURLSession cs;
- getLoop(const string& path, const value& entry, http::CURLSession cs) : path(path), entry(entry), cs(cs) {
+ http::CURLSession& cs;
+ getLoop(const string& path, const value& entry, http::CURLSession& cs) : path(path), entry(entry), cs(cs) {
}
const bool operator()() const {
const failable<value> val = http::get(uri + path, cs);
diff --git a/sca-cpp/trunk/components/kvdb/kvdb.cpp b/sca-cpp/trunk/components/kvdb/kvdb.cpp
index 24a2fb5a16..0df8f13882 100644
--- a/sca-cpp/trunk/components/kvdb/kvdb.cpp
+++ b/sca-cpp/trunk/components/kvdb/kvdb.cpp
@@ -102,7 +102,7 @@ private:
*/
const failable<value> start(unused const list<value>& params) {
// Connect to the configured database and table
- const value dbname = ((lambda<value(list<value>)>)car(params))(list<value>());
+ const value dbname = ((lambda<const value(list<value>&)>)car(params))(list<value>());
leveldb::LevelDB& cdb = *(new (gc_new<leveldb::LevelDB>()) leveldb::LevelDB(dbname));
// Return the component implementation lambda function
diff --git a/sca-cpp/trunk/components/kvdb/leveldb.hpp b/sca-cpp/trunk/components/kvdb/leveldb.hpp
index 8105f86ec4..05a89a76f7 100644
--- a/sca-cpp/trunk/components/kvdb/leveldb.hpp
+++ b/sca-cpp/trunk/components/kvdb/leveldb.hpp
@@ -121,6 +121,17 @@ public:
st.st_ino = c.st.st_ino;
}
+ const LevelDB& operator=(const LevelDB& c) {
+ debug("leveldb::leveldb::operator=");
+ if(this == &c)
+ return *this;
+ owner = false;
+ name = c.name;
+ fd = c.fd;
+ st.st_ino = c.st.st_ino;
+ return *this;
+ }
+
~LevelDB() {
debug("leveldb::~leveldb");
if (!owner)
diff --git a/sca-cpp/trunk/components/log/log.cpp b/sca-cpp/trunk/components/log/log.cpp
index 2e7742cfd7..f7f7086192 100644
--- a/sca-cpp/trunk/components/log/log.cpp
+++ b/sca-cpp/trunk/components/log/log.cpp
@@ -75,8 +75,8 @@ const failable<value> start(const list<value>& params) {
scribe::Scribe& sc = *(new (gc_new<scribe::Scribe>()) scribe::Scribe("localhost", 1464));
// Extract the configured category
- const value host = ((lambda<value(list<value>)>)car(params))(list<value>());
- const value category = ((lambda<value(list<value>)>)cadr(params))(list<value>());
+ const value host = ((lambda<value(const list<value>&)>)car(params))(list<value>());
+ const value category = ((lambda<value(const list<value>&)>)cadr(params))(list<value>());
debug(host, "log::start::host");
debug(category, "log::start::category");
diff --git a/sca-cpp/trunk/components/log/logger.cpp b/sca-cpp/trunk/components/log/logger.cpp
index d7a54507fb..d7969036ab 100644
--- a/sca-cpp/trunk/components/log/logger.cpp
+++ b/sca-cpp/trunk/components/log/logger.cpp
@@ -73,8 +73,8 @@ const failable<value> start(const list<value>& params) {
// Extract the configured relay service and category
const value rel = car(params);
- const value host = ((lambda<value(list<value>)>)cadr(params))(list<value>());
- const value category = ((lambda<value(list<value>)>)caddr(params))(list<value>());
+ const value host = ((lambda<value(const list<value>&)>)cadr(params))(list<value>());
+ const value category = ((lambda<value(const list<value>&)>)caddr(params))(list<value>());
debug(host, "logger::start::host");
debug(category, "logger::start::category");
diff --git a/sca-cpp/trunk/components/log/scribe-cat.cpp b/sca-cpp/trunk/components/log/scribe-cat.cpp
index fbfdaca533..254e2167ae 100644
--- a/sca-cpp/trunk/components/log/scribe-cat.cpp
+++ b/sca-cpp/trunk/components/log/scribe-cat.cpp
@@ -38,12 +38,12 @@ namespace scribecat {
int cat(const string& host, const string& category, const string& type) {
// Connect to Scribe
- scribe::Scribe& sc = *(new (gc_new<scribe::Scribe>()) scribe::Scribe("localhost", 1464));
+ scribe::Scribe& sc = *(new (gc_new<scribe::Scribe>()) scribe::Scribe(host, 1464));
// Read lines from stdin and log them
char buf[8193];
for (;;) {
- gc_scoped_pool();
+ gc_scoped_pool p;
// Write line prefix
ostringstream os;
diff --git a/sca-cpp/trunk/components/log/scribe.hpp b/sca-cpp/trunk/components/log/scribe.hpp
index 5ae8a50776..0f0570be64 100644
--- a/sca-cpp/trunk/components/log/scribe.hpp
+++ b/sca-cpp/trunk/components/log/scribe.hpp
@@ -66,7 +66,6 @@ namespace scribe {
class Scribe {
public:
Scribe() : owner(false) {
- debug("scribe::scribe");
}
Scribe(const string host, const int port) : owner(true) {
@@ -80,9 +79,18 @@ public:
client = c.client;
transport = c.transport;
}
+
+ const Scribe& operator=(const Scribe& c) {
+ debug("scribe::scribe::operator=");
+ if(this == &c)
+ return *this;
+ owner = false;
+ client = c.client;
+ transport = c.transport;
+ return *this;
+ }
~Scribe() {
- debug("scribe::~scribe");
if (!owner)
return;
try {
diff --git a/sca-cpp/trunk/components/queue/qpid.hpp b/sca-cpp/trunk/components/queue/qpid.hpp
index 63f27d2519..ef53c529e8 100644
--- a/sca-cpp/trunk/components/queue/qpid.hpp
+++ b/sca-cpp/trunk/components/queue/qpid.hpp
@@ -65,6 +65,15 @@ public:
debug("queue::qpidonnection::copy");
}
+ const QpidConnection& operator=(const QpidConnection& qc) {
+ debug("queue::qpidonnection::operator=");
+ if(this == &c)
+ return *this;
+ owner = false;
+ c = qc.c;
+ return *this;
+ }
+
~QpidConnection() {
debug("queue::~qpidonnection");
if (!owner)
diff --git a/sca-cpp/trunk/components/queue/queue-listener.cpp b/sca-cpp/trunk/components/queue/queue-listener.cpp
index 3c30e7feca..483d0de65a 100644
--- a/sca-cpp/trunk/components/queue/queue-listener.cpp
+++ b/sca-cpp/trunk/components/queue/queue-listener.cpp
@@ -123,9 +123,9 @@ private:
const failable<value> start(const list<value>& params) {
// Extract the relay reference and the AMQP key and queue name
const value rel = car(params);
- const value pk = ((lambda<value(list<value>)>)cadr(params))(list<value>());
+ const value pk = ((lambda<value(const list<value>&)>)cadr(params))(list<value>());
const value key = isList(pk)? (list<value>)pk : mklist<value>(pk);
- const value qname = ((lambda<value(list<value>)>)caddr(params))(list<value>());
+ const value qname = ((lambda<value(const list<value>&)>)caddr(params))(list<value>());
// Create an AMQP session
QpidConnection qc(false);
diff --git a/sca-cpp/trunk/components/queue/queue-sender.cpp b/sca-cpp/trunk/components/queue/queue-sender.cpp
index ff2ede1057..202a0e4435 100644
--- a/sca-cpp/trunk/components/queue/queue-sender.cpp
+++ b/sca-cpp/trunk/components/queue/queue-sender.cpp
@@ -48,7 +48,7 @@ const failable<value> post(const list<value>& params) {
QpidSession qs(qc);
// Post the item
- const value pk = ((lambda<value(list<value>)>)caddr(params))(list<value>());
+ const value pk = ((lambda<value(const list<value>&)>)caddr(params))(list<value>());
const value key = isList(pk)? append<value>(pk, (list<value>)car(params)) : cons<value>(pk, (list<value>)car(params));
debug(key, "queue::post::key");
debug(cadr(params), "queue::post::value");
diff --git a/sca-cpp/trunk/components/sqldb/pgsql.hpp b/sca-cpp/trunk/components/sqldb/pgsql.hpp
index d38af54c97..581cd943e6 100644
--- a/sca-cpp/trunk/components/sqldb/pgsql.hpp
+++ b/sca-cpp/trunk/components/sqldb/pgsql.hpp
@@ -91,6 +91,17 @@ public:
debug("pgsql::pgsql::copy");
}
+ const PGSql& operator=(const PGSql& c) {
+ debug("pgsql::pgsql::operator=");
+ if(this == &c)
+ return *this;
+ owner = false;
+ conn = c.conn;
+ conninfo = c.conninfo;
+ table = c.table;
+ return *this;
+ }
+
~PGSql() {
debug("pgsql::~pgsql");
if (!owner)
@@ -104,7 +115,7 @@ private:
bool owner;
PGconn *conn;
string conninfo;
- const string table;
+ string table;
string kname;
string vname;
diff --git a/sca-cpp/trunk/components/sqldb/sqldb.cpp b/sca-cpp/trunk/components/sqldb/sqldb.cpp
index bbf118385e..9925897693 100644
--- a/sca-cpp/trunk/components/sqldb/sqldb.cpp
+++ b/sca-cpp/trunk/components/sqldb/sqldb.cpp
@@ -120,8 +120,8 @@ private:
*/
const failable<value> start(unused const list<value>& params) {
// Connect to the configured database and table
- const value conninfo = ((lambda<value(list<value>)>)car(params))(list<value>());
- const value table = ((lambda<value(list<value>)>)cadr(params))(list<value>());
+ const value conninfo = ((lambda<value(const list<value>&)>)car(params))(list<value>());
+ const value table = ((lambda<value(const list<value>&)>)cadr(params))(list<value>());
const perthread_ptr<pgsql::PGSql> pg(lambda<gc_ptr<pgsql::PGSql>()>(newPGSql(conninfo, table)));
// Return the component implementation lambda function
diff --git a/sca-cpp/trunk/components/webservice/axis2.hpp b/sca-cpp/trunk/components/webservice/axis2.hpp
index 7630b54295..9bad109ff0 100644
--- a/sca-cpp/trunk/components/webservice/axis2.hpp
+++ b/sca-cpp/trunk/components/webservice/axis2.hpp
@@ -65,6 +65,15 @@ public:
debug("webservice::axis2context::copy");
}
+ const Axis2Context& operator=(const Axis2Context& ax) {
+ debug("webservice::axis2context::operator=");
+ if(this == &ax)
+ return *this;
+ env = ax.env;
+ owner = false;
+ return *this;
+ }
+
Axis2Context(const axutil_env_t* env) : env(const_cast<axutil_env_t*>(env)), owner(false) {
debug("webservice::axis2context::env");
}