派生自 development/c++

xuxiuxi
2019-03-08 5bf0020b189b2bc8c64737c2af4ea77c3e8f5612
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#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