API refactoring make it more logic.
This commit is contained in:
@@ -42,8 +42,8 @@
|
|||||||
* typefactory.registerType<Derived1>("one");
|
* typefactory.registerType<Derived1>("one");
|
||||||
* typefactory.registerType<Derived2>("2");
|
* typefactory.registerType<Derived2>("2");
|
||||||
*
|
*
|
||||||
* auto d1 = typefactory.create ("one")(10);
|
* auto d1 = typefactory.createInstance ("one")(10);
|
||||||
* auto d2 = typefactory.create ("2")(10);
|
* auto d2 = typefactory.createInstance ("2")(10);
|
||||||
*
|
*
|
||||||
* d1->get();
|
* d1->get();
|
||||||
* d2->get();
|
* d2->get();
|
||||||
@@ -81,12 +81,12 @@ class TypeFsactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief create - create class by unique id. Class should be registered before
|
* @brief createInstance - createInstance class by unique id. Class should be registered before
|
||||||
* @param id - unique class identification
|
* @param id - unique class identification
|
||||||
* @return shared pointer to new class.
|
* @return shared pointer to new class.
|
||||||
* @throws std::out_of_range when id not found in map
|
* @throws std::out_of_range when id not found in map
|
||||||
*/
|
*/
|
||||||
typefactoryFunction create (const ClassId& id) const {
|
typefactoryFunction createInstance (const ClassId& id) const {
|
||||||
/// constructor of registered type will call here
|
/// constructor of registered type will call here
|
||||||
return classes.at (id);
|
return classes.at (id);
|
||||||
}
|
}
|
||||||
@@ -98,7 +98,7 @@ class TypeFsactory {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
* @brief typefactory - main functionality, create registered object
|
* @brief typefactory - main functionality, createInstance registered object
|
||||||
* @param Derived - class type
|
* @param Derived - class type
|
||||||
* @param args - constructor arguments
|
* @param args - constructor arguments
|
||||||
* @return shared pointer to register Derived class
|
* @return shared pointer to register Derived class
|
||||||
|
|||||||
Reference in New Issue
Block a user