46 template <
typename Base,
47 typename constructorArg,
48 typename SharedPointer = std::shared_ptr<Base>>
54 std::string className;
82 fromName(
const std::string& name, constructorArg params)
84 if (subTypes()->find(name) == subTypes()->end())
86 ARMARX_DEBUG <<
"factory does not manage a type of name " << name;
91 ARMARX_DEBUG <<
"done initializing object for name " << name;
94 result->className = name;
104 static std::vector<std::string>
107 std::vector<std::string> result;
108 typename std::map<std::string, initialisationFunction>::iterator it =
111 for (; it != subTypes()->end(); ++it)
113 result.push_back(it->first);
126 return "AbstractFactoryMethod";
147 ARMARX_VERBOSE <<
typeid(Base).name() <<
"Registering factory '" << name
148 <<
"' for function of type: " << armarx::GetTypeString<Base>();
150 (*subTypes())[name] = init;
160 Base::registerClass(name, init);
171 static std::shared_ptr<std::map<std::string, initialisationFunction>>
174 static std::shared_ptr<std::map<std::string, initialisationFunction>> subTypes(
175 new std::map<std::string, initialisationFunction>);