From f53c2c8caf704fb963aadb44af65fe0c9afdd711 Mon Sep 17 00:00:00 2001 From: randomdan Date: Mon, 30 Dec 2013 18:09:46 +0000 Subject: Allow instanceSet to catch or propergate exceptions with onAll*, exceptions in options setting functions propergate --- project2/common/instanceStore.h | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'project2/common/instanceStore.h') 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 & func) + static void OnEach(const boost::function & 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 & func) + static void OnAll(const boost::function & 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(); -- cgit v1.2.3