DoubleBufferHandler.h 760 Bytes
Newer Older
d11's avatar
no    
d11 committed
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
#pragma once

#include <thread>
#include <vector>
#include <mutex>
#include <list>

#define _GNULINUX
#include </usr/local/src/baumer/inc/bgapi2_genicam/bgapi2_genicam.hpp>

class CDoubleBufferHandler{
public:
    CDoubleBufferHandler();
    CDoubleBufferHandler(const CDoubleBufferHandler &instance);
    virtual ~CDoubleBufferHandler();
    virtual void PushBuffer(BGAPI2::Buffer *buffer);
    virtual BGAPI2::Buffer* PullBuffer();
    virtual void FreeBuffer(BGAPI2::Buffer *buffer);
    virtual void Init();
    virtual bool HasNewData();
    CDoubleBufferHandler & operator =(const CDoubleBufferHandler &instance);
private:
    BGAPI2::Buffer * buffer_read_;
    BGAPI2::Buffer * buffer_write_;
    std::mutex buffer_exchange_lock_;
    bool new_data;
};