CtBuffer.h 2.01 KB
Newer Older
papillon's avatar
 
papillon committed
1
2
3
4
#ifndef CTBUFFER_H
#define CTBUFFER_H

#include "Constants.h"
papillon's avatar
   
papillon committed
5
#include "SizeUtils.h"
papillon's avatar
   
papillon committed
6
#include "CtAcquisition.h"
papillon's avatar
   
papillon committed
7
#include "CtImage.h"
papillon's avatar
   
papillon committed
8
#include "HwInterface.h"
papillon's avatar
   
papillon committed
9
10
11
#include "HwFrameCallback.h"

#include "Data.h"
papillon's avatar
 
papillon committed
12
13
14

namespace lima {

15
  class DLL_EXPORT CtBufferFrameCB : public HwFrameCallback
seb's avatar
seb committed
16
17
  {
    DEB_CLASS_NAMESPC(DebModControl,"BufferFrameCB","Control");
18
    friend class CtBuffer;
seb's avatar
seb committed
19
  public:
20
    CtBufferFrameCB(CtControl *ct): m_ct(ct),m_ct_accumulation(NULL) {}
seb's avatar
seb committed
21
22
23
  protected:
    bool newFrameReady(const HwFrameInfoType& frame_info);
  private:
24
25
    CtControl* 		m_ct;
    CtAccumulation* 	m_ct_accumulation;
seb's avatar
seb committed
26
27
  };

28
  class DLL_EXPORT CtBuffer 
seb's avatar
seb committed
29
30
31
32
  {
    DEB_CLASS_NAMESPC(DebModControl,"Buffer","Control");

  public:
33
    struct DLL_EXPORT Parameters 
seb's avatar
seb committed
34
35
    {
      DEB_CLASS_NAMESPC(DebModControl,"Buffer::Parameters","Control");
papillon's avatar
   
papillon committed
36
    public:
seb's avatar
seb committed
37
38
39
40
41
42
      Parameters();
      void reset();
      BufferMode mode;
      long	nbBuffers;
      short	maxMemory;
    };
papillon's avatar
   
papillon committed
43

seb's avatar
seb committed
44
45
    CtBuffer(HwInterface *hw);
    ~CtBuffer();
papillon's avatar
 
papillon committed
46

seb's avatar
seb committed
47
48
    void setPars(Parameters pars);
    void getPars(Parameters& pars) const;
papillon's avatar
 
papillon committed
49

seb's avatar
seb committed
50
51
    void setMode(BufferMode mode);
    void getMode(BufferMode& mode) const;
papillon's avatar
   
papillon committed
52

seb's avatar
seb committed
53
54
    void setNumber(long nb_buffers);
    void getNumber(long& nb_buffers) const;
papillon's avatar
 
papillon committed
55

seb's avatar
seb committed
56
57
    void setMaxMemory(short max_memory);
    void getMaxMemory(short& max_memory) const;
papillon's avatar
 
papillon committed
58

seb's avatar
seb committed
59
60
    void registerFrameCallback(CtControl *ct);
    void unregisterFrameCallback();
61
	
seb's avatar
seb committed
62
63
    void getFrame(Data&,int frameNumber);

64
    void reset();
seb's avatar
seb committed
65
    void setup(CtControl *ct);
papillon's avatar
   
papillon committed
66

seb's avatar
seb committed
67
68
    static void getDataFromHwFrameInfo(Data&,const HwFrameInfoType&);
  private:
papillon's avatar
   
papillon committed
69

70
71
72
73
    HwBufferCtrlObj* 	m_hw_buffer;
    CtBufferFrameCB* 	m_frame_cb;
    Parameters		m_pars;
    CtAccumulation* 	m_ct_accumulation;
seb's avatar
seb committed
74
  };
papillon's avatar
 
papillon committed
75

seb's avatar
seb committed
76
77
78
79
80
81
82
83
84
85
  inline std::ostream& operator<<(std::ostream &os,
				  const CtBuffer::Parameters &params)
  {
    os << "<"
       << "mode=" << params.mode << ", "
       << "nbBuffers=" << params.nbBuffers << ", "
       << "maxMemory=" << params.maxMemory << ", "
       << ">";
    return os;
  }
papillon's avatar
 
papillon committed
86
87
88
} // namespace lima

#endif // CTBUFFER_H