1 #ifndef MSP_DATAFILE_OBJECTLOADER_H_
2 #define MSP_DATAFILE_OBJECTLOADER_H_
13 Provides the basic functionality of an object loader. Deriving from this
14 allows loading values directly into member variables of the objects.
17 class ObjectLoader: virtual public Loader
25 ObjectLoader(O &o): obj(o) { }
28 O &get_object() const { return obj; }
33 Convenience class for loading derived objects. Inherits from the base class
34 loader and shadows its members with ones for the derived type.
36 template<typename O, typename B>
37 class DerivedObjectLoader: public B
45 DerivedObjectLoader(O &o): B(o), obj(o) { }
48 DerivedObjectLoader(O &o, T &a): B(o, a), obj(o) { }
51 O &get_object() const { return obj; }
56 Provides functionality for loading objects with a Collection. Deriving from
57 this allows loading pointers to objects in the collection automatically.
59 template<typename O, typename C = Collection>
60 class CollectionObjectLoader: public ObjectLoader<O>
68 CollectionObjectLoader(O &o, C *c): ObjectLoader<O>(o), coll(c) { }
71 C &get_collection() const
74 throw no_collection(typeid(O));
79 } // namespace DataFile