77 lines
1.8 KiB
C++
77 lines
1.8 KiB
C++
/*********************************************************************
|
|
*
|
|
* 文 件: AlgorithmManager.h
|
|
*
|
|
* 版权所有: Shanghai Baosight Software Co., Ltd.
|
|
*
|
|
*
|
|
*********************************************************************/
|
|
|
|
#ifndef H_ALGORITHM_MANAGER_H
|
|
#define H_ALGORITHM_MANAGER_H
|
|
|
|
#include <T_RULE_CFG.h>
|
|
#include <common/Macro.h>
|
|
#include <eqpalg/AlgorithmBase.h>
|
|
#include <eqpalg/AlgorithmBuilder.h>
|
|
#include <eqpalg/AlgorithmThread.h>
|
|
#include <json/json.h>
|
|
#include <map>
|
|
#include <zlib/MemTable.hpp>
|
|
|
|
using namespace std;
|
|
using namespace baosight;
|
|
|
|
#define EVENT_NO_MAX 2011
|
|
#define EVENT_NO_MIN 2000
|
|
|
|
class EV_CASE {
|
|
public:
|
|
static const int CTRL_DELETE = 0;
|
|
static const int CTRL_CREATE = 1;
|
|
static const int CTRL_UPDATE = 2;
|
|
static const int CTRL_ENABLE = 3;
|
|
};
|
|
// Algorithm thread heandle
|
|
struct ALG_HANDLE {
|
|
bool active;
|
|
IceUtil::Handle<AlgorithmThread> tHDL;
|
|
IceUtil::ThreadControl tTC;
|
|
};
|
|
|
|
/*********************************************************************
|
|
* 类 名: AlgorithmManager
|
|
* 版权所有: Shanghai Baosight Software Co., Ltd.
|
|
*
|
|
*********************************************************************/
|
|
class AlgorithmManager {
|
|
public:
|
|
AlgorithmManager();
|
|
virtual ~AlgorithmManager();
|
|
|
|
public:
|
|
virtual void Dispose(int eventno, const ::Ice::ByteSeq &);
|
|
|
|
int Attach(const string ruleid, short algid, const string &name,
|
|
const Json::Value &rulejson, bool usable = true);
|
|
|
|
int Detach(const string &ruleid, short algid);
|
|
|
|
int Detach(short algid);
|
|
|
|
int SetUsable(const string &ruleid, short algid);
|
|
|
|
void CacheData(void);
|
|
|
|
protected:
|
|
BinaryTele *p_tele;
|
|
|
|
private:
|
|
CMemTable<T_RULE_CFG::STR_T_RULE_CFG> *mp_tcfg;
|
|
// map<algid,ALG_HANDLE> m_mapalg;
|
|
map<int, ALG_HANDLE> m_mapalg;
|
|
map<string, int> m_mapRalg;
|
|
AlgorithmBuilder m_algbuilder;
|
|
};
|
|
#endif
|