SlsDetectorModel.h 3.34 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
30
31

#include "lima/SizeUtils.h"

32
#include "sls/Detector.h"
33

34
35
36
37
38
39
40
namespace lima 
{

namespace SlsDetector
{

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

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

49
	typedef FrameMap::FinishInfo FinishInfo;
50

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

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

	Type getType()
	{ return m_type; }

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

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

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

71
72
73
74
75
76
77
78
79
80
81
	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;

82
83
84
85
86
	virtual int getNbFrameMapItems() = 0;
	virtual void updateFrameMapItems(FrameMap *map) = 0;
	virtual void processBadItemFrame(FrameType frame, int item,
					 char *bptr) = 0;

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

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

92
93
	virtual Reconstruction *getReconstruction();

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

	virtual void updateImageSize() = 0;

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

104
	char *getAcqFrameBufferPtr(FrameType frame_nb);
105

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

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

	void processFinishInfo(const FinishInfo& finfo);
113
114
115

 private:
	friend class Camera;
116
117
	friend class Receiver;

118
119
	Camera *m_cam;
	Type m_type;
120
	int m_nb_det_modules;
121
	int m_nb_udp_ifaces;
122
123

 protected:
124
	AutoPtr<sls::Detector> m_det;
125
126
127
128
129
130
131
132
133
134
};


} // namespace SlsDetector

} // namespace lima



#endif // __SLS_DETECTOR_MODEL_H