Gyoto
GyotoProperty.h
Go to the documentation of this file.
1 
6 /*
7  Copyright 2014 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 namespace Gyoto {
34  class Object;
35  class Property;
36  namespace Metric { class Generic; }
37  namespace Astrobj { class Generic; }
38  namespace Spectrum { class Generic; }
39  namespace Spectrometer { class Generic; }
40  class Screen;
41  template <class T> class SmartPointer;
42 }
43 
44 
46 
50 #define GYOTO_PROPERTY_ACCESSORS(class, type, member, method) \
51  void class::method(type v) {member=v;} \
52  type class::method() const {return member;}
53 
55 
65 #define GYOTO_PROPERTY_ACCESSORS_GEOMETRICAL(class, member, method, metric) \
66  GYOTO_PROPERTY_ACCESSORS(class, double, member, method) \
67  void class::method(double v, std::string const &u) { \
68  member=Units::ToGeometrical(v, u, metric); \
69  } \
70  double class::method(std::string const &u) const { \
71  return Units::FromGeometrical(member, u, metric); \
72  }
73 
75 
79 #define GYOTO_PROPERTY_START(...) \
80  GYOTO_PROPERTY_CHOOSER(,##__VA_ARGS__, \
81  "wrong number of arguments", \
82  "wrong number of arguments", \
83  "wrong number of arguments", \
84  "wrong number of arguments", \
85  GYOTO_PROPERTY_START_DOC(__VA_ARGS__), \
86  GYOTO_PROPERTY_START_NODOC(__VA_ARGS__), \
87  "wrong number of arguments" \
88  )
89 
90 
92 /*
93  * Declares a Property named "name". name and namef should not
94  * be quoted.
95  *
96  * \param[in] class Class name
97  * \param[in] name Name of property if true;
98  * \param[in] namef Name of property if false;
99  * \param[in] fname Name of functions for setting or getting the property
100  * \param[in] doc Document string (optional but recommended)
101  */
102 #define GYOTO_PROPERTY_BOOL(...) \
103  GYOTO_PROPERTY_CHOOSER(,##__VA_ARGS__, \
104  "wrong number of arguments", \
105  GYOTO_PROPERTY_BOOL_DOC(__VA_ARGS__), \
106  GYOTO_PROPERTY_BOOL_NODOC(__VA_ARGS__), \
107  "wrong number of arguments", \
108  "wrong number of arguments", \
109  "wrong number of arguments", \
110  "wrong number of arguments" \
111  )
112 
114 /*
115  * Declares a Property named "name". name and namef should not
116  * be quoted.
117  *
118  * \param[in] class Class name
119  * \param[in] name Name of property if true;
120  * \param[in] fname Name of functions for setting or getting the property
121  * \param[in] doc Document string (optional but recommended)
122  */
123 #define GYOTO_PROPERTY_DOUBLE(...) \
124  GYOTO_PROPERTY_CHOOSER(,##__VA_ARGS__, \
125  GYOTO_NOTHING_6, \
126  GYOTO_NOTHING_5, \
127  GYOTO_PROPERTY_DOUBLE_DOC(__VA_ARGS__), \
128  GYOTO_PROPERTY_DOUBLE_NODOC(__VA_ARGS__), \
129  GYOTO_NOTHING_2, \
130  GYOTO_NOTHING_1, \
131  GYOTO_NOTHING_0 \
132  )
133 
134 
136 /*
137  * Declares a Property named "name". name and namef should not
138  * be quoted.
139  *
140  * \param[in] class Class name
141  * \param[in] name Name of property if true;
142  * \param[in] fname Name of functions for setting or getting the property
143  * \param[in] doc Document string (optional but recommended)
144  */
145 #define GYOTO_PROPERTY_DOUBLE_UNIT(...) \
146  GYOTO_PROPERTY_CHOOSER(,##__VA_ARGS__, \
147  GYOTO_NOTHING_6, \
148  GYOTO_NOTHING_5, \
149  GYOTO_PROPERTY_DOUBLE_UNIT_DOC(__VA_ARGS__), \
150  GYOTO_PROPERTY_DOUBLE_UNIT_NODOC(__VA_ARGS__), \
151  GYOTO_NOTHING_2, \
152  GYOTO_NOTHING_1, \
153  GYOTO_NOTHING_0 \
154  )
155 
157 /*
158  * Declares a Property named "name". name and namef should not
159  * be quoted.
160  *
161  * \param[in] class Class name
162  * \param[in] name Name of property if true;
163  * \param[in] fname Name of functions for setting or getting the property
164  * \param[in] doc Document string (optional but recommended)
165  */
166 #define GYOTO_PROPERTY_VECTOR_DOUBLE(...) \
167  GYOTO_PROPERTY_CHOOSER(,##__VA_ARGS__, \
168  GYOTO_NOTHING_6, \
169  GYOTO_NOTHING_5, \
170  GYOTO_PROPERTY_VECTOR_DOUBLE_DOC(__VA_ARGS__), \
171  GYOTO_PROPERTY_VECTOR_DOUBLE_NODOC(__VA_ARGS__), \
172  GYOTO_NOTHING_2, \
173  GYOTO_NOTHING_1, \
174  GYOTO_NOTHING_0 \
175  )
176 
178 /*
179  * Declares a Property named "name". name and namef should not
180  * be quoted.
181  *
182  * \param[in] class Class name
183  * \param[in] name Name of property if true;
184  * \param[in] fname Name of functions for setting or getting the property
185  * \param[in] doc Document string (optional but recommended)
186  */
187 #define GYOTO_PROPERTY_VECTOR_DOUBLE_UNIT(...) \
188  GYOTO_PROPERTY_CHOOSER(,##__VA_ARGS__, \
189  GYOTO_NOTHING_6, \
190  GYOTO_NOTHING_5, \
191  GYOTO_PROPERTY_VECTOR_DOUBLE_UNIT_DOC(__VA_ARGS__), \
192  GYOTO_PROPERTY_VECTOR_DOUBLE_UNIT_NODOC(__VA_ARGS__), \
193  GYOTO_NOTHING_2, \
194  GYOTO_NOTHING_1, \
195  GYOTO_NOTHING_0 \
196  )
197 
199 /*
200  * Declares a Property named "name". name and namef should not
201  * be quoted.
202  *
203  * \param[in] class Class name
204  * \param[in] name Name of property if true;
205  * \param[in] fname Name of functions for setting or getting the property
206  * \param[in] doc Document string (optional but recommended)
207  */
208 #define GYOTO_PROPERTY_STRING(...) \
209  GYOTO_PROPERTY_CHOOSER(,##__VA_ARGS__, \
210  GYOTO_NOTHING_6, \
211  GYOTO_NOTHING_5, \
212  GYOTO_PROPERTY_STRING_DOC(__VA_ARGS__), \
213  GYOTO_PROPERTY_STRING_NODOC(__VA_ARGS__), \
214  GYOTO_NOTHING_2, \
215  GYOTO_NOTHING_1, \
216  GYOTO_NOTHING_0 \
217  )
218 
220 /*
221  * Declares a Property named "name". name and namef should not
222  * be quoted.
223  *
224  * \param[in] class Class name
225  * \param[in] name Name of property if true;
226  * \param[in] fname Name of functions for setting or getting the property
227  * \param[in] doc Document string (optional but recommended)
228  */
229 #define GYOTO_PROPERTY_FILENAME(...) \
230  GYOTO_PROPERTY_CHOOSER(,##__VA_ARGS__, \
231  GYOTO_NOTHING_6, \
232  GYOTO_NOTHING_5, \
233  GYOTO_PROPERTY_FILENAME_DOC(__VA_ARGS__), \
234  GYOTO_PROPERTY_FILENAME_NODOC(__VA_ARGS__), \
235  GYOTO_NOTHING_2, \
236  GYOTO_NOTHING_1, \
237  GYOTO_NOTHING_0 \
238  )
239 
241 /*
242  * Declares a Property named "name". name and namef should not
243  * be quoted.
244  *
245  * \param[in] class Class name
246  * \param[in] name Name of property if true;
247  * \param[in] fname Name of functions for setting or getting the property
248  * \param[in] doc Document string (optional but recommended)
249  */
250 #define GYOTO_PROPERTY_LONG(...) \
251  GYOTO_PROPERTY_CHOOSER(,##__VA_ARGS__, \
252  GYOTO_NOTHING_6, \
253  GYOTO_NOTHING_5, \
254  GYOTO_PROPERTY_LONG_DOC(__VA_ARGS__), \
255  GYOTO_PROPERTY_LONG_NODOC(__VA_ARGS__), \
256  GYOTO_NOTHING_2, \
257  GYOTO_NOTHING_1, \
258  GYOTO_NOTHING_0 \
259  )
260 
262 /*
263  * Declares a Property named "name". name and namef should not
264  * be quoted.
265  *
266  * \param[in] class Class name
267  * \param[in] name Name of property if true;
268  * \param[in] fname Name of functions for setting or getting the property
269  * \param[in] doc Document string (optional but recommended)
270  */
271 #define GYOTO_PROPERTY_UNSIGNED_LONG(...) \
272  GYOTO_PROPERTY_CHOOSER(,##__VA_ARGS__, \
273  GYOTO_NOTHING_6, \
274  GYOTO_NOTHING_5, \
275  GYOTO_PROPERTY_UNSIGNED_LONG_DOC(__VA_ARGS__), \
276  GYOTO_PROPERTY_UNSIGNED_LONG_NODOC(__VA_ARGS__), \
277  GYOTO_NOTHING_2, \
278  GYOTO_NOTHING_1, \
279  GYOTO_NOTHING_0 \
280  )
281 
283 /*
284  * Declares a Property named "name". name and namef should not
285  * be quoted.
286  *
287  * \param[in] class Class name
288  * \param[in] name Name of property if true;
289  * \param[in] fname Name of functions for setting or getting the property
290  * \param[in] doc Document string (optional but recommended)
291  */
292 #define GYOTO_PROPERTY_VECTOR_UNSIGNED_LONG(...) \
293  GYOTO_PROPERTY_CHOOSER(,##__VA_ARGS__, \
294  GYOTO_NOTHING_6, \
295  GYOTO_NOTHING_5, \
296  GYOTO_PROPERTY_VECTOR_UNSIGNED_LONG_DOC(__VA_ARGS__), \
297  GYOTO_PROPERTY_VECTOR_UNSIGNED_LONG_NODOC(__VA_ARGS__), \
298  GYOTO_NOTHING_2, \
299  GYOTO_NOTHING_1, \
300  GYOTO_NOTHING_0 \
301  )
302 
304 /*
305  * Declares a Property named "name". name and namef should not
306  * be quoted.
307  *
308  * \param[in] class Class name
309  * \param[in] name Name of property if true;
310  * \param[in] fname Name of functions for setting or getting the property
311  * \param[in] doc Document string (optional but recommended)
312  */
313 #define GYOTO_PROPERTY_SIZE_T(...) \
314  GYOTO_PROPERTY_CHOOSER(,##__VA_ARGS__, \
315  GYOTO_NOTHING_6, \
316  GYOTO_NOTHING_5, \
317  GYOTO_PROPERTY_SIZE_T_DOC(__VA_ARGS__), \
318  GYOTO_PROPERTY_SIZE_T_NODOC(__VA_ARGS__), \
319  GYOTO_NOTHING_2, \
320  GYOTO_NOTHING_1, \
321  GYOTO_NOTHING_0 \
322  )
323 
325 /*
326  * Declares a Property named "name". name and namef should not
327  * be quoted.
328  *
329  * \param[in] class Class name
330  * \param[in] name Name of property if true;
331  * \param[in] fname Name of functions for setting or getting the property
332  * \param[in] doc Document string (optional but recommended)
333  */
334 #define GYOTO_PROPERTY_METRIC(...) \
335  GYOTO_PROPERTY_CHOOSER(,##__VA_ARGS__, \
336  GYOTO_NOTHING_6, \
337  GYOTO_NOTHING_5, \
338  GYOTO_PROPERTY_METRIC_DOC(__VA_ARGS__), \
339  GYOTO_PROPERTY_METRIC_NODOC(__VA_ARGS__), \
340  GYOTO_NOTHING_2, \
341  GYOTO_NOTHING_1, \
342  GYOTO_NOTHING_0 \
343  )
344 
345 
347 /*
348  * Declares a Property named "name". name and namef should not
349  * be quoted.
350  *
351  * \param[in] class Class name
352  * \param[in] name Name of property if true;
353  * \param[in] fname Name of functions for setting or getting the property
354  * \param[in] doc Document string (optional but recommended)
355  */
356 #define GYOTO_PROPERTY_SPECTRUM(...) \
357  GYOTO_PROPERTY_CHOOSER(,##__VA_ARGS__, \
358  GYOTO_NOTHING_6, \
359  GYOTO_NOTHING_5, \
360  GYOTO_PROPERTY_SPECTRUM_DOC(__VA_ARGS__), \
361  GYOTO_PROPERTY_SPECTRUM_NODOC(__VA_ARGS__), \
362  GYOTO_NOTHING_2, \
363  GYOTO_NOTHING_1, \
364  GYOTO_NOTHING_0 \
365  )
366 
367 
369 /*
370  * Declares a Property named "name". name and namef should not
371  * be quoted.
372  *
373  * \param[in] class Class name
374  * \param[in] name Name of property if true;
375  * \param[in] fname Name of functions for setting or getting the property
376  * \param[in] doc Document string (optional but recommended)
377  */
378 #define GYOTO_PROPERTY_ASTROBJ(...) \
379  GYOTO_PROPERTY_CHOOSER(,##__VA_ARGS__, \
380  GYOTO_NOTHING_6, \
381  GYOTO_NOTHING_5, \
382  GYOTO_PROPERTY_ASTROBJ_DOC(__VA_ARGS__), \
383  GYOTO_PROPERTY_ASTROBJ_NODOC(__VA_ARGS__), \
384  GYOTO_NOTHING_2, \
385  GYOTO_NOTHING_1, \
386  GYOTO_NOTHING_0 \
387  )
388 
389 
391 /*
392  * Declares a Property named "name". name and namef should not
393  * be quoted.
394  *
395  * \param[in] class Class name
396  * \param[in] name Name of property if true;
397  * \param[in] fname Name of functions for setting or getting the property
398  * \param[in] doc Document string (optional but recommended)
399  */
400 #define GYOTO_PROPERTY_SCREEN(...) \
401  GYOTO_PROPERTY_CHOOSER(,##__VA_ARGS__, \
402  GYOTO_NOTHING_6, \
403  GYOTO_NOTHING_5, \
404  GYOTO_PROPERTY_SCREEN_DOC(__VA_ARGS__), \
405  GYOTO_PROPERTY_SCREEN_NODOC(__VA_ARGS__), \
406  GYOTO_NOTHING_2, \
407  GYOTO_NOTHING_1, \
408  GYOTO_NOTHING_0 \
409  )
410 
411 
413 /*
414  * Declares a Property named "name". name and namef should not
415  * be quoted.
416  *
417  * \param[in] class Class name
418  * \param[in] name Name of property if true;
419  * \param[in] fname Name of functions for setting or getting the property
420  * \param[in] doc Document string (optional but recommended)
421  */
422 #define GYOTO_PROPERTY_SPECTROMETER(...) \
423  GYOTO_PROPERTY_CHOOSER(,##__VA_ARGS__, \
424  GYOTO_NOTHING_6, \
425  GYOTO_NOTHING_5, \
426  GYOTO_PROPERTY_SPECTROMETER_DOC(__VA_ARGS__), \
427  GYOTO_PROPERTY_SPECTROMETER_NODOC(__VA_ARGS__), \
428  GYOTO_NOTHING_2, \
429  GYOTO_NOTHING_1, \
430  GYOTO_NOTHING_0 \
431  )
432 
434 #define GYOTO_PROPERTY_END(class, next) \
435  Property(next)}; \
436  Gyoto::Property const * class::getProperties() const { \
437  return class::properties; \
438  }
439 
441 
534 {
535  private:
536 
537  public:
539 
542  enum type_e {
556 
580 
587  empty_t};
589  std::string name;
591 
594  std::string name_false;
596  int type;
598  typedef void (Object::* set_double_t)(double val);
600  typedef double (Object::* get_double_t)() const;
602  typedef void (Object::* set_double_unit_t)(double val,
603  std::string const &unit);
605  typedef double (Object::* get_double_unit_t)(std::string const &unit) const;
607  typedef void (Object::* set_long_t)(long val);
609  typedef long (Object::* get_long_t)() const;
611  typedef void (Object::* set_unsigned_long_t)(unsigned long val);
613  typedef unsigned long (Object::* get_unsigned_long_t)() const;
615  typedef void (Object::* set_size_t_t)(size_t val);
617  typedef size_t (Object::* get_size_t_t)() const;
619  typedef void (Object::* set_bool_t)(bool val);
621  typedef bool (Object::* get_bool_t)() const;
623  typedef void (Object::* set_string_t)(std::string const&);
625  typedef std::string (Object::* get_string_t)() const;
627  typedef void (Object::* set_fname_t)(std::string const&);
629  typedef std::string (Object::* get_fname_t)() const;
631  typedef void (Object::* set_vector_double_t)(std::vector<double> const&);
633  typedef std::vector<double> (Object::* get_vector_double_t)() const;
635  typedef void (Object::* set_vector_double_unit_t)(std::vector<double> const&, std::string const &);
637  typedef std::vector<double> (Object::* get_vector_double_unit_t)(std::string const &) const;
639  typedef void (Object::* set_vector_unsigned_long_t)(std::vector<unsigned long> const&);
641  typedef std::vector<unsigned long> (Object::* get_vector_unsigned_long_t)() const;
642 
644  typedef void (Object::* set_metric_t)
648  (Object::* get_metric_t)() const;
649 
651  typedef void (Object::* set_screen_t)
655  (Object::* get_screen_t)() const;
656 
658  typedef void (Object::* set_astrobj_t)
662  (Object::* get_astrobj_t)() const;
663 
665  typedef void (Object::* set_spectrum_t)
669  (Object::* get_spectrum_t)() const;
670 
672  typedef void (Object::* set_spectrometer_t)
676  (Object::* get_spectrometer_t)() const;
677 
679 
682  union setter_t {
683  set_double_t set_double;
684  set_long_t set_long;
685  set_unsigned_long_t set_unsigned_long;
686  set_size_t_t set_size_t;
687  set_bool_t set_bool;
688  set_string_t set_string;
689  set_vector_double_t set_vdouble;
690  set_vector_unsigned_long_t set_vulong;
691  set_metric_t set_metric;
692  set_screen_t set_screen;
693  set_astrobj_t set_astrobj;
694  set_spectrum_t set_spectrum;
695  set_spectrometer_t set_spectrometer;
696  };
698 
701  union getter_t {
702  get_double_t get_double;
703  get_long_t get_long;
704  get_unsigned_long_t get_unsigned_long;
705  get_size_t_t get_size_t;
706  get_bool_t get_bool;
707  get_string_t get_string;
708  get_vector_double_t get_vdouble;
709  get_vector_unsigned_long_t get_vulong;
710  get_metric_t get_metric;
711  get_screen_t get_screen;
712  get_astrobj_t get_astrobj;
713  get_spectrum_t get_spectrum;
714  get_spectrometer_t get_spectrometer;
715  };
717 
721  set_double_unit_t set_double;
722  set_vector_double_unit_t set_vdouble;
723  };
726  get_double_unit_t get_double;
727  get_vector_double_unit_t get_vdouble;
728  };
729 
731 
736 
741 
746 
750 
751  std::string doc;
752 
754  operator bool() const ;
755 
757  Property const * const parent;
758 
760  Property(Property const * const ancestor);
761 
763  Property(std::string classname, std::string doc="");
764 
766  Property(std::string name,
767  set_long_t set_long,
768  get_long_t get_long,
769  std::string doc);
770 
772  Property(std::string name,
773  set_unsigned_long_t set_unsigned_long,
774  get_unsigned_long_t get_unsigned_long,
775  std::string doc);
776 
778 
783  Property(std::string name,
784  set_size_t_t set_size_t,
785  get_size_t_t get_size_t,
786  int dummy,
787  std::string doc);
788 
790  Property(std::string name,
791  set_double_t set_double,
792  get_double_t get_double,
793  std::string doc);
794 
796  Property(std::string name,
797  set_double_t set_double,
798  get_double_t get_double,
799  set_double_unit_t set_double_unit,
800  get_double_unit_t get_double_unit,
801  std::string doc);
802 
804  Property(std::string name,
805  std::string name_false,
806  set_bool_t set_bool,
807  get_bool_t get_bool,
808  std::string doc);
809 
811 
817  Property(std::string name,
818  set_string_t set_string,
819  get_string_t get_string,
820  bool is_filename,
821  std::string doc);
822 
824  Property(std::string name,
825  set_vector_double_t set_vdouble,
826  get_vector_double_t get_vdouble,
827  std::string doc);
828 
830  Property(std::string name,
831  set_vector_double_t set_vdouble,
832  get_vector_double_t get_vdouble,
833  set_vector_double_unit_t set_vdouble_unit,
834  get_vector_double_unit_t get_vdouble_unit,
835  std::string doc);
836 
838  Property(std::string name,
839  set_vector_unsigned_long_t set_vulong,
840  get_vector_unsigned_long_t get_vulong,
841  std::string doc);
842 
844  Property(std::string name,
845  set_metric_t set_metric,
846  get_metric_t get_metric,
847  std::string doc);
848 
850  Property(std::string name,
851  set_screen_t set_screen,
852  get_screen_t get_screen,
853  std::string doc);
854 
856  Property(std::string name,
857  set_astrobj_t set_astrobj,
858  get_astrobj_t get_astrobj,
859  std::string doc);
860 
862  Property(std::string name,
863  set_spectrum_t set_spectrum,
864  get_spectrum_t get_spectrum,
865  std::string doc);
866 
868  Property(std::string name,
869  set_spectrometer_t set_spectrometer,
870  get_spectrometer_t get_spectrometer,
871  std::string doc);
872 
873 };
874 
876 #define GYOTO_PROPERTY_CHOOSER(x, A, B, C, D, E, F, FUNC, ...) FUNC
877 
878 #define GYOTO_PROPERTY_START_DOC(class, doc) \
879  Property const class::properties[] = { \
880  Property (#class, doc),
881 
882 #define GYOTO_PROPERTY_START_NODOC(class) \
883  GYOTO_PROPERTY_START_DOC(class, "")
884 
885 
886 #define GYOTO_PROPERTY_BOOL_DOC(class, name, namef, fname, doc) \
887  Gyoto::Property \
888  (#name, \
889  #namef, \
890  (Gyoto::Property::set_bool_t)&class :: fname, \
891  (Gyoto::Property::get_bool_t)&class :: fname, \
892  doc),
893 #define GYOTO_PROPERTY_BOOL_NODOC(class, name, namef, fname) \
894  GYOTO_PROPERTY_BOOL_DOC(class, name, namef, fname, "")
895 
896 #define GYOTO_PROPERTY_DOUBLE_DOC(class, name, fname, doc) \
897  Gyoto::Property \
898  (#name, \
899  (Gyoto::Property::set_double_t)&class::fname, \
900  (Gyoto::Property::get_double_t)&class::fname, \
901  doc),
902 #define GYOTO_PROPERTY_DOUBLE_NODOC(class, name, fname) \
903  GYOTO_PROPERTY_DOUBLE_DOC(class, name, fname, "")
904 
905 #define GYOTO_PROPERTY_LONG_DOC(class, name, fname, doc) \
906  Gyoto::Property \
907  (#name, \
908  (Gyoto::Property::set_long_t)&class::fname, \
909  (Gyoto::Property::get_long_t)&class::fname, \
910  doc),
911 #define GYOTO_PROPERTY_LONG_NODOC(class, name, fname) \
912  GYOTO_PROPERTY_LONG_DOC(class, name, fname, "")
913 
914 #define GYOTO_PROPERTY_UNSIGNED_LONG_DOC(class, name, fname, doc) \
915  Gyoto::Property \
916  (#name, \
917  (Gyoto::Property::set_unsigned_long_t)&class::fname, \
918  (Gyoto::Property::get_unsigned_long_t)&class::fname, \
919  doc),
920 #define GYOTO_PROPERTY_UNSIGNED_LONG_NODOC(class, name, fname) \
921  GYOTO_PROPERTY_UNSIGNED_LONG_DOC(class, name, fname, "")
922 
923 #define GYOTO_PROPERTY_SIZE_T_DOC(class, name, fname, doc) \
924  Gyoto::Property \
925  (#name, \
926  (Gyoto::Property::set_size_t_t)&class::fname, \
927  (Gyoto::Property::get_size_t_t)&class::fname, \
928  1, \
929  doc),
930 #define GYOTO_PROPERTY_SIZE_T_NODOC(class, name, fname) \
931  GYOTO_PROPERTY_SIZE_T_DOC(class, name, fname, "")
932 
933 #define GYOTO_PROPERTY_DOUBLE_UNIT_DOC(class, name, fname, doc) \
934  Gyoto::Property \
935  (#name, \
936  (Gyoto::Property::set_double_t)&class::fname, \
937  (Gyoto::Property::get_double_t)&class::fname, \
938  (Gyoto::Property::set_double_unit_t)&class::fname, \
939  (Gyoto::Property::get_double_unit_t)&class::fname, \
940  doc),
941 #define GYOTO_PROPERTY_DOUBLE_UNIT_NODOC(class, name, fname) \
942  GYOTO_PROPERTY_DOUBLE_UNIT_DOC(class, name, fname, "")
943 
944 #define GYOTO_PROPERTY_FILENAME_DOC(class, name, fname, doc) \
945  Gyoto::Property \
946  (#name, \
947  (Gyoto::Property::set_string_t)&class::fname, \
948  (Gyoto::Property::get_string_t)&class::fname, \
949  true, doc),
950 #define GYOTO_PROPERTY_FILENAME_NODOC(class, name, fname) \
951  GYOTO_PROPERTY_FILENAME_DOC(class, name, fname, "")
952 
953 #define GYOTO_PROPERTY_STRING_DOC(class, name, fname, doc) \
954  Gyoto::Property \
955  (#name, \
956  (Gyoto::Property::set_string_t)&class::fname, \
957  (Gyoto::Property::get_string_t)&class::fname, \
958  false, doc),
959 #define GYOTO_PROPERTY_STRING_NODOC(class, name, fname) \
960  GYOTO_PROPERTY_STRING_DOC(class, name, fname, "")
961 
962 #define GYOTO_PROPERTY_VECTOR_DOUBLE_DOC(class, name, fname, doc) \
963  Gyoto::Property \
964  (#name, \
965  (Gyoto::Property::set_vector_double_t)&class::fname, \
966  (Gyoto::Property::get_vector_double_t)&class::fname, \
967  doc),
968 #define GYOTO_PROPERTY_VECTOR_DOUBLE_NODOC(class, name, fname) \
969  GYOTO_PROPERTY_VECTOR_DOUBLE_DOC(class, name, fname, "")
970 
971 #define GYOTO_PROPERTY_VECTOR_DOUBLE_UNIT_DOC(class, name, fname, doc) \
972  Gyoto::Property \
973  (#name, \
974  (Gyoto::Property::set_vector_double_t)&class::fname, \
975  (Gyoto::Property::get_vector_double_t)&class::fname, \
976  (Gyoto::Property::set_vector_double_unit_t)&class::fname, \
977  (Gyoto::Property::get_vector_double_unit_t)&class::fname, \
978  doc),
979 #define GYOTO_PROPERTY_VECTOR_DOUBLE_UNIT_NODOC(class, name, fname) \
980  GYOTO_PROPERTY_VECTOR_DOUBLE_UNIT_DOC(class, name, fname, "")
981 
982 #define GYOTO_PROPERTY_VECTOR_UNSIGNED_LONG_DOC(class, name, fname, doc) \
983  Gyoto::Property \
984  (#name, \
985  (Gyoto::Property::set_vector_unsigned_long_t)&class::fname, \
986  (Gyoto::Property::get_vector_unsigned_long_t)&class::fname, \
987  doc),
988 #define GYOTO_PROPERTY_VECTOR_UNSIGNED_LONG_NODOC(class, name, fname) \
989  GYOTO_PROPERTY_VECTOR_UNSIGNED_LONG_DOC(class, name, fname, "")
990 
991 #define GYOTO_PROPERTY_METRIC_DOC(class, name, fname, doc) \
992  Gyoto::Property \
993  (#name, \
994  (Gyoto::Property::set_metric_t)&class::fname, \
995  (Gyoto::Property::get_metric_t)&class::fname, \
996  doc),
997 #define GYOTO_PROPERTY_METRIC_NODOC(class, name, fname) \
998  GYOTO_PROPERTY_METRIC_DOC(class, name, fname, "")
999 
1000 #define GYOTO_PROPERTY_SCREEN_DOC(class, name, fname, doc) \
1001  Gyoto::Property \
1002  (#name, \
1003  (Gyoto::Property::set_screen_t)&class::fname, \
1004  (Gyoto::Property::get_screen_t)&class::fname, \
1005  doc),
1006 #define GYOTO_PROPERTY_SCREEN_NODOC(class, name, fname) \
1007  GYOTO_PROPERTY_SCREEN_DOC(class, name, fname, "")
1008 
1009 #define GYOTO_PROPERTY_ASTROBJ_DOC(class, name, fname, doc) \
1010  Gyoto::Property \
1011  (#name, \
1012  (Gyoto::Property::set_astrobj_t)&class::fname, \
1013  (Gyoto::Property::get_astrobj_t)&class::fname, \
1014  doc),
1015 #define GYOTO_PROPERTY_ASTROBJ_NODOC(class, name, fname) \
1016  GYOTO_PROPERTY_ASTROBJ_DOC(class, name, fname, "")
1017 
1018 #define GYOTO_PROPERTY_SPECTRUM_DOC(class, name, fname, doc) \
1019  Gyoto::Property \
1020  (#name, \
1021  (Gyoto::Property::set_spectrum_t)&class::fname, \
1022  (Gyoto::Property::get_spectrum_t)&class::fname, \
1023  doc),
1024 #define GYOTO_PROPERTY_SPECTRUM_NODOC(class, name, fname) \
1025  GYOTO_PROPERTY_SPECTRUM_DOC(class, name, fname, "")
1026 
1027 #define GYOTO_PROPERTY_SPECTROMETER_DOC(class, name, fname, doc) \
1028  Gyoto::Property \
1029  (#name, \
1030  (Gyoto::Property::set_spectrometer_t)&class::fname, \
1031  (Gyoto::Property::get_spectrometer_t)&class::fname, \
1032  doc),
1033 #define GYOTO_PROPERTY_SPECTROMETER_NODOC(class, name, fname) \
1034  GYOTO_PROPERTY_SPECTROMETER_DOC(class, name, fname, "")
1035 // \endcond INTERNAL
1036 
1037 #endif
Union holding an accessor to set any type.
Definition: GyotoProperty.h:682
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:641
Type is std::string and holds a file name.
Definition: GyotoProperty.h:564
Union holding an accessor to get any type.
Definition: GyotoProperty.h:701
Type is bool.
Definition: GyotoProperty.h:552
std::string name_false
Name if false.
Definition: GyotoProperty.h:594
Type is long.
Definition: GyotoProperty.h:546
#define size_t
If not defined in <sys/types.h>.
Definition: GyotoConfig.h:354
Type is Gyoto::SmartPointer<Gyoto::Metric::Generic>
Definition: GyotoProperty.h:570
setter_t setter
Pointer to the setter method.
Definition: GyotoProperty.h:734
std::string name
Name of this instance.
Definition: GyotoProperty.h:589
std::vector< double >(Object::* get_vector_double_t)() const
Prototype for an accessor to get a std::vector<double>
Definition: GyotoProperty.h:633
Type is std::vector<unsigned long>
Definition: GyotoProperty.h:568
Type is double.
Definition: GyotoProperty.h:544
Compile-time configuration.
type_e
Possible type of a Property instance.
Definition: GyotoProperty.h:542
Property that can be set and got using standard methods.
Definition: GyotoProperty.h:533
setter_unit_t setter_unit
Pointer to the setter (with unit) method.
Definition: GyotoProperty.h:744
getter_unit_t getter_unit
Pointer to the getter (with unit) method.
Definition: GyotoProperty.h:749
Type is Gyoto::SmartPointer<Gyoto::Spectrum::Generic>
Definition: GyotoProperty.h:576
int type
Type of this instance.
Definition: GyotoProperty.h:596
Union holding an accessor to get double or vector<double> with unit.
Definition: GyotoProperty.h:725
Namespace for the Gyoto library.
Definition: GyotoAstrobj.h:43
Union holding an accessor to set double or vector<double> with unit.
Definition: GyotoProperty.h:720
Type is Gyoto::SmartPointer<Gyoto::Spectrometer::Generic>
Definition: GyotoProperty.h:578
Pointers performing reference counting.
Definition: GyotoProperty.h:41
Type is std::vector<double>
Definition: GyotoProperty.h:566
Type is Gyoto::SmartPointer<Gyoto::Astrobj::Generic>
Definition: GyotoProperty.h:574
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:637
Type is std::string.
Definition: GyotoProperty.h:554
Object with properties.
Definition: GyotoObject.h:136
Type is Gyoto::SmartPointer<Gyoto::Screen::Generic>
Definition: GyotoProperty.h:572
getter_t getter
Pointer to the getter method.
Definition: GyotoProperty.h:739
Type is unsigned long (a.k.a. size_t)
Definition: GyotoProperty.h:548
Type is size_t (only if distinct from unsigned long)
Definition: GyotoProperty.h:550
Property const *const parent
If type is empty_t, link to another Property list.
Definition: GyotoProperty.h:757