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.
51 lines
1.5 KiB
C++
51 lines
1.5 KiB
C++
#ifndef LPALGORITHM_H
|
|
#define LPALGORITHM_H
|
|
|
|
#include "lpbengine.h"
|
|
|
|
class IAlgo
|
|
{
|
|
public:
|
|
IAlgo(){}
|
|
virtual ~IAlgo(){}
|
|
virtual bool RegisterFunc(IAlgorithmLib* pAlgoLib) { return true; };
|
|
virtual bool Exec(IDetectorTask *lpTask, IDetectorAlgorithm* lpAlgorithm) = 0;
|
|
virtual bool Init(IDetectorTask *lpTask, IDetectorAlgorithm* lpAlgorithm) = 0;
|
|
virtual void SaveUserParamValue(IDetectorTask *lpTask, IDetectorAlgorithm* lpAlgorithm, QString& strParamName) {};
|
|
virtual void LoadUserParamValue(IDetectorTask *lpTask, IDetectorAlgorithm* lpAlgorithm, QString& strParamName, QVariant& value) {};
|
|
virtual bool HandleEvent(IDetectorTask *lpTask, IDetectorAlgorithm* lpAlgorithm, QString& strParaName, int event) { return true; };
|
|
};
|
|
|
|
|
|
#define REGISTER_FUNCTION_IMPLEMENT(NAME, FUNC) \
|
|
if (NULL != pAlgoLib) { \
|
|
if (!pAlgoLib->RegisterFunc(#NAME, FUNC)) \
|
|
return false; \
|
|
}
|
|
|
|
#define DEFINE_FUNCTION_PARAM_IMPLEMENT(FUNCNAME, PARAMNAME, TYPE, INITVAL, DIR) \
|
|
if (NULL != pAlgoLib) { \
|
|
LP_ALGORITHM_PARAM_DESC desc; \
|
|
desc.strName = PARAMNAME; \
|
|
desc.type = TYPE; \
|
|
desc.InitVal = INITVAL; \
|
|
desc.dir = DIR; \
|
|
if (!pAlgoLib->DefFuncParam(#FUNCNAME, desc)) \
|
|
return false; \
|
|
}
|
|
|
|
#ifdef ALGO_LIB
|
|
# define ALGO_EXPORT extern "C" __declspec(dllexport)
|
|
#else
|
|
# define ALGO_EXPORT extern "C" __declspec(dllimport)
|
|
#endif
|
|
|
|
typedef void(*FnLpAlgoNewInstance)(IAlgo** lppAlgo);
|
|
|
|
ALGO_EXPORT void LpAlgoNewInstance(IAlgo** lppAlgo);
|
|
|
|
ALGO_EXPORT bool LpAlgoDeleteInstance();
|
|
|
|
|
|
#endif // LPALGORITHM_H
|