]> git.tdb.fi Git - libs/datafile.git/blobdiff - source/dynamicobjectloader.h
Return the object from DynamicObjectLoader::store_object
[libs/datafile.git] / source / dynamicobjectloader.h
index b5830b8c9512a9a95840a6bf57c08f87f25b62ba..726d19c073ed864601323d078aa7f79a46f94d90 100644 (file)
@@ -48,7 +48,7 @@ private:
 
 public:
        T *get_object() { T *o = object; object = 0; return o; }
-       void store_object(Collection &, const std::string &);
+       T *store_object(Collection &, const std::string &);
 
 private:
        void type(const Symbol &);
@@ -83,13 +83,15 @@ void DynamicObjectLoader<T, C>::init_actions()
 }
 
 template<typename T, typename C>
-void DynamicObjectLoader<T, C>::store_object(Collection &c, const std::string &name)
+T *DynamicObjectLoader<T, C>::store_object(Collection &c, const std::string &name)
 {
        if(!store_func)
                throw std::logic_error("no store function");
 
+       T *o = object;
        store_func(c, name, object);
        object = 0;
+       return o;
 }
 
 template<typename T, typename C>