SOFA API  cd4ffb93
Open source framework for multi-physics simuation
sofa::core::ObjectRegistrationData Class Reference

#include <ObjectFactory.h>

Helper class used to register a class in the ObjectFactory. More...

Detailed Description

Helper class used to register a class in the ObjectFactory.

This class accumulate information about a given class, as well as creators for each supported template instantiation, 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")
;
ObjectRegistrationData & addLicense(std::string val)
Specify a license (LGPL, GPL, ...)
Definition: ObjectFactory.cpp:668

Protected Attributes

ObjectFactory::ClassEntry entry
 Class entry being constructed. More...
 

Public Member Functions

 ObjectRegistrationData (const std::string &description)
 Start the registration by giving the description of this class. More...
 
ObjectRegistrationDataaddAlias (std::string val)
 Add an alias name for this class. More...
 
ObjectRegistrationDataaddDescription (std::string val)
 Add more descriptive text about this class. More...
 
ObjectRegistrationDataaddAuthor (std::string val)
 Specify a list of authors (separated with spaces) More...
 
ObjectRegistrationDataaddLicense (std::string val)
 Specify a license (LGPL, GPL, ...) More...
 
ObjectRegistrationDataaddDocumentationURL (std::string url)
 Specify a documentation URL. More...
 
ObjectRegistrationDataaddCreator (std::string classname, std::string templatename, ObjectFactory::Creator::SPtr creator)
 
template<class RealObject >
ObjectRegistrationDataadd (bool defaultTemplate=false)
 
bool commitTo (sofa::core::ObjectFactory *objectFactory) const
 This is the final operation that will actually commit the additions to the ObjectFactory. More...
 

Attribute details

◆ entry

ObjectFactory::ClassEntry sofa::core::ObjectRegistrationData::entry
protected

Class entry being constructed.

Constructor details

◆ ObjectRegistrationData()

sofa::core::ObjectRegistrationData::ObjectRegistrationData ( const std::string &  description)
explicit

Start the registration by giving the description of this class.

Function details

◆ add()

template<class RealObject >
ObjectRegistrationData& sofa::core::ObjectRegistrationData::add ( bool  defaultTemplate = false)
inline

Add a template instantiation of this class.

Parameters
defaultTemplateset to true if this should be the default instance when no template name is given.

◆ addAlias()

ObjectRegistrationData & sofa::core::ObjectRegistrationData::addAlias ( std::string  val)

Add an alias name for this class.

◆ addAuthor()

ObjectRegistrationData & sofa::core::ObjectRegistrationData::addAuthor ( std::string  val)

Specify a list of authors (separated with spaces)

◆ addCreator()

ObjectRegistrationData & sofa::core::ObjectRegistrationData::addCreator ( std::string  classname,
std::string  templatename,
ObjectFactory::Creator::SPtr  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.

◆ addDescription()

ObjectRegistrationData & sofa::core::ObjectRegistrationData::addDescription ( std::string  val)

Add more descriptive text about this class.

◆ addDocumentationURL()

ObjectRegistrationData & sofa::core::ObjectRegistrationData::addDocumentationURL ( std::string  url)

Specify a documentation URL.

◆ addLicense()

ObjectRegistrationData & sofa::core::ObjectRegistrationData::addLicense ( std::string  val)

Specify a license (LGPL, GPL, ...)

◆ commitTo()

bool sofa::core::ObjectRegistrationData::commitTo ( sofa::core::ObjectFactory objectFactory) const

This is the final operation that will actually commit the additions to the ObjectFactory.