|
Classdesc 3.44
|
#include <factory.h>

Classes | |
| struct | InvalidType |
Public Member Functions | |
| template<class T> | |
| void | registerType (const Type &t) |
| register type T for use with this factory | |
| template<class T> | |
| void | registerType () |
| convenience method for registering a type. | |
| Factory () | |
| B * | create (const Type &t) const |
| Create a default constructed object given by the type string. | |
| std::vector< string > | types () const |
| return list of registered types | |
factory template for a class heirarchy. B is the base class, and Type is the type class
| Factory | ( | ) |
Users of this template must define a constructor that registers all the types in the heirarchy.
For example, assuming Foo and Bar are subtypes of FooBase: template <> Factory<Foobase>::Factory() { registerType<Foo>(); registerType<Bar>(); };