CtBuffer.h 1.85 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 {

seb's avatar
seb committed
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
  class CtBufferFrameCB : public HwFrameCallback
  {
    DEB_CLASS_NAMESPC(DebModControl,"BufferFrameCB","Control");
  public:
    CtBufferFrameCB(CtControl *ct): m_ct(ct) {}
  protected:
    bool newFrameReady(const HwFrameInfoType& frame_info);
  private:
    CtControl *m_ct;
  };

  class CtBuffer 
  {
    DEB_CLASS_NAMESPC(DebModControl,"Buffer","Control");

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

seb's avatar
seb committed
42
43
    CtBuffer(HwInterface *hw);
    ~CtBuffer();
papillon's avatar
 
papillon committed
44

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

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

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

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

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

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

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

seb's avatar
seb committed
68
69
70
    HwBufferCtrlObj	*m_hw_buffer;
    CtBufferFrameCB *m_frame_cb;
    Parameters	m_pars;
71

seb's avatar
seb committed
72
  };
papillon's avatar
 
papillon committed
73

seb's avatar
seb committed
74
75
76
77
78
79
80
81
82
83
  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
84
85
86
} // namespace lima

#endif // CTBUFFER_H