Factory class for creating WorldElements. More...
#include <worldElementFactory.h>
Public Member Functions | |
WorldElement * | createElement (std::string elementType, World *parent, const char *name) |
Instantiates an element based on the given type. | |
void | registerCreator (std::string elementType, WorldElementCreator *creator) |
Registers a new world element creator for the given type. | |
WorldElementFactory () | |
Stub constructor. | |
~WorldElementFactory () | |
Cleans up, deletes all creators. | |
Static Public Member Functions | |
static void | registerBuiltinCreators () |
Registers creators for the built in element types. Called from the world constructor. | |
Private Attributes | |
std::map< std::string, WorldElementCreator * > | mCreators |
Maps world element types to their creators. |
Factory class for creating WorldElements.
Used to instantiate the right WorldElement based on a name, presumably read from an .xml configuration file, such as a saved world or a robot definition.
Definition at line 58 of file worldElementFactory.h.
WorldElementFactory::WorldElementFactory | ( | ) | [inline] |
Stub constructor.
Definition at line 66 of file worldElementFactory.h.
WorldElementFactory::~WorldElementFactory | ( | ) |
Cleans up, deletes all creators.
Definition at line 45 of file worldElementFactory.cpp.
WorldElement * WorldElementFactory::createElement | ( | std::string | elementType, | |
World * | parent, | |||
const char * | name | |||
) |
Instantiates an element based on the given type.
Definition at line 54 of file worldElementFactory.cpp.
void WorldElementFactory::registerBuiltinCreators | ( | ) | [static] |
Registers creators for the built in element types. Called from the world constructor.
Definition at line 68 of file worldElementFactory.cpp.
void WorldElementFactory::registerCreator | ( | std::string | elementType, | |
WorldElementCreator * | creator | |||
) |
Registers a new world element creator for the given type.
Definition at line 62 of file worldElementFactory.cpp.
std::map<std::string, WorldElementCreator*> WorldElementFactory::mCreators [private] |
Maps world element types to their creators.
Definition at line 62 of file worldElementFactory.h.