summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--project2/common/instanceStore.h26
-rw-r--r--project2/common/plugable.h2
2 files changed, 19 insertions, 9 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();
diff --git a/project2/common/plugable.h b/project2/common/plugable.h
index 2a9c58c..af7f91f 100644
--- a/project2/common/plugable.h
+++ b/project2/common/plugable.h
@@ -10,7 +10,7 @@ class ComponentLoader;
class Plugable : public InstanceSet<ComponentLoader> {
public:
- static void onAllComponents(const boost::function<void(ComponentLoader *)> & func) { InstanceSet<ComponentLoader>::OnAll(func); }
+ static void onAllComponents(const boost::function<void(ComponentLoader *)> & func) { InstanceSet<ComponentLoader>::OnAll(func, true); }
};
/// All loaders, keyed by string, enum, int, etc