summaryrefslogtreecommitdiff
path: root/project2/common/instanceStore.h
diff options
context:
space:
mode:
authorrandomdan <randomdan@localhost>2013-12-30 18:09:46 +0000
committerrandomdan <randomdan@localhost>2013-12-30 18:09:46 +0000
commitf53c2c8caf704fb963aadb44af65fe0c9afdd711 (patch)
tree897e9f059c5246b2eb27dabdb9695dd53b44fcec /project2/common/instanceStore.h
parentManage database connections on a per thread basis (diff)
downloadproject2-f53c2c8caf704fb963aadb44af65fe0c9afdd711.tar.bz2
project2-f53c2c8caf704fb963aadb44af65fe0c9afdd711.tar.xz
project2-f53c2c8caf704fb963aadb44af65fe0c9afdd711.zip
Allow instanceSet to catch or propergate exceptions with onAll*, exceptions in options setting functions propergate
Diffstat (limited to 'project2/common/instanceStore.h')
-rw-r--r--project2/common/instanceStore.h26
1 files changed, 18 insertions, 8 deletions
diff --git a/project2/common/instanceStore.h b/project2/common/instanceStore.h
index c61ccfe..36f4e73 100644
--- a/project2/common/instanceStore.h
+++ b/project2/common/instanceStore.h
@@ -29,25 +29,35 @@ class InstanceStore {
prune();
}
- static void OnEach(const boost::function<void(typename StoreType::value_type &)> & func)
+ static void OnEach(const boost::function<void(typename StoreType::value_type &)> & func, bool ContinueOnError = false)
{
BOOST_FOREACH(const auto & l, GetAll()) {
- try {
- func(l.get());
+ if (ContinueOnError) {
+ try {
+ func(l.get());
+ }
+ catch (...) {
+ }
}
- catch (...) {
+ else {
+ func(l.get());
}
}
prune();
}
- static void OnAll(const boost::function<void(Type *)> & func)
+ static void OnAll(const boost::function<void(Type *)> & func, bool ContinueOnError = false)
{
BOOST_FOREACH(const auto & l, GetAll()) {
- try {
- func(l.get());
+ if (ContinueOnError) {
+ try {
+ func(l.get());
+ }
+ catch (...) {
+ }
}
- catch (...) {
+ else {
+ func(l.get());
}
}
prune();