#include <ObjectFactory.h>

Data Structures | |
| class | Conversion |
| Test whether T* converts to U*, that is, if T is derived from U taken from Modern C++ Design. More... | |
Public Member Functions | |
| RegisterObject (const std::string &description) | |
| Start the registration by giving the description of this class. | |
| RegisterObject & | addAlias (std::string val) |
| Add an alias name for this class. | |
| RegisterObject & | addDescription (std::string val) |
| Add more descriptive text about this class. | |
| RegisterObject & | addAuthor (std::string val) |
| Specify a list of authors (separated with spaces). | |
| RegisterObject & | addLicense (std::string val) |
| Specify a license (LGPL, GPL, ...). | |
| RegisterObject & | addCreator (std::string classname, std::string templatename, ObjectFactory::Creator *creator) |
| Add a creator able to instance this class with the given templatename. | |
| template<class RealClass , class BaseClass > | |
| bool | implements () |
| Test whether T* converts to U*, that is, if T is derived from U. | |
| template<class RealObject > | |
| RegisterObject & | add (bool defaultTemplate=false) |
| Add a template instanciation of this class. | |
| operator int () | |
| This is the final operation that will actually commit the additions to the ObjectFactory. | |
Protected Attributes | |
| ObjectFactory::ClassEntry | entry |
| Class entry being constructed. | |
This class accumulate information about a given class, as well as creators for each supported template instanciation, to register a new entry in the ObjectFactory.
It should be used as a temporary object, finalized when used to initialize an int static variable. For example :
int Fluid3DClass = core::RegisterObject("Eulerian 3D fluid") .add\< Fluid3D \>() .addLicense("LGPL") .addAuthor("Jeremie Allard") ;
Definition at line 216 of file ObjectFactory.h.
| sofa::core::RegisterObject::RegisterObject | ( | const std::string & | description | ) |
Start the registration by giving the description of this class.
Definition at line 283 of file ObjectFactory.cpp.
References addDescription().
| RegisterObject& sofa::core::RegisterObject::add | ( | bool | defaultTemplate = false |
) | [inline] |
Add a template instanciation of this class.
| defaultTemplate | set to true if this should be the default instance when no template name is given. |
Definition at line 278 of file ObjectFactory.h.
References addCreator(), sofa::core::ObjectFactory::ClassEntry::baseClasses, sofa::core::ObjectFactory::ClassEntry::defaultTemplate, and entry.
| RegisterObject & sofa::core::RegisterObject::addAlias | ( | std::string | val | ) |
Add an alias name for this class.
Definition at line 291 of file ObjectFactory.cpp.
References sofa::core::ObjectFactory::ClassEntry::aliases, and entry.
| RegisterObject & sofa::core::RegisterObject::addAuthor | ( | std::string | val | ) |
Specify a list of authors (separated with spaces).
Definition at line 305 of file ObjectFactory.cpp.
References sofa::core::ObjectFactory::ClassEntry::authors, and entry.
| RegisterObject & sofa::core::RegisterObject::addCreator | ( | std::string | classname, | |
| std::string | templatename, | |||
| ObjectFactory::Creator * | creator | |||
| ) |
Add a creator able to instance this class with the given templatename.
See the add<RealObject>() method for an easy way to add a Creator.
Definition at line 320 of file ObjectFactory.cpp.
References sofa::core::ObjectFactory::ClassEntry::className, sofa::core::ObjectFactory::ClassEntry::creatorList, sofa::core::ObjectFactory::ClassEntry::creatorMap, and entry.
Referenced by add().
| RegisterObject & sofa::core::RegisterObject::addDescription | ( | std::string | val | ) |
Add more descriptive text about this class.
Definition at line 297 of file ObjectFactory.cpp.
References sofa::core::ObjectFactory::ClassEntry::description, and entry.
Referenced by RegisterObject().
| RegisterObject & sofa::core::RegisterObject::addLicense | ( | std::string | val | ) |
Specify a license (LGPL, GPL, ...).
Definition at line 313 of file ObjectFactory.cpp.
References entry, and sofa::core::ObjectFactory::ClassEntry::license.
| bool sofa::core::RegisterObject::implements | ( | ) | [inline] |
Test whether T* converts to U*, that is, if T is derived from U.
Definition at line 262 of file ObjectFactory.h.
| sofa::core::RegisterObject::operator int | ( | ) |
This is the final operation that will actually commit the additions to the ObjectFactory.
Definition at line 340 of file ObjectFactory.cpp.
References sofa::core::ObjectFactory::addAlias(), sofa::core::ObjectFactory::ClassEntry::aliases, sofa::core::ObjectFactory::ClassEntry::authors, sofa::core::ObjectFactory::ClassEntry::baseClasses, sofa::core::ObjectFactory::ClassEntry::className, sofa::core::ObjectFactory::ClassEntry::creatorList, sofa::core::ObjectFactory::ClassEntry::creatorMap, sofa::core::ObjectFactory::ClassEntry::defaultTemplate, sofa::core::ObjectFactory::ClassEntry::description, entry, sofa::core::ObjectFactory::getEntry(), sofa::core::ObjectFactory::getInstance(), and sofa::core::ObjectFactory::ClassEntry::license.
Class entry being constructed.
Definition at line 220 of file ObjectFactory.h.
Referenced by add(), addAlias(), addAuthor(), addCreator(), addDescription(), addLicense(), and operator int().
1.5.7.1