Remove _T postfix. No reference
This commit is contained in:
@@ -5,20 +5,20 @@
|
||||
|
||||
/**
|
||||
* @brief The TypeFsactory class - base typefactory (abstract factory) template
|
||||
* @param ClassId_T - unique class identification class. For example string, or integer id.
|
||||
* @param BaseClass_T - all objects should have one base class. For example vehicle or parameter
|
||||
* @param ClassId - unique class identification class. For example string, or integer id.
|
||||
* @param BaseClass - all objects should have one base class. For example vehicle or parameter
|
||||
* @param Args - constructor arguments
|
||||
*
|
||||
* Usage example:
|
||||
* @code
|
||||
* class Base_T {
|
||||
* class Base {
|
||||
* public:
|
||||
* virtual int get() = 0;
|
||||
* }
|
||||
*
|
||||
* class Derived1_T : public Base_T {
|
||||
* class Derived1 : public Base {
|
||||
* public:
|
||||
* Derived1_T (int start) : m_start(start){}
|
||||
* Derived1 (int start) : m_start(start){}
|
||||
* int get() override {
|
||||
* return m_start + 1;
|
||||
* }
|
||||
@@ -26,9 +26,9 @@
|
||||
* int m_start = 0;
|
||||
* }
|
||||
*
|
||||
* class Derived2_T : public Base_T {
|
||||
* class Derived2 : public Base {
|
||||
* public:
|
||||
* Derived1_T (int start) : m_start(start){}
|
||||
* Derived1 (int start) : m_start(start){}
|
||||
* int get() override {
|
||||
* return m_start + 2;
|
||||
* }
|
||||
@@ -38,7 +38,7 @@
|
||||
* .
|
||||
* .
|
||||
* .
|
||||
* TypeFsactory <std::string, Base_T, int> typefactory;
|
||||
* TypeFsactory <std::string, Base, int> typefactory;
|
||||
* typefactory.registerType<Derived1>("one");
|
||||
* typefactory.registerType<Derived2>("2");
|
||||
*
|
||||
@@ -49,13 +49,13 @@
|
||||
* d2->get();
|
||||
* @endcode
|
||||
*/
|
||||
template<class ClassId_T, class BaseClass_T, class ... Args>
|
||||
template<class ClassId, class BaseClass, class ... Args>
|
||||
class TypeFsactory {
|
||||
public:
|
||||
/**
|
||||
* @brief BaseClass_SP - base class shared pointer type
|
||||
*/
|
||||
typedef std::shared_ptr<BaseClass_T> BaseClass_SP;
|
||||
typedef std::shared_ptr<BaseClass> BaseClass_SP;
|
||||
/**
|
||||
* @brief typefactoryFunction - typefactory function pointer type. Generally speaking it is pointer to constructor.
|
||||
*/
|
||||
@@ -75,7 +75,7 @@ class TypeFsactory {
|
||||
* @endcode
|
||||
*/
|
||||
template<class Derived>
|
||||
void registerType (const ClassId_T& id) {
|
||||
void registerType (const ClassId& id) {
|
||||
/// store pointer to constructor of Derived class
|
||||
classes[id] = &typefactory<Derived>;
|
||||
}
|
||||
@@ -86,7 +86,7 @@ class TypeFsactory {
|
||||
* @return shared pointer to new class.
|
||||
* @throws std::out_of_range when id not found in map
|
||||
*/
|
||||
typefactoryFunction create (const ClassId_T& id) const {
|
||||
typefactoryFunction create (const ClassId& id) const {
|
||||
/// constructor of registered type will call here
|
||||
return classes.at (id);
|
||||
}
|
||||
@@ -94,7 +94,7 @@ class TypeFsactory {
|
||||
/**
|
||||
* @brief classes - main storage for pointers to constructors of registered types
|
||||
*/
|
||||
std::unordered_map<ClassId_T, typefactoryFunction> classes;
|
||||
std::unordered_map<ClassId, typefactoryFunction> classes;
|
||||
|
||||
private:
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user