#ifndef HIREDISTOOL_H
|
#define HIREDISTOOL_H
|
#include <opencv/cv.h>
|
//#include <hiredis.h>
|
#include <basic/util/BASE64/Base64.h>
|
#include "../../BasicPlatForm/libs/hiredis-master/include/hiredis.h"
|
#include <map>
|
#include <queue>
|
struct ImgInfo
|
{
|
std::string time;
|
uint64_t framePts;
|
cv::Mat img;
|
};
|
|
static const char * file_list="file_list";
|
class HiredisTool
|
{
|
public:
|
HiredisTool();
|
~HiredisTool();
|
|
//bool setCameraState(const std::string& cam_id,const int& type);
|
// std::map<std::string,int> findAllCamera();
|
bool clearAllImageBuf();
|
|
bool setKeyImage(const std::string& file_name,const cv::Mat& img);
|
void getKeyImage(const std::string& imageName,cv::Mat& img);
|
|
|
bool pushImageBuf(const std::string& file_name,const cv::Mat& img);
|
void getImage(const std::string& file_name,cv::Mat& img);
|
|
|
void addFileInfo(const std::string& filename,const int& file_status);
|
std::queue<cv::Mat> getImgQue(const std::string& filename);
|
std::map<std::string,int> findAllFileStatus();
|
|
bool delKey(const std::string& key);
|
bool listRpop(const std::string& key,std::string& value);
|
bool listLpush(const std::string& key,const std::string& value);
|
int getSize(const std::string& key);
|
bool hashDel(const std::string& tab,const std::string &key);
|
bool hashSet(const std::string& tab,const std::string& key,const int& value);
|
private:
|
|
|
bool listLindex(const std::string& key,std::string& value);
|
// bool listRpop(const std::string& key,std::string& value);
|
//bool listLpush(const std::string& key,const std::string& value);
|
//Redis SET KEY VALUE cmd
|
bool setKeyValue(const std::string& key,const std::string& value);
|
//bool GET KEY cmd
|
bool getKeyValue(const std::string& key,std::string& value);
|
bool checkParam();
|
bool checkResult(redisReply *reply);
|
void init();
|
private:
|
redisContext *m_redis;
|
int m_nImgListLen;
|
Base64 m_base64;
|
|
};
|
|
#endif // HREDISTOOL_H
|