Files
2026-02-01 22:23:06 +08:00

72 lines
2.3 KiB
C++

/*
* @Date: 2024-09-04 14:44:39
* @LastEditors: Jacky
* @LastEditTime: 2024-09-13 15:45:24
* @FilePath: /GeneralTracker/BufferPool/DataProcessBase.h
*/
#ifndef DATPROCESSBASE_H
#define DATPROCESSBASE_H
#include <functional>
#include <thread>
#include <string>
#include "json.hpp"
#include "IMemoryPool.h"
#define QUEUE_SIZE 10
class DataProcessBase
{
public:
DataProcessBase();
~DataProcessBase();
virtual int create(const char* name) = 0; ///< [同步接口]创建模块
virtual int set_data(const char* data, void* value = NULL) = 0; ///< [同步接口]设定模块的参数
virtual char* get_data() = 0; ///< [同步接口]获取模块的参数
virtual int start(const char* data) = 0; ///< [同步接口]运行模块并设定模块参数
virtual int stop() = 0; ///< [同步接口]停止模块
virtual int destroy() = 0; ///< [同步接口]销毁模块
virtual void push_data(DataProcessBase *src, pool::IMemoryBlock* block) = 0; //数据传递
void jionCtrl();
int notify(const char* nameDst, const char* data, void* value);
std::string name(); ///< [同步接口]获取实例名
void linkV(DataProcessBase* Dst);
void unLinkV(DataProcessBase* Dst);
void push_input_pipe(pool::IMemoryBlock* block);
std::string m_pcName;
pool::IMemoryQueue m_pSelfQueue;
std::list<DataProcessBase*> m_listDstQueue;
inline void setType(int type){
_node_type = type;
}
inline int getType(){
return _node_type;
}
inline void setChild(const std::list<std::string > &child){
_child_name_list = child;
}
inline std::list<std::string > children(){
return _child_name_list;
}
inline bool messageEnabled(){
return _message_filter_enable;
}
bool isExist(DataProcessBase *dst);
private:
std::list<std::string > _child_name_list;
bool _message_filter_enable = false;
int _node_type; //模块类型
};
#endif // DATPROCESSBASE_H