upgrading copyright year from 2015 to 2016
[hkl.git] / hkl / hkl-types.c
blob557ffe7727f854286136ec8d88c29cab4e244759
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) 2011-2016 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 #include <glib-object.h>
23 #include "hkl-types.h"
24 #include "glib/gthread.h" // for g_once_init_enter, etc
25 #include "glibconfig.h" // for gsize
26 #include "hkl-detector-private.h" // for hkl_detector_new_copy
27 #include "hkl-geometry-private.h" // for hkl_geometry_list_free, etc
28 #include "hkl-matrix-private.h" // for hkl_matrix_dup
29 #include "hkl-pseudoaxis-private.h" // for hkl_engine_list_new_copy
30 #include "hkl-sample-private.h" // for hkl_sample_reflection_free, etc
31 #include "hkl-unit-private.h" // for hkl_unit_dup, hkl_unit_free
32 #include "hkl-vector-private.h" // for hkl_vector_dup, etc
34 #define HKL_TYPE(type, camelcase_type, copy, free) \
35 GType hkl_## type ## _get_type (void) { \
36 static volatile gsize hkl_type_id__volatile = 0; \
37 if (g_once_init_enter (&hkl_type_id__volatile)) { \
38 GType hkl_type_id; \
39 hkl_type_id = g_boxed_type_register_static ( \
40 #camelcase_type, \
41 (GBoxedCopyFunc) copy, \
42 (GBoxedFreeFunc) free); \
43 g_once_init_leave (&hkl_type_id__volatile, hkl_type_id); \
44 } \
45 return hkl_type_id__volatile; \
48 static void * hkl_fake_ref(void *src) { return src; }
49 static void hkl_fake_unref(void *src) { return; }
51 HKL_TYPE(detector, HklDetector, hkl_detector_new_copy, hkl_detector_free);
52 HKL_TYPE(engine, HklEngine, hkl_fake_ref, hkl_fake_unref);
53 HKL_TYPE(engine_list, HklEngineList, hkl_engine_list_new_copy, hkl_engine_list_free);
54 HKL_TYPE(factory, HklFactory, hkl_fake_ref, hkl_fake_unref);
55 HKL_TYPE(geometry, HklGeometry, hkl_geometry_new_copy, hkl_geometry_free);
56 HKL_TYPE(geometry_list, HklGeometryList, hkl_geometry_list_new_copy, hkl_geometry_list_free);
57 HKL_TYPE(geometry_list_item, HklGeometryListItem, hkl_geometry_list_item_new_copy, hkl_geometry_list_item_free);
58 HKL_TYPE(lattice, HklLattice, hkl_lattice_new_copy, hkl_lattice_free);
59 HKL_TYPE(matrix, HklMatrix, hkl_matrix_dup, hkl_matrix_free);
60 HKL_TYPE(parameter, HklParameter, hkl_parameter_new_copy, hkl_parameter_free);
61 HKL_TYPE(quaternion, HklQuaternion, hkl_quaternion_dup, hkl_quaternion_free);
62 HKL_TYPE(sample, HklSample, hkl_sample_new_copy, hkl_sample_free);
63 HKL_TYPE(sample_reflection, HklSampleReflection, hkl_fake_ref, hkl_fake_unref);
64 HKL_TYPE(unit, HklUnit, hkl_unit_dup, hkl_unit_free);
65 HKL_TYPE(vector, HklVector, hkl_vector_dup, hkl_vector_free);