Gyoto
GyotoProperty.h
Go to the documentation of this file.
1
6/*
7 Copyright 2014-2016 Thibaut Paumard
8
9 This file is part of Gyoto.
10
11 Gyoto is free software: you can redistribute it and/or modify
12 it under the terms of the GNU General Public License as published by
13 the Free Software Foundation, either version 3 of the License, or
14 (at your option) any later version.
15
16 Gyoto is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License for more details.
20
21 You should have received a copy of the GNU General Public License
22 along with Gyoto. If not, see <http://www.gnu.org/licenses/>.
23 */
24
25
26#ifndef __GyotoProperty_H_
27#define __GyotoProperty_H_
28
29#include "GyotoConfig.h"
30#include <string>
31#include <vector>
32
33#ifndef GYOTO_PLUGIN
34#define GYOTO_PLUGIN
35#endif
36
37namespace Gyoto {
38 class Object;
39 class Property;
40 namespace Metric { class Generic; }
41 namespace Astrobj { class Generic; }
42 namespace Spectrum { class Generic; }
43 namespace Spectrometer { class Generic; }
44 class Screen;
45 template <class T> class SmartPointer;
46}
47
49
52#define GYOTO_PROPERTY_THREAD_UNSAFE(class) \
53 bool class::isThreadSafe() const {return false;}
54
56
60#define GYOTO_PROPERTY_ACCESSORS(class, type, member, method) \
61 void class::method(type v) {member=v;} \
62 type class::method() const {return member;}
63
65
73#define GYOTO_PROPERTY_ACCESSORS_SPECIAL(class, type, member, method, set, get) \
74 void class::method(type v) {member=v; set } \
75 type class::method() const {get ; return member;}
76
78
88#define GYOTO_PROPERTY_ACCESSORS_GEOMETRICAL(class, member, method, metric) \
89 GYOTO_PROPERTY_ACCESSORS(class, double, member, method) \
90 void class::method(double v, std::string const &u) { \
91 member=Units::ToGeometrical(v, u, metric); \
92 } \
93 double class::method(std::string const &u) const { \
94 return Units::FromGeometrical(member, u, metric); \
95 }
96
98
108#define GYOTO_PROPERTY_ACCESSORS_GEOMETRICAL_SPECIAL(class, member, method, metric, set, get) \
109 GYOTO_PROPERTY_ACCESSORS_SPECIAL(class, double, member, method, set, get) \
110 void class::method(double v, std::string const &u) { \
111 member=Units::ToGeometrical(v, u, metric); \
112 } \
113 double class::method(std::string const &u) const { \
114 return Units::FromGeometrical(member, u, metric); \
115 }
116
118
127#define GYOTO_PROPERTY_ACCESSORS_UNIT(class, member, method, unit) \
128 GYOTO_PROPERTY_ACCESSORS(class, double, member, method) \
129 void class::method(double v, std::string const &u) { \
130 method(Units::Converter(u, unit)(v)); \
131 } \
132 double class::method(std::string const &u) const { \
133 return Units::Converter(unit, u)(method()); \
134 }
135
137
141#define GYOTO_PROPERTY_START(...) \
142 GYOTO_PROPERTY_CHOOSER(,##__VA_ARGS__, \
143 "wrong number of arguments", \
144 "wrong number of arguments", \
145 "wrong number of arguments", \
146 "wrong number of arguments", \
147 GYOTO_PROPERTY_START_DOC(__VA_ARGS__), \
148 GYOTO_PROPERTY_START_NODOC(__VA_ARGS__), \
149 "wrong number of arguments" \
150 )
151
152
154/*
155 * Declares a Property named "name". name and namef should not
156 * be quoted.
157 *
158 * \param[in] class Class name
159 * \param[in] name Name of property if true;
160 * \param[in] namef Name of property if false;
161 * \param[in] fname Name of functions for setting or getting the property
162 * \param[in] doc Document string (optional but recommended)
163 */
164#define GYOTO_PROPERTY_BOOL(...) \
165 GYOTO_PROPERTY_CHOOSER(,##__VA_ARGS__, \
166 "wrong number of arguments", \
167 GYOTO_PROPERTY_BOOL_DOC(__VA_ARGS__), \
168 GYOTO_PROPERTY_BOOL_NODOC(__VA_ARGS__), \
169 "wrong number of arguments", \
170 "wrong number of arguments", \
171 "wrong number of arguments", \
172 "wrong number of arguments" \
173 )
174
176/*
177 * Declares a Property named "name". name and namef should not
178 * be quoted.
179 *
180 * \param[in] class Class name
181 * \param[in] name Name of property if true;
182 * \param[in] fname Name of functions for setting or getting the property
183 * \param[in] doc Document string (optional but recommended)
184 */
185#define GYOTO_PROPERTY_DOUBLE(...) \
186 GYOTO_PROPERTY_CHOOSER(,##__VA_ARGS__, \
187 GYOTO_NOTHING_6, \
188 GYOTO_NOTHING_5, \
189 GYOTO_PROPERTY_DOUBLE_DOC(__VA_ARGS__), \
190 GYOTO_PROPERTY_DOUBLE_NODOC(__VA_ARGS__), \
191 GYOTO_NOTHING_2, \
192 GYOTO_NOTHING_1, \
193 GYOTO_NOTHING_0 \
194 )
195
196
198/*
199 * Declares a Property named "name". name and namef should not
200 * be quoted.
201 *
202 * \param[in] class Class name
203 * \param[in] name Name of property if true;
204 * \param[in] fname Name of functions for setting or getting the property
205 * \param[in] doc Document string (optional but recommended)
206 */
207#define GYOTO_PROPERTY_DOUBLE_UNIT(...) \
208 GYOTO_PROPERTY_CHOOSER(,##__VA_ARGS__, \
209 GYOTO_NOTHING_6, \
210 GYOTO_NOTHING_5, \
211 GYOTO_PROPERTY_DOUBLE_UNIT_DOC(__VA_ARGS__), \
212 GYOTO_PROPERTY_DOUBLE_UNIT_NODOC(__VA_ARGS__), \
213 GYOTO_NOTHING_2, \
214 GYOTO_NOTHING_1, \
215 GYOTO_NOTHING_0 \
216 )
217
219/*
220 * Declares a Property named "name". name and namef should not
221 * be quoted.
222 *
223 * \param[in] class Class name
224 * \param[in] name Name of property if true;
225 * \param[in] fname Name of functions for setting or getting the property
226 * \param[in] doc Document string (optional but recommended)
227 */
228#define GYOTO_PROPERTY_VECTOR_DOUBLE(...) \
229 GYOTO_PROPERTY_CHOOSER(,##__VA_ARGS__, \
230 GYOTO_NOTHING_6, \
231 GYOTO_NOTHING_5, \
232 GYOTO_PROPERTY_VECTOR_DOUBLE_DOC(__VA_ARGS__), \
233 GYOTO_PROPERTY_VECTOR_DOUBLE_NODOC(__VA_ARGS__), \
234 GYOTO_NOTHING_2, \
235 GYOTO_NOTHING_1, \
236 GYOTO_NOTHING_0 \
237 )
238
240/*
241 * Declares a Property named "name". name and namef should not
242 * be quoted.
243 *
244 * \param[in] class Class name
245 * \param[in] name Name of property if true;
246 * \param[in] fname Name of functions for setting or getting the property
247 * \param[in] doc Document string (optional but recommended)
248 */
249#define GYOTO_PROPERTY_VECTOR_DOUBLE_UNIT(...) \
250 GYOTO_PROPERTY_CHOOSER(,##__VA_ARGS__, \
251 GYOTO_NOTHING_6, \
252 GYOTO_NOTHING_5, \
253 GYOTO_PROPERTY_VECTOR_DOUBLE_UNIT_DOC(__VA_ARGS__), \
254 GYOTO_PROPERTY_VECTOR_DOUBLE_UNIT_NODOC(__VA_ARGS__), \
255 GYOTO_NOTHING_2, \
256 GYOTO_NOTHING_1, \
257 GYOTO_NOTHING_0 \
258 )
259
261/*
262 * Declares a Property named "name". name and namef should not
263 * be quoted.
264 *
265 * \param[in] class Class name
266 * \param[in] name Name of property if true;
267 * \param[in] fname Name of functions for setting or getting the property
268 * \param[in] doc Document string (optional but recommended)
269 */
270#define GYOTO_PROPERTY_STRING(...) \
271 GYOTO_PROPERTY_CHOOSER(,##__VA_ARGS__, \
272 GYOTO_NOTHING_6, \
273 GYOTO_NOTHING_5, \
274 GYOTO_PROPERTY_STRING_DOC(__VA_ARGS__), \
275 GYOTO_PROPERTY_STRING_NODOC(__VA_ARGS__), \
276 GYOTO_NOTHING_2, \
277 GYOTO_NOTHING_1, \
278 GYOTO_NOTHING_0 \
279 )
280
282/*
283 * Declares a Property named "name". name and namef should not
284 * be quoted.
285 *
286 * \param[in] class Class name
287 * \param[in] name Name of property if true;
288 * \param[in] fname Name of functions for setting or getting the property
289 * \param[in] doc Document string (optional but recommended)
290 */
291#define GYOTO_PROPERTY_FILENAME(...) \
292 GYOTO_PROPERTY_CHOOSER(,##__VA_ARGS__, \
293 GYOTO_NOTHING_6, \
294 GYOTO_NOTHING_5, \
295 GYOTO_PROPERTY_FILENAME_DOC(__VA_ARGS__), \
296 GYOTO_PROPERTY_FILENAME_NODOC(__VA_ARGS__), \
297 GYOTO_NOTHING_2, \
298 GYOTO_NOTHING_1, \
299 GYOTO_NOTHING_0 \
300 )
301
303/*
304 * Declares a Property named "name". name and namef should not
305 * be quoted.
306 *
307 * \param[in] class Class name
308 * \param[in] name Name of property if true;
309 * \param[in] fname Name of functions for setting or getting the property
310 * \param[in] doc Document string (optional but recommended)
311 */
312#define GYOTO_PROPERTY_LONG(...) \
313 GYOTO_PROPERTY_CHOOSER(,##__VA_ARGS__, \
314 GYOTO_NOTHING_6, \
315 GYOTO_NOTHING_5, \
316 GYOTO_PROPERTY_LONG_DOC(__VA_ARGS__), \
317 GYOTO_PROPERTY_LONG_NODOC(__VA_ARGS__), \
318 GYOTO_NOTHING_2, \
319 GYOTO_NOTHING_1, \
320 GYOTO_NOTHING_0 \
321 )
322
324/*
325 * Declares a Property named "name". name and namef should not
326 * be quoted.
327 *
328 * \param[in] class Class name
329 * \param[in] name Name of property if true;
330 * \param[in] fname Name of functions for setting or getting the property
331 * \param[in] doc Document string (optional but recommended)
332 */
333#define GYOTO_PROPERTY_UNSIGNED_LONG(...) \
334 GYOTO_PROPERTY_CHOOSER(,##__VA_ARGS__, \
335 GYOTO_NOTHING_6, \
336 GYOTO_NOTHING_5, \
337 GYOTO_PROPERTY_UNSIGNED_LONG_DOC(__VA_ARGS__), \
338 GYOTO_PROPERTY_UNSIGNED_LONG_NODOC(__VA_ARGS__), \
339 GYOTO_NOTHING_2, \
340 GYOTO_NOTHING_1, \
341 GYOTO_NOTHING_0 \
342 )
343
345/*
346 * Declares a Property named "name". name and namef should not
347 * be quoted.
348 *
349 * \param[in] class Class name
350 * \param[in] name Name of property if true;
351 * \param[in] fname Name of functions for setting or getting the property
352 * \param[in] doc Document string (optional but recommended)
353 */
354#define GYOTO_PROPERTY_VECTOR_UNSIGNED_LONG(...) \
355 GYOTO_PROPERTY_CHOOSER(,##__VA_ARGS__, \
356 GYOTO_NOTHING_6, \
357 GYOTO_NOTHING_5, \
358 GYOTO_PROPERTY_VECTOR_UNSIGNED_LONG_DOC(__VA_ARGS__), \
359 GYOTO_PROPERTY_VECTOR_UNSIGNED_LONG_NODOC(__VA_ARGS__), \
360 GYOTO_NOTHING_2, \
361 GYOTO_NOTHING_1, \
362 GYOTO_NOTHING_0 \
363 )
364
366/*
367 * Declares a Property named "name". name and namef should not
368 * be quoted.
369 *
370 * \param[in] class Class name
371 * \param[in] name Name of property if true;
372 * \param[in] fname Name of functions for setting or getting the property
373 * \param[in] doc Document string (optional but recommended)
374 */
375#define GYOTO_PROPERTY_SIZE_T(...) \
376 GYOTO_PROPERTY_CHOOSER(,##__VA_ARGS__, \
377 GYOTO_NOTHING_6, \
378 GYOTO_NOTHING_5, \
379 GYOTO_PROPERTY_SIZE_T_DOC(__VA_ARGS__), \
380 GYOTO_PROPERTY_SIZE_T_NODOC(__VA_ARGS__), \
381 GYOTO_NOTHING_2, \
382 GYOTO_NOTHING_1, \
383 GYOTO_NOTHING_0 \
384 )
385
387/*
388 * Declares a Property named "name". name and namef should not
389 * be quoted.
390 *
391 * \param[in] class Class name
392 * \param[in] name Name of property if true;
393 * \param[in] fname Name of functions for setting or getting the property
394 * \param[in] doc Document string (optional but recommended)
395 */
396#define GYOTO_PROPERTY_METRIC(...) \
397 GYOTO_PROPERTY_CHOOSER(,##__VA_ARGS__, \
398 GYOTO_NOTHING_6, \
399 GYOTO_NOTHING_5, \
400 GYOTO_PROPERTY_METRIC_DOC(__VA_ARGS__), \
401 GYOTO_PROPERTY_METRIC_NODOC(__VA_ARGS__), \
402 GYOTO_NOTHING_2, \
403 GYOTO_NOTHING_1, \
404 GYOTO_NOTHING_0 \
405 )
406
407
409/*
410 * Declares a Property named "name". name and namef should not
411 * be quoted.
412 *
413 * \param[in] class Class name
414 * \param[in] name Name of property if true;
415 * \param[in] fname Name of functions for setting or getting the property
416 * \param[in] doc Document string (optional but recommended)
417 */
418#define GYOTO_PROPERTY_SPECTRUM(...) \
419 GYOTO_PROPERTY_CHOOSER(,##__VA_ARGS__, \
420 GYOTO_NOTHING_6, \
421 GYOTO_NOTHING_5, \
422 GYOTO_PROPERTY_SPECTRUM_DOC(__VA_ARGS__), \
423 GYOTO_PROPERTY_SPECTRUM_NODOC(__VA_ARGS__), \
424 GYOTO_NOTHING_2, \
425 GYOTO_NOTHING_1, \
426 GYOTO_NOTHING_0 \
427 )
428
429
431/*
432 * Declares a Property named "name". name and namef should not
433 * be quoted.
434 *
435 * \param[in] class Class name
436 * \param[in] name Name of property if true;
437 * \param[in] fname Name of functions for setting or getting the property
438 * \param[in] doc Document string (optional but recommended)
439 */
440#define GYOTO_PROPERTY_ASTROBJ(...) \
441 GYOTO_PROPERTY_CHOOSER(,##__VA_ARGS__, \
442 GYOTO_NOTHING_6, \
443 GYOTO_NOTHING_5, \
444 GYOTO_PROPERTY_ASTROBJ_DOC(__VA_ARGS__), \
445 GYOTO_PROPERTY_ASTROBJ_NODOC(__VA_ARGS__), \
446 GYOTO_NOTHING_2, \
447 GYOTO_NOTHING_1, \
448 GYOTO_NOTHING_0 \
449 )
450
451
453/*
454 * Declares a Property named "name". name and namef should not
455 * be quoted.
456 *
457 * \param[in] class Class name
458 * \param[in] name Name of property if true;
459 * \param[in] fname Name of functions for setting or getting the property
460 * \param[in] doc Document string (optional but recommended)
461 */
462#define GYOTO_PROPERTY_SCREEN(...) \
463 GYOTO_PROPERTY_CHOOSER(,##__VA_ARGS__, \
464 GYOTO_NOTHING_6, \
465 GYOTO_NOTHING_5, \
466 GYOTO_PROPERTY_SCREEN_DOC(__VA_ARGS__), \
467 GYOTO_PROPERTY_SCREEN_NODOC(__VA_ARGS__), \
468 GYOTO_NOTHING_2, \
469 GYOTO_NOTHING_1, \
470 GYOTO_NOTHING_0 \
471 )
472
473
475/*
476 * Declares a Property named "name". name and namef should not
477 * be quoted.
478 *
479 * \param[in] class Class name
480 * \param[in] name Name of property if true;
481 * \param[in] fname Name of functions for setting or getting the property
482 * \param[in] doc Document string (optional but recommended)
483 */
484#define GYOTO_PROPERTY_SPECTROMETER(...) \
485 GYOTO_PROPERTY_CHOOSER(,##__VA_ARGS__, \
486 GYOTO_NOTHING_6, \
487 GYOTO_NOTHING_5, \
488 GYOTO_PROPERTY_SPECTROMETER_DOC(__VA_ARGS__), \
489 GYOTO_PROPERTY_SPECTROMETER_NODOC(__VA_ARGS__), \
490 GYOTO_NOTHING_2, \
491 GYOTO_NOTHING_1, \
492 GYOTO_NOTHING_0 \
493 )
494
496#define GYOTO_PROPERTY_END(class, next) \
497 Property(next)}; \
498 Gyoto::Property const * class::getProperties() const { \
499 return class::properties; \
500 } \
501 const std::string class::builtinPluginValue ( GYOTO_STRINGIFY(GYOTO_PLUGIN) ); \
502 std::vector<std::string> class::plugins() const { \
503 if (plugins_.size() == 0) { \
504 std::vector<std::string> p; \
505 p.push_back(class::builtinPluginValue); \
506 return p; \
507 } \
508 return plugins_; \
509 } \
510 void class::plugins(std::vector<std::string> const & plugname) { \
511 plugins_=plugname; \
512 }
513
515
608{
609 private:
610
611 public:
613
616 enum type_e {
630
654
663 std::string name;
665
668 std::string name_false;
670 int type;
672 typedef void (Object::* set_double_t)(double val);
674 typedef double (Object::* get_double_t)() const;
676 typedef void (Object::* set_double_unit_t)(double val,
677 std::string const &unit);
679 typedef double (Object::* get_double_unit_t)(std::string const &unit) const;
681 typedef void (Object::* set_long_t)(long val);
683 typedef long (Object::* get_long_t)() const;
685 typedef void (Object::* set_unsigned_long_t)(unsigned long val);
687 typedef unsigned long (Object::* get_unsigned_long_t)() const;
689 typedef void (Object::* set_size_t_t)(size_t val);
691 typedef size_t (Object::* get_size_t_t)() const;
693 typedef void (Object::* set_bool_t)(bool val);
695 typedef bool (Object::* get_bool_t)() const;
697 typedef void (Object::* set_string_t)(std::string const&);
699 typedef std::string (Object::* get_string_t)() const;
701 typedef void (Object::* set_fname_t)(std::string const&);
703 typedef std::string (Object::* get_fname_t)() const;
705 typedef void (Object::* set_vector_double_t)(std::vector<double> const&);
707 typedef std::vector<double> (Object::* get_vector_double_t)() const;
709 typedef void (Object::* set_vector_double_unit_t)(std::vector<double> const&, std::string const &);
711 typedef std::vector<double> (Object::* get_vector_double_unit_t)(std::string const &) const;
713 typedef void (Object::* set_vector_unsigned_long_t)(std::vector<unsigned long> const&);
715 typedef std::vector<unsigned long> (Object::* get_vector_unsigned_long_t)() const;
716
718 typedef void (Object::* set_metric_t)
722 (Object::* get_metric_t)() const;
723
725 typedef void (Object::* set_screen_t)
729 (Object::* get_screen_t)() const;
730
732 typedef void (Object::* set_astrobj_t)
736 (Object::* get_astrobj_t)() const;
737
739 typedef void (Object::* set_spectrum_t)
743 (Object::* get_spectrum_t)() const;
744
746 typedef void (Object::* set_spectrometer_t)
750 (Object::* get_spectrometer_t)() const;
751
753
756 union setter_t {
757 set_double_t set_double;
758 set_long_t set_long;
759 set_unsigned_long_t set_unsigned_long;
760 set_size_t_t set_size_t;
761 set_bool_t set_bool;
762 set_string_t set_string;
763 set_vector_double_t set_vdouble;
765 set_metric_t set_metric;
766 set_screen_t set_screen;
767 set_astrobj_t set_astrobj;
768 set_spectrum_t set_spectrum;
769 set_spectrometer_t set_spectrometer;
770 };
772
775 union getter_t {
776 get_double_t get_double;
777 get_long_t get_long;
778 get_unsigned_long_t get_unsigned_long;
779 get_size_t_t get_size_t;
780 get_bool_t get_bool;
781 get_string_t get_string;
782 get_vector_double_t get_vdouble;
784 get_metric_t get_metric;
785 get_screen_t get_screen;
786 get_astrobj_t get_astrobj;
787 get_spectrum_t get_spectrum;
788 get_spectrometer_t get_spectrometer;
789 };
791
795 set_double_unit_t set_double;
796 set_vector_double_unit_t set_vdouble;
797 };
800 get_double_unit_t get_double;
801 get_vector_double_unit_t get_vdouble;
802 };
803
805
810
815
820
824
825 std::string doc;
826
828 operator bool() const ;
829
831 Property const * const parent;
832
834 Property(Property const * const ancestor);
835
837 Property(std::string classname, std::string doc="");
838
840 Property(std::string name,
841 set_long_t set_long,
842 get_long_t get_long,
843 std::string doc);
844
846 Property(std::string name,
847 set_unsigned_long_t set_unsigned_long,
848 get_unsigned_long_t get_unsigned_long,
849 std::string doc);
850
852
857 Property(std::string name,
858 set_size_t_t set_size_t,
859 get_size_t_t get_size_t,
860 int dummy,
861 std::string doc);
862
864 Property(std::string name,
865 set_double_t set_double,
866 get_double_t get_double,
867 std::string doc);
868
870 Property(std::string name,
871 set_double_t set_double,
872 get_double_t get_double,
873 set_double_unit_t set_double_unit,
874 get_double_unit_t get_double_unit,
875 std::string doc);
876
878 Property(std::string name,
879 std::string name_false,
880 set_bool_t set_bool,
881 get_bool_t get_bool,
882 std::string doc);
883
885
891 Property(std::string name,
892 set_string_t set_string,
893 get_string_t get_string,
894 bool is_filename,
895 std::string doc);
896
898 Property(std::string name,
899 set_vector_double_t set_vdouble,
900 get_vector_double_t get_vdouble,
901 std::string doc);
902
904 Property(std::string name,
905 set_vector_double_t set_vdouble,
906 get_vector_double_t get_vdouble,
907 set_vector_double_unit_t set_vdouble_unit,
908 get_vector_double_unit_t get_vdouble_unit,
909 std::string doc);
910
912 Property(std::string name,
915 std::string doc);
916
918 Property(std::string name,
919 set_metric_t set_metric,
920 get_metric_t get_metric,
921 std::string doc);
922
924 Property(std::string name,
925 set_screen_t set_screen,
926 get_screen_t get_screen,
927 std::string doc);
928
930 Property(std::string name,
931 set_astrobj_t set_astrobj,
932 get_astrobj_t get_astrobj,
933 std::string doc);
934
936 Property(std::string name,
937 set_spectrum_t set_spectrum,
938 get_spectrum_t get_spectrum,
939 std::string doc);
940
942 Property(std::string name,
943 set_spectrometer_t set_spectrometer,
944 get_spectrometer_t get_spectrometer,
945 std::string doc);
946
947};
948
950#define GYOTO_PROPERTY_CHOOSER(x, A, B, C, D, E, F, FUNC, ...) FUNC
951
952#define GYOTO_PROPERTY_START_DOC(class, doc) \
953 Property const class::properties[] = { \
954 Property (#class, doc),
955
956#define GYOTO_PROPERTY_START_NODOC(class) \
957 GYOTO_PROPERTY_START_DOC(class, "")
958
959
960#define GYOTO_PROPERTY_BOOL_DOC(class, name, namef, fname, doc) \
961 Gyoto::Property \
962 (#name, \
963 #namef, \
964 (Gyoto::Property::set_bool_t)&class :: fname, \
965 (Gyoto::Property::get_bool_t)&class :: fname, \
966 doc),
967#define GYOTO_PROPERTY_BOOL_NODOC(class, name, namef, fname) \
968 GYOTO_PROPERTY_BOOL_DOC(class, name, namef, fname, "")
969
970#define GYOTO_PROPERTY_DOUBLE_DOC(class, name, fname, doc) \
971 Gyoto::Property \
972 (#name, \
973 (Gyoto::Property::set_double_t)&class::fname, \
974 (Gyoto::Property::get_double_t)&class::fname, \
975 doc),
976#define GYOTO_PROPERTY_DOUBLE_NODOC(class, name, fname) \
977 GYOTO_PROPERTY_DOUBLE_DOC(class, name, fname, "")
978
979#define GYOTO_PROPERTY_LONG_DOC(class, name, fname, doc) \
980 Gyoto::Property \
981 (#name, \
982 (Gyoto::Property::set_long_t)&class::fname, \
983 (Gyoto::Property::get_long_t)&class::fname, \
984 doc),
985#define GYOTO_PROPERTY_LONG_NODOC(class, name, fname) \
986 GYOTO_PROPERTY_LONG_DOC(class, name, fname, "")
987
988#define GYOTO_PROPERTY_UNSIGNED_LONG_DOC(class, name, fname, doc) \
989 Gyoto::Property \
990 (#name, \
991 (Gyoto::Property::set_unsigned_long_t)&class::fname, \
992 (Gyoto::Property::get_unsigned_long_t)&class::fname, \
993 doc),
994#define GYOTO_PROPERTY_UNSIGNED_LONG_NODOC(class, name, fname) \
995 GYOTO_PROPERTY_UNSIGNED_LONG_DOC(class, name, fname, "")
996
997#define GYOTO_PROPERTY_SIZE_T_DOC(class, name, fname, doc) \
998 Gyoto::Property \
999 (#name, \
1000 (Gyoto::Property::set_size_t_t)&class::fname, \
1001 (Gyoto::Property::get_size_t_t)&class::fname, \
1002 1, \
1003 doc),
1004#define GYOTO_PROPERTY_SIZE_T_NODOC(class, name, fname) \
1005 GYOTO_PROPERTY_SIZE_T_DOC(class, name, fname, "")
1006
1007#define GYOTO_PROPERTY_DOUBLE_UNIT_DOC(class, name, fname, doc) \
1008 Gyoto::Property \
1009 (#name, \
1010 (Gyoto::Property::set_double_t)&class::fname, \
1011 (Gyoto::Property::get_double_t)&class::fname, \
1012 (Gyoto::Property::set_double_unit_t)&class::fname, \
1013 (Gyoto::Property::get_double_unit_t)&class::fname, \
1014 doc),
1015#define GYOTO_PROPERTY_DOUBLE_UNIT_NODOC(class, name, fname) \
1016 GYOTO_PROPERTY_DOUBLE_UNIT_DOC(class, name, fname, "")
1017
1018#define GYOTO_PROPERTY_FILENAME_DOC(class, name, fname, doc) \
1019 Gyoto::Property \
1020 (#name, \
1021 (Gyoto::Property::set_string_t)&class::fname, \
1022 (Gyoto::Property::get_string_t)&class::fname, \
1023 true, doc),
1024#define GYOTO_PROPERTY_FILENAME_NODOC(class, name, fname) \
1025 GYOTO_PROPERTY_FILENAME_DOC(class, name, fname, "")
1026
1027#define GYOTO_PROPERTY_STRING_DOC(class, name, fname, doc) \
1028 Gyoto::Property \
1029 (#name, \
1030 (Gyoto::Property::set_string_t)&class::fname, \
1031 (Gyoto::Property::get_string_t)&class::fname, \
1032 false, doc),
1033#define GYOTO_PROPERTY_STRING_NODOC(class, name, fname) \
1034 GYOTO_PROPERTY_STRING_DOC(class, name, fname, "")
1035
1036#define GYOTO_PROPERTY_VECTOR_DOUBLE_DOC(class, name, fname, doc) \
1037 Gyoto::Property \
1038 (#name, \
1039 (Gyoto::Property::set_vector_double_t)&class::fname, \
1040 (Gyoto::Property::get_vector_double_t)&class::fname, \
1041 doc),
1042#define GYOTO_PROPERTY_VECTOR_DOUBLE_NODOC(class, name, fname) \
1043 GYOTO_PROPERTY_VECTOR_DOUBLE_DOC(class, name, fname, "")
1044
1045#define GYOTO_PROPERTY_VECTOR_DOUBLE_UNIT_DOC(class, name, fname, doc) \
1046 Gyoto::Property \
1047 (#name, \
1048 (Gyoto::Property::set_vector_double_t)&class::fname, \
1049 (Gyoto::Property::get_vector_double_t)&class::fname, \
1050 (Gyoto::Property::set_vector_double_unit_t)&class::fname, \
1051 (Gyoto::Property::get_vector_double_unit_t)&class::fname, \
1052 doc),
1053#define GYOTO_PROPERTY_VECTOR_DOUBLE_UNIT_NODOC(class, name, fname) \
1054 GYOTO_PROPERTY_VECTOR_DOUBLE_UNIT_DOC(class, name, fname, "")
1055
1056#define GYOTO_PROPERTY_VECTOR_UNSIGNED_LONG_DOC(class, name, fname, doc) \
1057 Gyoto::Property \
1058 (#name, \
1059 (Gyoto::Property::set_vector_unsigned_long_t)&class::fname, \
1060 (Gyoto::Property::get_vector_unsigned_long_t)&class::fname, \
1061 doc),
1062#define GYOTO_PROPERTY_VECTOR_UNSIGNED_LONG_NODOC(class, name, fname) \
1063 GYOTO_PROPERTY_VECTOR_UNSIGNED_LONG_DOC(class, name, fname, "")
1064
1065#define GYOTO_PROPERTY_METRIC_DOC(class, name, fname, doc) \
1066 Gyoto::Property \
1067 (#name, \
1068 (Gyoto::Property::set_metric_t)&class::fname, \
1069 (Gyoto::Property::get_metric_t)&class::fname, \
1070 doc),
1071#define GYOTO_PROPERTY_METRIC_NODOC(class, name, fname) \
1072 GYOTO_PROPERTY_METRIC_DOC(class, name, fname, "")
1073
1074#define GYOTO_PROPERTY_SCREEN_DOC(class, name, fname, doc) \
1075 Gyoto::Property \
1076 (#name, \
1077 (Gyoto::Property::set_screen_t)&class::fname, \
1078 (Gyoto::Property::get_screen_t)&class::fname, \
1079 doc),
1080#define GYOTO_PROPERTY_SCREEN_NODOC(class, name, fname) \
1081 GYOTO_PROPERTY_SCREEN_DOC(class, name, fname, "")
1082
1083#define GYOTO_PROPERTY_ASTROBJ_DOC(class, name, fname, doc) \
1084 Gyoto::Property \
1085 (#name, \
1086 (Gyoto::Property::set_astrobj_t)&class::fname, \
1087 (Gyoto::Property::get_astrobj_t)&class::fname, \
1088 doc),
1089#define GYOTO_PROPERTY_ASTROBJ_NODOC(class, name, fname) \
1090 GYOTO_PROPERTY_ASTROBJ_DOC(class, name, fname, "")
1091
1092#define GYOTO_PROPERTY_SPECTRUM_DOC(class, name, fname, doc) \
1093 Gyoto::Property \
1094 (#name, \
1095 (Gyoto::Property::set_spectrum_t)&class::fname, \
1096 (Gyoto::Property::get_spectrum_t)&class::fname, \
1097 doc),
1098#define GYOTO_PROPERTY_SPECTRUM_NODOC(class, name, fname) \
1099 GYOTO_PROPERTY_SPECTRUM_DOC(class, name, fname, "")
1100
1101#define GYOTO_PROPERTY_SPECTROMETER_DOC(class, name, fname, doc) \
1102 Gyoto::Property \
1103 (#name, \
1104 (Gyoto::Property::set_spectrometer_t)&class::fname, \
1105 (Gyoto::Property::get_spectrometer_t)&class::fname, \
1106 doc),
1107#define GYOTO_PROPERTY_SPECTROMETER_NODOC(class, name, fname) \
1108 GYOTO_PROPERTY_SPECTROMETER_DOC(class, name, fname, "")
1109// \endcond INTERNAL
1110
1111#endif
Compile-time configuration.
#define size_t
If not defined in <sys/types.h>.
Definition: GyotoConfig.h:390
Object with properties.
Definition: GyotoObject.h:152
Property that can be set and got using standard methods.
Definition: GyotoProperty.h:608
void(Object::* set_long_t)(long val)
Prototype for an accessor to set a long.
Definition: GyotoProperty.h:681
void(Object::* set_size_t_t)(size_t val)
Prototype for an accessor to set a size_t.
Definition: GyotoProperty.h:689
void(Object::* set_metric_t)(Gyoto::SmartPointer< Gyoto::Metric::Generic >)
Prototype for an accessor to set a Gyoto::SmartPointer<Gyoto::Metric::Generic>
Definition: GyotoProperty.h:719
void(Object::* set_spectrometer_t)(Gyoto::SmartPointer< Gyoto::Spectrometer::Generic >)
Prototype for an accessor to set a Gyoto::SmartPointer<Gyoto::Spectrometer::Generic>
Definition: GyotoProperty.h:747
size_t(Object::* get_size_t_t)() const
Prototype for an accessor to get a size_t.
Definition: GyotoProperty.h:691
std::string(Object::* get_string_t)() const
Prototype for an accessor to get a string.
Definition: GyotoProperty.h:699
std::vector< double >(Object::* get_vector_double_t)() const
Prototype for an accessor to get a std::vector<double>
Definition: GyotoProperty.h:707
Gyoto::SmartPointer< Gyoto::Spectrum::Generic >(Object::* get_spectrum_t)() const
Prototype for an accessor to get a Gyoto::SmartPointer<Gyoto::Spectrum::Generic>
Definition: GyotoProperty.h:743
setter_t setter
Pointer to the setter method.
Definition: GyotoProperty.h:808
Gyoto::SmartPointer< Gyoto::Metric::Generic >(Object::* get_metric_t)() const
Prototype for an accessor to get a Gyoto::SmartPointer<Gyoto::Metric::Generic>
Definition: GyotoProperty.h:722
Property(std::string name, set_spectrum_t set_spectrum, get_spectrum_t get_spectrum, std::string doc)
Constructor for type==spectrum_t.
unsigned long(Object::* get_unsigned_long_t)() const
Prototype for an accessor to get an unsigned long.
Definition: GyotoProperty.h:687
void(Object::* set_spectrum_t)(Gyoto::SmartPointer< Gyoto::Spectrum::Generic >)
Prototype for an accessor to set a Gyoto::SmartPointer<Gyoto::Spectrum::Generic>
Definition: GyotoProperty.h:740
void(Object::* set_vector_double_t)(std::vector< double > const &)
Prototype for an accessor to set a std::vector<double>
Definition: GyotoProperty.h:705
Property(std::string name, set_vector_double_t set_vdouble, get_vector_double_t get_vdouble, std::string doc)
Constructor for type==vector_double_t, without unit support.
void(Object::* set_vector_double_unit_t)(std::vector< double > const &, std::string const &)
Prototype for an accessor to set a std::vector<double>, with unit.
Definition: GyotoProperty.h:709
Property(std::string name, set_astrobj_t set_astrobj, get_astrobj_t get_astrobj, std::string doc)
Constructor for type==astrobj_t.
Property(Property const *const ancestor)
Constructor for type==empty_t.
double(Object::* get_double_unit_t)(std::string const &unit) const
Prototype for an accessor to get a double, with unit.
Definition: GyotoProperty.h:679
void(Object::* set_double_t)(double val)
Prototype for an accessor to set a double.
Definition: GyotoProperty.h:672
long(Object::* get_long_t)() const
Prototype for an accessor to get a long.
Definition: GyotoProperty.h:683
Property(std::string classname, std::string doc="")
Constructor for class name pseudo-property.
Gyoto::SmartPointer< Gyoto::Astrobj::Generic >(Object::* get_astrobj_t)() const
Prototype for an accessor to get a Gyoto::SmartPointer<Gyoto::Astrobj::Generic>
Definition: GyotoProperty.h:736
void(Object::* set_unsigned_long_t)(unsigned long val)
Prototype for an accessor to set an unsigned long.
Definition: GyotoProperty.h:685
bool(Object::* get_bool_t)() const
Prototype for an accessor to get a bool.
Definition: GyotoProperty.h:695
Property(std::string name, set_vector_double_t set_vdouble, get_vector_double_t get_vdouble, set_vector_double_unit_t set_vdouble_unit, get_vector_double_unit_t get_vdouble_unit, std::string doc)
Constructor for type==vector_double_t, with unit support.
getter_t getter
Pointer to the getter method.
Definition: GyotoProperty.h:813
void(Object::* set_string_t)(std::string const &)
Prototype for an accessor to set a string.
Definition: GyotoProperty.h:697
type_e
Possible type of a Property instance.
Definition: GyotoProperty.h:616
@ size_t_t
Type is size_t (only if distinct from unsigned long)
Definition: GyotoProperty.h:624
@ vector_unsigned_long_t
Type is std::vector<unsigned long>
Definition: GyotoProperty.h:642
@ double_t
Type is double.
Definition: GyotoProperty.h:618
@ metric_t
Type is Gyoto::SmartPointer<Gyoto::Metric::Generic>
Definition: GyotoProperty.h:644
@ bool_t
Type is bool.
Definition: GyotoProperty.h:626
@ astrobj_t
Type is Gyoto::SmartPointer<Gyoto::Astrobj::Generic>
Definition: GyotoProperty.h:648
@ filename_t
Type is std::string and holds a file name.
Definition: GyotoProperty.h:638
@ spectrometer_t
Type is Gyoto::SmartPointer<Gyoto::Spectrometer::Generic>
Definition: GyotoProperty.h:652
@ empty_t
Property is empty.
Definition: GyotoProperty.h:661
@ spectrum_t
Type is Gyoto::SmartPointer<Gyoto::Spectrum::Generic>
Definition: GyotoProperty.h:650
@ string_t
Type is std::string.
Definition: GyotoProperty.h:628
@ unsigned_long_t
Type is unsigned long (a.k.a. size_t)
Definition: GyotoProperty.h:622
@ screen_t
Type is Gyoto::SmartPointer<Gyoto::Screen::Generic>
Definition: GyotoProperty.h:646
@ long_t
Type is long.
Definition: GyotoProperty.h:620
@ vector_double_t
Type is std::vector<double>
Definition: GyotoProperty.h:640
Property(std::string name, set_double_t set_double, get_double_t get_double, set_double_unit_t set_double_unit, get_double_unit_t get_double_unit, std::string doc)
Constructor for type==double_t, with unit support.
Property(std::string name, set_screen_t set_screen, get_screen_t get_screen, std::string doc)
Constructor for type==screen_t.
Property(std::string name, std::string name_false, set_bool_t set_bool, get_bool_t get_bool, std::string doc)
Constructor for type==bool_t.
void(Object::* set_screen_t)(Gyoto::SmartPointer< Gyoto::Screen >)
Prototype for an accessor to set a Gyoto::SmartPointer<Gyoto::Screen>
Definition: GyotoProperty.h:726
setter_unit_t setter_unit
Pointer to the setter (with unit) method.
Definition: GyotoProperty.h:818
std::vector< double >(Object::* get_vector_double_unit_t)(std::string const &) const
Prototype for an accessor to get a std::vector<double>, with unit.
Definition: GyotoProperty.h:711
Property(std::string name, set_long_t set_long, get_long_t get_long, std::string doc)
Constructor for type==long_t.
Gyoto::SmartPointer< Gyoto::Spectrometer::Generic >(Object::* get_spectrometer_t)() const
Prototype for an accessor to get a Gyoto::SmartPointer<Gyoto::Spectrometer::Generic>
Definition: GyotoProperty.h:750
Property(std::string name, set_string_t set_string, get_string_t get_string, bool is_filename, std::string doc)
Constructor for type==string_t or filename_t.
void(Object::* set_fname_t)(std::string const &)
Prototype for an accessor to set a filename.
Definition: GyotoProperty.h:701
Property(std::string name, set_metric_t set_metric, get_metric_t get_metric, std::string doc)
Constructor for type==metric_t.
void(Object::* set_double_unit_t)(double val, std::string const &unit)
Prototype for an accessor to set a double, with unit.
Definition: GyotoProperty.h:676
std::string name
Name of this instance.
Definition: GyotoProperty.h:663
Property const *const parent
If type is empty_t, link to another Property list.
Definition: GyotoProperty.h:831
Property(std::string name, set_vector_unsigned_long_t set_vulong, get_vector_unsigned_long_t get_vulong, std::string doc)
Constructor for type==vector_unsigned_long_t.
std::string(Object::* get_fname_t)() const
Prototype for an accessor to get a filename.
Definition: GyotoProperty.h:703
std::string name_false
Name if false.
Definition: GyotoProperty.h:668
Property(std::string name, set_double_t set_double, get_double_t get_double, std::string doc)
Constructor for type==double_t, without unit support.
void(Object::* set_bool_t)(bool val)
Prototype for an accessor to set a bool.
Definition: GyotoProperty.h:693
std::vector< unsigned long >(Object::* get_vector_unsigned_long_t)() const
Prototype for an accessor to get a std::vector<unsigned long>
Definition: GyotoProperty.h:715
double(Object::* get_double_t)() const
Prototype for an accessor to get a double.
Definition: GyotoProperty.h:674
Gyoto::SmartPointer< Gyoto::Screen >(Object::* get_screen_t)() const
Prototype for an accessor to get a Gyoto::SmartPointer<Gyoto::Screen>
Definition: GyotoProperty.h:729
getter_unit_t getter_unit
Pointer to the getter (with unit) method.
Definition: GyotoProperty.h:823
Property(std::string name, set_size_t_t set_size_t, get_size_t_t get_size_t, int dummy, std::string doc)
Constructor for type==size_t_t.
Property(std::string name, set_unsigned_long_t set_unsigned_long, get_unsigned_long_t get_unsigned_long, std::string doc)
Constructor for type==unsigned_long_t.
Property(std::string name, set_spectrometer_t set_spectrometer, get_spectrometer_t get_spectrometer, std::string doc)
Constructor for type==spectrometer_t.
void(Object::* set_astrobj_t)(Gyoto::SmartPointer< Gyoto::Astrobj::Generic >)
Prototype for an accessor to set a Gyoto::SmartPointer<Gyoto::Astrobj::Generic>
Definition: GyotoProperty.h:733
void(Object::* set_vector_unsigned_long_t)(std::vector< unsigned long > const &)
Prototype for an accessor to set a std::vector<unsigned long>
Definition: GyotoProperty.h:713
int type
Type of this instance.
Definition: GyotoProperty.h:670
Namespace for the Gyoto library.
Definition: GyotoAstrobj.h:43
Union holding an accessor to get any type.
Definition: GyotoProperty.h:775
Union holding an accessor to get double or vector<double> with unit.
Definition: GyotoProperty.h:799
Union holding an accessor to set any type.
Definition: GyotoProperty.h:756
Union holding an accessor to set double or vector<double> with unit.
Definition: GyotoProperty.h:794