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.
AppFlow/FITK_Kernel/FITKAppFramework/FITKComponentInterface.h

130 lines
3.7 KiB
C

/**
*
* @file FITKComponentInterface.h
* @brief
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-03-04
*
*/
#ifndef __FITKCOMPONENT_INTERFACE_H__
#define __FITKCOMPONENT_INTERFACE_H__
#include "FITKAppFrameworkAPI.h"
#include <functional>
#include <QString>
#include <QWidget>
#include <QVariant>
#include <QHash>
//定义回调函数参数为void*返回值为int
typedef std::function<int(void*)> CallBackFuns;
namespace AppFrame
{
/**
* @brief
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-03-04
*/
class FITKAppFrameworkAPI FITKComponentInterface
{
public:
/**
* @brief Construct a new FITKComponentInterface object
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-03-04
*/
explicit FITKComponentInterface() = default;
/**
* @brief Destroy the FITKComponentInterface object
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-03-04
*/
virtual ~FITKComponentInterface() = 0;
/**
* @brief
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-03-04
*/
virtual void init();
/**
* @brief
* @param[i] indexPort
* @return QWidget*
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-03-04
*/
virtual QWidget* getWidget(const int indexPort);
/**
* @brief
* @return QString
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-03-04
*/
virtual QString getComponentName() = 0;
/**
* @brief
* @param[i] indexPort
* @return true
* @return false
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-03-07
*/
virtual bool exec(const int indexPort);
/**
* @brief
* @param[i] name
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-03-30
*/
void setComponentObjName(const QString & name);
/**
* @brief
* @return QString
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-03-30
*/
QString getComponentObjName() const;
/**
* @brief
* @param[i] key
* @return CallBackFuns
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-04-25
*/
CallBackFuns getCallBackFuns(int key);
/**
* @brief
* @param[i] k
* @param[i] f
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-04-25
*/
void setCallBackFuns(int k, CallBackFuns f);
/**
* @brief
* @param[i] k
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-04-25
*/
void removeCallBackFun(int k);
protected:
/**
* @brief
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-03-30
*/
QString _compObjName{};
/**
* @brief
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-04-25
*/
QHash<int, CallBackFuns> _callBackFuns{};
};
}
#endif