![]() |
A factory implementation for shapes. More...
#include <SurgSim/Serialize/ShapesFactory.h>
Public Member Functions | |
ShapesFactory () | |
Constructor. More... | |
virtual | ~ShapesFactory () |
Destructor. More... | |
template<class Derived > | |
void | registerShape (const std::string &className) |
Template version to register a shape into the internal directory. More... | |
std::shared_ptr< SurgSim::Math::Shape > | createShape (const std::string &className) |
Create an instance of derived rigid shape based on the specific class name. More... | |
Private Types | |
typedef boost::function< std::shared_ptr< SurgSim::Math::Shape >)> | ShapesFactoryFunction |
A wrapper of function object. More... | |
Private Attributes | |
std::map< std::string, ShapesFactoryFunction > | m_registerDirectory |
Look up table for shapes factory. More... | |
A factory implementation for shapes.
|
private |
A wrapper of function object.
SurgSim::Serialize::ShapesFactory::ShapesFactory | ( | ) |
Constructor.
|
virtual |
Destructor.
std::shared_ptr< SurgSim::Math::Shape > SurgSim::Serialize::ShapesFactory::createShape | ( | const std::string & | className | ) |
Create an instance of derived rigid shape based on the specific class name.
className | The identifier name to be used. |
Return a nullptr if the class name has not been registered before.
void SurgSim::Serialize::ShapesFactory::registerShape | ( | const std::string & | className | ) |
Template version to register a shape into the internal directory.
T | The specific type of the shape to be registered. |
className | The identifier name to be used. |
|
private |
Look up table for shapes factory.