Simulator.h 1.36 KB
Newer Older
ahoms's avatar
ahoms committed
1
2
3
4
5
6
#ifndef SIMULATOR_H
#define SIMULATOR_H

#include "HwBufferMgr.h"
#include "FrameBuilder.h"
#include "ThreadUtils.h"
7
8
#include "SizeUtils.h"
#include <ostream>
ahoms's avatar
ahoms committed
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

namespace lima
{

class Simulator
{
 public:
	enum Status {
		Ready, Exposure, Readout,
	};

	Simulator();
	~Simulator();

	BufferCtrlMgr& getBufferMgr();
	
	void startAcq();
	void stopAcq();

	void setNbFrames(int  nb_frames);
	void getNbFrames(int& nb_frames);

	void setExpTime(double  exp_time);
	void getExpTime(double& exp_time);

ahoms's avatar
ahoms committed
34
	void setBin(const Bin& bin);
35
36
	void getBin(Bin& bin);

37
38
39
	void setFrameDim(const FrameDim& frame_dim);
	void getFrameDim(FrameDim& frame_dim);
	
40
41
	Status getStatus();

ahoms's avatar
ahoms committed
42
43
44
45
46
47
48
49
50
51
52
53
54
55
 private:
	class SimuThread : public CmdThread
	{
	public:
		enum { // Status
			Ready = MaxThreadStatus, Exposure, Readout,
		};

		enum { // Cmd 
			StartAcq = MaxThreadCmd, StopAcq,
		};
		
		SimuThread(Simulator& simu);

56
57
		virtual void start();

ahoms's avatar
ahoms committed
58
59
60
61
	protected:
		virtual void init();
		virtual void execCmd(int cmd);
	private:
62
		void execStartAcq();
ahoms's avatar
ahoms committed
63

64
65
		Simulator& m_simu;
		int m_acq_frame_nb;
ahoms's avatar
ahoms committed
66
67
68
	};
	friend class SimuThread;

69
70
71
	SoftBufferAllocMgr m_buffer_alloc_mgr;
	StdBufferCbMgr m_buffer_cb_mgr;
	BufferCtrlMgr m_buffer_ctrl_mgr;
ahoms's avatar
ahoms committed
72
73
74
75
76
77
78
	FrameBuilder m_frame_builder;
	double m_exp_time;
	int m_nb_frames;

	SimuThread m_thread;
};

79
80
std::ostream& operator <<(std::ostream& os, Simulator& simu);

ahoms's avatar
ahoms committed
81
82
83
} // namespace lima

#endif // SIMULATOR_H