HwCap.h 3.38 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
//###########################################################################
// 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/>.
//###########################################################################
ahoms's avatar
ahoms committed
22
23
24
#ifndef HWCAP_H
#define HWCAP_H

25
26
#include "lima/LimaCompatibility.h"
#include "lima/Constants.h"
27

ahoms's avatar
ahoms committed
28
29
namespace lima
{
30
31
32
33
34
35
36
class HwDetInfoCtrlObj;
class HwBufferCtrlObj;
class HwSyncCtrlObj;
class HwBinCtrlObj;
class HwRoiCtrlObj;
class HwFlipCtrlObj;
class HwShutterCtrlObj;
Florent Langlois's avatar
Florent Langlois committed
37
class HwVideoCtrlObj;
38
class HwEventCtrlObj;
39
class HwSavingCtrlObj;
40
class HwConfigCtrlObj;
41
class HwReconstructionCtrlObj;
ahoms's avatar
ahoms committed
42

43
class LIMACORE_API HwCap
ahoms's avatar
ahoms committed
44
45
46
{
public:
	enum Type {
47
	        Undef,
48
		DetInfo, Buffer, Sync, 	// Standard: these are mandatory
49
		Roi, Bin, Flip,		// Image operations
ahoms's avatar
ahoms committed
50
51
		Kinetics, FrameTransfer,// Acquisition modes
		Timing,			// Read only detector timmings
ahoms's avatar
ahoms committed
52
		Shutter,		// Shutter control
ahoms's avatar
ahoms committed
53
		SerialLine, 		// Generic detector serial line
Florent Langlois's avatar
Florent Langlois committed
54
		Video,			// Video capable usualy color camera 
55
		Event,			// Asynch. event (error) generator
56
		Saving,			// Saving capable
57
		Config,			// Config management capable
58
		Reconstruction,		// Image reconstruction capable
ahoms's avatar
ahoms committed
59
	};
60
61
	HwCap() : m_type(Undef),m_ctrl_obj(NULL) {}
	
62
63
64
65
	template <class CtrlObj>
	HwCap(CtrlObj *ctrl_obj) : m_ctrl_obj(ctrl_obj)
	{ m_type = getTypeFromCtrlObj(ctrl_obj); }

66
67
	HwCap(const HwCap &cap) : m_type(cap.m_type),m_ctrl_obj(cap.m_ctrl_obj) {}

68
69
	Type getType() const
	{ return m_type; }
ahoms's avatar
ahoms committed
70

71
72
73
74
75
76
77
	static Type getTypeFromCtrlObj(HwDetInfoCtrlObj*);
	static Type getTypeFromCtrlObj(HwBufferCtrlObj*);
	static Type getTypeFromCtrlObj(HwSyncCtrlObj*);
	static Type getTypeFromCtrlObj(HwBinCtrlObj*);
	static Type getTypeFromCtrlObj(HwRoiCtrlObj*);
	static Type getTypeFromCtrlObj(HwFlipCtrlObj*);
	static Type getTypeFromCtrlObj(HwShutterCtrlObj*);
Florent Langlois's avatar
Florent Langlois committed
78
	static Type getTypeFromCtrlObj(HwVideoCtrlObj*);
79
	static Type getTypeFromCtrlObj(HwEventCtrlObj*);
80
	static Type getTypeFromCtrlObj(HwSavingCtrlObj*);
81
	static Type getTypeFromCtrlObj(HwConfigCtrlObj*);
82
	static Type getTypeFromCtrlObj(HwReconstructionCtrlObj*);
83
84
85
86
87
88
89
90

	template <class CtrlObj>
	bool getCtrlObj(CtrlObj *& ctrl_obj) const
	{ 
		bool ok = (m_type == getTypeFromCtrlObj(ctrl_obj));
		ctrl_obj = ok ? (CtrlObj *) m_ctrl_obj : NULL;
		return ok;
	}
ahoms's avatar
ahoms committed
91
92
93
94
95
96
97
 private:
	Type m_type;
	void *m_ctrl_obj;
};
 
} // namespace lima

98
99
100
101
102
103
104
105
106
107
#include "lima/HwDetInfoCtrlObj.h"
#include "lima/HwBufferCtrlObj.h"
#include "lima/HwSyncCtrlObj.h"
#include "lima/HwBinCtrlObj.h"
#include "lima/HwRoiCtrlObj.h"
#include "lima/HwFlipCtrlObj.h"
#include "lima/HwShutterCtrlObj.h"
#include "lima/HwVideoCtrlObj.h"
#include "lima/HwEventCtrlObj.h"
#include "lima/HwSavingCtrlObj.h"
108
#include "lima/HwReconstructionCtrlObj.h"
109

ahoms's avatar
ahoms committed
110
#endif // HWCAP_H