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.

53 lines
1.1 KiB
C++

#include "FITKOperatorRepo.h"
#include <QMutexLocker>
#include "FITKOperatorRepoPrivate.h"
namespace Core
{
/**
* @brief
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-03-04
*/
class FITKOperatorDeletor
{
public:
FITKOperatorDeletor() = default;
~FITKOperatorDeletor()
{
//回收内存
auto p = FITKOPERREPO->_private;
delete p;
FITKOPERREPO->_private = nullptr;
}
};
//静态变量声明
static FITKOperatorDeletor __OPER_DELEATOR__;
FITKOperatorRepo* FITKOperatorRepo::_instance = nullptr;
QMutex FITKOperatorRepo::m_mutex;
FITKAbstractOperator* FITKOperatorRepo::getOperator(const QString& key)
{
//线程安全实际操作由private完成
QMutexLocker locker(&m_mutex);
return _private->getOperator(key);
}
void FITKOperatorRepo::initialize()
{
//初始化,构造函数调用
_private = new FITKOperatorRepoPrivate(_createFuns);
}
void FITKOperatorRepo::finalize()
{
}
}