1 /* This file is part of the hkl library.
3 * The hkl library is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
6 * (at your option) any later version.
8 * The hkl library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with the hkl library. If not, see <http://www.gnu.org/licenses/>.
16 * Copyright (C) 2003-2010 Synchrotron SOLEIL
17 * L'Orme des Merisiers Saint-Aubin
18 * BP 48 91192 GIF-sur-YVETTE CEDEX
20 * Authors: Picca Frédéric-Emmanuel <picca@synchrotron-soleil.fr>
22 #ifndef __HKL_PSEUDOAXIS_H__
23 #define __HKL_PSEUDOAXIS_H__
25 #include <ccan/list/list.h>
26 #include <hkl/hkl-detector.h>
27 #include <hkl/hkl-sample.h>
28 #include <hkl/hkl-error.h>
32 typedef struct _HklPseudoAxis HklPseudoAxis
;
33 typedef struct _HklPseudoAxisEngineModeOperations HklPseudoAxisEngineModeOperations
;
34 typedef struct _HklPseudoAxisEngineModeInfo HklPseudoAxisEngineModeInfo
;
35 typedef struct _HklPseudoAxisEngineMode HklPseudoAxisEngineMode
;
36 typedef struct _HklPseudoAxisEngineInfo HklPseudoAxisEngineInfo
;
37 typedef struct _HklPseudoAxisEngine HklPseudoAxisEngine
;
38 typedef struct _HklPseudoAxisEngineList HklPseudoAxisEngineList
;
43 HklPseudoAxisEngine
*engine
;
44 struct list_node list
; /* PseudoAxisEngine */
47 struct _HklPseudoAxisEngineModeOperations
49 int (* init
)(HklPseudoAxisEngineMode
*self
,
50 HklPseudoAxisEngine
*engine
,
51 HklGeometry
*geometry
,
52 HklDetector
*detector
,
55 int (* get
)(HklPseudoAxisEngineMode
*self
,
56 HklPseudoAxisEngine
*engine
,
57 HklGeometry
*geometry
,
58 HklDetector
*detector
,
61 int (* set
)(HklPseudoAxisEngineMode
*self
,
62 HklPseudoAxisEngine
*engine
,
63 HklGeometry
*geometry
,
64 HklDetector
*detector
,
69 struct _HklPseudoAxisEngineModeInfo
{
73 const HklParameter
*parameters
;
74 const uint n_parameters
;
77 struct _HklPseudoAxisEngineMode
79 const HklPseudoAxisEngineModeInfo
*info
;
80 const HklPseudoAxisEngineModeOperations
*op
;
81 HklParameter
*parameters
;
82 size_t parameters_len
;
83 HklGeometry
*geometry_init
;
84 HklDetector
*detector_init
;
85 HklSample
*sample_init
;
86 struct list_node list
;
89 struct _HklPseudoAxisEngineInfo
{
91 const HklPseudoAxis
**pseudo_axes
;
92 const uint n_pseudo_axes
;
95 struct _HklPseudoAxisEngine
97 const HklPseudoAxisEngineInfo
*info
;
98 HklGeometry
*geometry
;
99 HklDetector
*detector
;
101 struct list_head modes
; /* owned */
102 struct list_head pseudo_axes
; /* owned */
103 struct list_head axes
; /* item not owned */
104 HklPseudoAxisEngineMode
*mode
; /* not owned */
105 HklPseudoAxisEngineList
*engines
; /* not owned */
106 struct list_node list
; /* PseudoAxisEngineList */
110 * HklPseudoAxisEngineList:
112 struct _HklPseudoAxisEngineList
114 struct list_head engines
;
115 HklGeometryList
*geometries
;
116 HklGeometry
*geometry
;
117 HklDetector
*detector
;
125 extern void hkl_pseudo_axis_fprintf(FILE *f
, HklPseudoAxis
*self
);
127 /***************************/
128 /* HklPseudoAxisEngineMode */
129 /***************************/
131 extern void hkl_pseudo_axis_engine_mode_fprintf(FILE *f
, const HklPseudoAxisEngineMode
*self
);
133 /***********************/
134 /* HklPseudoAxisEngine */
135 /***********************/
137 extern void hkl_pseudo_axis_engine_select_mode(HklPseudoAxisEngine
*self
,
138 HklPseudoAxisEngineMode
*mode
);
140 extern void hkl_pseudo_axis_engine_select_mode_by_name(HklPseudoAxisEngine
*self
,
143 extern int hkl_pseudo_axis_engine_initialize(HklPseudoAxisEngine
*self
, HklError
**error
);
145 extern int hkl_pseudo_axis_engine_set(HklPseudoAxisEngine
*self
, HklError
**error
);
147 extern int hkl_pseudo_axis_engine_get(HklPseudoAxisEngine
*self
, HklError
**error
);
149 extern void hkl_pseudo_axis_engine_set_values(HklPseudoAxisEngine
*self
,
150 double values
[], uint len
);
152 extern void hkl_pseudo_axis_engine_get_values(HklPseudoAxisEngine
*self
,
153 double values
[], uint
*len
);
155 extern void hkl_pseudo_axis_engine_fprintf(FILE *f
, const HklPseudoAxisEngine
*self
);
157 /***************************/
158 /* HklPseudoAxisEngineList */
159 /***************************/
161 extern void hkl_pseudo_axis_engine_list_free(HklPseudoAxisEngineList
*self
);
163 extern HklPseudoAxisEngine
*hkl_pseudo_axis_engine_list_get_by_name(HklPseudoAxisEngineList
*self
,
166 extern HklPseudoAxis
*hkl_pseudo_axis_engine_list_get_pseudo_axis_by_name(HklPseudoAxisEngineList
*self
,
169 extern void hkl_pseudo_axis_engine_list_init(HklPseudoAxisEngineList
*self
,
170 HklGeometry
*geometry
,
171 HklDetector
*detector
,
174 extern int hkl_pseudo_axis_engine_list_get(HklPseudoAxisEngineList
*self
);
176 extern void hkl_pseudo_axis_engine_list_fprintf(FILE *f
,
177 const HklPseudoAxisEngineList
*self
);
180 #endif /* __HKL_PSEUDOAXIS_H__ */