create an HklPseudoAxisEngineModeInfo for the Automatic modes.
[hkl.git] / hkl / hkl-pseudoaxis.h
blob914afff0f2a4618ee3112eeacd1f48e3ca05d93e
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>
30 HKL_BEGIN_DECLS
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;
40 struct _HklPseudoAxis
42 HklParameter parent;
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,
53 HklSample *sample,
54 HklError **error);
55 int (* get)(HklPseudoAxisEngineMode *self,
56 HklPseudoAxisEngine *engine,
57 HklGeometry *geometry,
58 HklDetector *detector,
59 HklSample *sample,
60 HklError **error);
61 int (* set)(HklPseudoAxisEngineMode *self,
62 HklPseudoAxisEngine *engine,
63 HklGeometry *geometry,
64 HklDetector *detector,
65 HklSample *sample,
66 HklError **error);
69 struct _HklPseudoAxisEngineModeInfo {
70 const char *name;
71 const char **axes;
72 const uint n_axes;
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 {
90 const char *name;
91 const HklPseudoAxis **pseudo_axes;
92 const uint n_pseudo_axes;
95 struct _HklPseudoAxisEngine
97 const HklPseudoAxisEngineInfo *info;
98 HklGeometry *geometry;
99 HklDetector *detector;
100 HklSample *sample;
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;
118 HklSample *sample;
121 /*****************/
122 /* HklPseudoAxis */
123 /*****************/
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,
141 const char *name);
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,
164 const char *name);
166 extern HklPseudoAxis *hkl_pseudo_axis_engine_list_get_pseudo_axis_by_name(HklPseudoAxisEngineList *self,
167 const char *name);
169 extern void hkl_pseudo_axis_engine_list_init(HklPseudoAxisEngineList *self,
170 HklGeometry *geometry,
171 HklDetector *detector,
172 HklSample *sample);
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);
178 HKL_END_DECLS
180 #endif /* __HKL_PSEUDOAXIS_H__ */