You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

87 lines
2.2 KiB
C

/**
*
* @file FITKAbstractFactory.h
* @brief
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-03-02
*
*/
#ifndef __FITKABSTRACTFACTORY_H__
#define __FITKABSTRACTFACTORY_H__
#include "FITKAbstractObject.hpp"
#include <QString>
namespace Core
{
/**
* @brief
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-03-02
*/
class FITKCoreAPI FITKAbstractFactory : public FITKAbstractObject
{
public:
/**
* @brief Construct a new FITKAbstractFactory object
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-03-02
*/
explicit FITKAbstractFactory() = default;
/**
* @brief Destroy the FITKAbstractFactory object
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-03-02
*/
virtual ~FITKAbstractFactory() = 0;
/**
* @brief key
* @param[i] key
* @return FITKAbstractObject*
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-03-02
*/
virtual FITKAbstractObject* create(const QString& key );
/**
* @brief key
* @param[i] key
* @return FITKAbstractObject*
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-03-02
*/
virtual FITKAbstractObject* create(const int key) ;
template<class T>
/**
* @brief key
* @param[i] key
* @return FITKAbstractObject*
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-03-02
*/
T* createT(const QString & key)
{
return dynamic_cast<T*>(create(key));
}
template<class T>
/**
* @brief key
* @param[i] key
* @return FITKAbstractObject*
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-03-02
*/
T* createT(const int key)
{
return dynamic_cast<T*>(create(key));
}
};
}
#endif