SlsDetectorModel.h 3.39 KB
Newer Older
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
//###########################################################################
// This file is part of LImA, a Library for Image Acquisition
//
// Copyright (C) : 2009-2011
// European Synchrotron Radiation Facility
// BP 220, Grenoble 38043
// FRANCE
//
// This is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3 of the License, or
// (at your option) any later version.
//
// This software is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, see <http://www.gnu.org/licenses/>.
//###########################################################################

#ifndef __SLS_DETECTOR_MODEL_H
#define __SLS_DETECTOR_MODEL_H

#include "SlsDetectorDefs.h"
27
#include "SlsDetectorCPUAffinity.h"
28
#include "SlsDetectorReconstruction.h"
29
#include "SlsDetectorBuffer.h"
30
31
32

#include "lima/SizeUtils.h"

33
#include "sls/Detector.h"
34

35
36
37
38
39
40
41
namespace lima 
{

namespace SlsDetector
{

class Camera;
42
class Receiver;
43
44
45
46
47

class Model
{
	DEB_CLASS_NAMESPC(DebModCamera, "Model", "SlsDetector");
 public:
48
49
	typedef Defs::Settings Settings;

50
	typedef FrameMap::FinishInfo FinishInfo;
51

52
53
54
55
	Model(Camera *cam, Type type);
	virtual ~Model();
	
	virtual void getFrameDim(FrameDim& frame_dim, bool raw = false) = 0;
56
57
	virtual void getAcqFrameDim(FrameDim& frame_dim, bool raw = false);

58
59
60
61
62
63
	Camera *getCamera()
	{ return m_cam; }

	Type getType()
	{ return m_type; }

64
65
66
	int getNbDetModules()
	{ return m_nb_det_modules; }

67
68
	virtual void getDetMap(Data& det_map) = 0;

69
70
71
	virtual void setNbUDPInterfaces(int  nb_udp_ifaces);
	virtual void getNbUDPInterfaces(int& nb_udp_ifaces);

72
73
74
75
76
77
78
79
80
81
82
	virtual std::string getName() = 0;
	virtual void getPixelSize(double& x_size, double& y_size) = 0;

	virtual void getDACInfo(NameList& name_list, IntList& idx_list,
				IntList& milli_volt_list) = 0;
	virtual void getADCInfo(NameList& name_list, IntList& idx_list,
				FloatList& factor_list, 
				FloatList& min_val_list) = 0;

	virtual void getTimeRanges(TimeRanges& time_ranges) = 0;

83
84
85
	virtual int getNbFrameMapItems() = 0;
	virtual void updateFrameMapItems(FrameMap *map) = 0;

86
	virtual bool isAcqActive();
87
88
	virtual bool isXferActive() = 0;

89
90
	virtual void setThreadCPUAffinity(const CPUAffinityList& aff_list) = 0;

91
92
	virtual Reconstruction *getReconstruction();

93
94
	void processPackets();

95
96
 protected:
	void updateCameraModel();
97
98
	void updateCameraImageSize();
	void updateCameraTimeRanges();
99
100
101
102
103
104

	virtual void updateImageSize() = 0;

	void putCmd(const std::string& s, int idx = -1);
	std::string getCmd(const std::string& s, int idx = -1);

105
	char *getAcqFrameBufferPtr(FrameType frame_nb);
106

107
108
109
	virtual bool checkSettings(Settings settings) = 0;

	virtual void prepareAcq() = 0;
110
111
112
113
	virtual void startAcq() = 0;
	virtual void stopAcq() = 0;

	void processFinishInfo(const FinishInfo& finfo);
114

115
116
	BufferMgr *getBuffer();

117
118
 private:
	friend class Camera;
119
120
	friend class Receiver;

121
122
	Camera *m_cam;
	Type m_type;
123
	int m_nb_det_modules;
124
	int m_nb_udp_ifaces;
125
126

 protected:
127
	AutoPtr<sls::Detector> m_det;
128
129
	FrameType m_next_frame;
	FrameType m_last_frame;
130
131
132
133
134
135
136
137
138
139
};


} // namespace SlsDetector

} // namespace lima



#endif // __SLS_DETECTOR_MODEL_H