summaryrefslogtreecommitdiff
path: root/project2/xmlObjectLoader.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'project2/xmlObjectLoader.cpp')
-rw-r--r--project2/xmlObjectLoader.cpp23
1 files changed, 17 insertions, 6 deletions
diff --git a/project2/xmlObjectLoader.cpp b/project2/xmlObjectLoader.cpp
index 372081b..b33bf85 100644
--- a/project2/xmlObjectLoader.cpp
+++ b/project2/xmlObjectLoader.cpp
@@ -11,6 +11,7 @@ unsigned int LoaderBase::depth = 0;
std::set<SourceObjectPtr> LoaderBase::loadedObjects;
typedef std::map<std::string, boost::shared_ptr<ElementLoader> > ElementLoaderMap;
+typedef std::set<boost::shared_ptr<ComponentLoader> > ComponentLoaderSet;
LoaderBase::LoaderBase(bool r) :
recursive(r),
@@ -30,6 +31,16 @@ LoaderBase::~LoaderBase()
{
}
+std::set<boost::shared_ptr<ComponentLoader> > * &
+LoaderBase::componentLoaders()
+{
+ static std::set<boost::shared_ptr<ComponentLoader> > * _compLoaders = NULL;
+ if (!_compLoaders) {
+ _compLoaders = new std::set<boost::shared_ptr<ComponentLoader> >();
+ }
+ return _compLoaders;
+}
+
void
LoaderBase::collectAll(const xmlpp::Element * node, bool childrenOnly, UnsupportedHandling uh) const
{
@@ -82,8 +93,8 @@ LoaderBase::collectAll(const CommonObjects * co, const xmlpp::Element * node, bo
void
LoaderBase::onIdle()
{
- BOOST_FOREACH(ElementLoaderMap::value_type l, *objLoaders<ElementLoader>()) {
- l.second->onIdle();
+ BOOST_FOREACH(ComponentLoaderSet::value_type l, *componentLoaders()) {
+ l->onIdle();
}
}
@@ -94,16 +105,16 @@ LoaderBase::onIteration()
depth = 0;
loadedObjects.clear();
- BOOST_FOREACH(ElementLoaderMap::value_type l, *objLoaders<ElementLoader>()) {
- l.second->onIteration();
+ BOOST_FOREACH(ComponentLoaderSet::value_type l, *componentLoaders()) {
+ l->onIteration();
}
}
void
LoaderBase::onPeriodic()
{
- BOOST_FOREACH(ElementLoaderMap::value_type l, *objLoaders<ElementLoader>()) {
- l.second->onPeriodic();
+ BOOST_FOREACH(ComponentLoaderSet::value_type l, *componentLoaders()) {
+ l->onPeriodic();
}
}