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.

92 lines
2.6 KiB
C++

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

/**
*
* @file FITKOperatorRepoPrivate.h
* @brief 创建并维护操作器类声明
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-03-04
*
*/
#ifndef _FITK_OPERATOR_REPO_PRIVATE_H__
#define _FITK_OPERATOR_REPO_PRIVATE_H__
#include "FITKAbstractObject.hpp"
#include <QObject>
#include <QHash>
#include <QString>
#include <functional>
namespace Core
{
class FITKAbstractOperator;
/**
* @brief 创建操作器与维护操作器
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-03-04
*/
class FITKOperatorRepoPrivate : public QObject, public FITKAbstractObject
{
Q_OBJECT
public:
/**
* @brief Construct a new FITKOperatorRepoPrivate object
* @param[i] funs 创建函数的Hash引用实际对象在FITKOperatorRepo
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-03-04
*/
explicit FITKOperatorRepoPrivate(QHash<QString,std::function<FITKAbstractOperator*()>>& funs);
/**
* @brief Destroy the FITKOperatorRepoPrivate object
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-03-04
*/
virtual ~FITKOperatorRepoPrivate();
/**
* @brief 获取operator不存在则创建
* @param[i] key 创建对象的关键字
* @return FITKAbstractOperator*
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-03-04
*/
FITKAbstractOperator* getOperator(const QString & key);
private:
/**
* @brief 创建操作器
* @param[i] key 关键字
* @return FITKAbstractOperator*
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-03-04
*/
FITKAbstractOperator* createOperator(const QString & key);
private slots:
/**
* @brief operator被释放槽函数
* @param[i] oper 被释放的槽函数
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-03-04
*/
void operatorDestoryedSlot(FITKAbstractOperator* oper);
private:
/**
* @brief 创建operator函数列表
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-03-04
*/
QHash<QString, std::function<FITKAbstractOperator*()>>& _createFuns;
/**
* @brief 已经创建的operator
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-03-04
*/
QHash<QString, FITKAbstractOperator*> _existOperators{};
};
}
#endif