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 
37 namespace 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;
764  set_vector_unsigned_long_t set_vulong;
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;
783  get_vector_unsigned_long_t get_vulong;
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 
835 
837  Property(Property const * const ancestor);
838 
840  Property(std::string classname, std::string doc="");
841 
843  Property(std::string name,
844  set_long_t set_long,
845  get_long_t get_long,
846  std::string doc);
847 
849  Property(std::string name,
850  set_unsigned_long_t set_unsigned_long,
851  get_unsigned_long_t get_unsigned_long,
852  std::string doc);
853 
855 
860  Property(std::string name,
861  set_size_t_t set_size_t,
862  get_size_t_t get_size_t,
863  int dummy,
864  std::string doc);
865 
867  Property(std::string name,
868  set_double_t set_double,
869  get_double_t get_double,
870  std::string doc);
871 
873  Property(std::string name,
874  set_double_t set_double,
875  get_double_t get_double,
876  set_double_unit_t set_double_unit,
877  get_double_unit_t get_double_unit,
878  std::string doc);
879 
881  Property(std::string name,
882  std::string name_false,
883  set_bool_t set_bool,
884  get_bool_t get_bool,
885  std::string doc);
886 
888 
894  Property(std::string name,
895  set_string_t set_string,
896  get_string_t get_string,
897  bool is_filename,
898  std::string doc);
899 
901  Property(std::string name,
902  set_vector_double_t set_vdouble,
903  get_vector_double_t get_vdouble,
904  std::string doc);
905 
907  Property(std::string name,
908  set_vector_double_t set_vdouble,
909  get_vector_double_t get_vdouble,
910  set_vector_double_unit_t set_vdouble_unit,
911  get_vector_double_unit_t get_vdouble_unit,
912  std::string doc);
913 
915  Property(std::string name,
916  set_vector_unsigned_long_t set_vulong,
917  get_vector_unsigned_long_t get_vulong,
918  std::string doc);
919 
921  Property(std::string name,
922  set_metric_t set_metric,
923  get_metric_t get_metric,
924  std::string doc);
925 
927  Property(std::string name,
928  set_screen_t set_screen,
929  get_screen_t get_screen,
930  std::string doc);
931 
933  Property(std::string name,
934  set_astrobj_t set_astrobj,
935  get_astrobj_t get_astrobj,
936  std::string doc);
937 
939  Property(std::string name,
940  set_spectrum_t set_spectrum,
941  get_spectrum_t get_spectrum,
942  std::string doc);
943 
945  Property(std::string name,
946  set_spectrometer_t set_spectrometer,
947  get_spectrometer_t get_spectrometer,
948  std::string doc);
949 
951 
954  Property(std::string name, int type);
955 
957  static type_e typeFromString(std::string stype);
958 
959 };
960 
962 #define GYOTO_PROPERTY_CHOOSER(x, A, B, C, D, E, F, FUNC, ...) FUNC
963 
964 #define GYOTO_PROPERTY_START_DOC(class, doc) \
965  Property const class::properties[] = { \
966  Property (#class, doc),
967 
968 #define GYOTO_PROPERTY_START_NODOC(class) \
969  GYOTO_PROPERTY_START_DOC(class, "")
970 
971 
972 #define GYOTO_PROPERTY_BOOL_DOC(class, name, namef, fname, doc) \
973  Gyoto::Property \
974  (#name, \
975  #namef, \
976  (Gyoto::Property::set_bool_t)&class :: fname, \
977  (Gyoto::Property::get_bool_t)&class :: fname, \
978  doc),
979 #define GYOTO_PROPERTY_BOOL_NODOC(class, name, namef, fname) \
980  GYOTO_PROPERTY_BOOL_DOC(class, name, namef, fname, "")
981 
982 #define GYOTO_PROPERTY_DOUBLE_DOC(class, name, fname, doc) \
983  Gyoto::Property \
984  (#name, \
985  (Gyoto::Property::set_double_t)&class::fname, \
986  (Gyoto::Property::get_double_t)&class::fname, \
987  doc),
988 #define GYOTO_PROPERTY_DOUBLE_NODOC(class, name, fname) \
989  GYOTO_PROPERTY_DOUBLE_DOC(class, name, fname, "")
990 
991 #define GYOTO_PROPERTY_LONG_DOC(class, name, fname, doc) \
992  Gyoto::Property \
993  (#name, \
994  (Gyoto::Property::set_long_t)&class::fname, \
995  (Gyoto::Property::get_long_t)&class::fname, \
996  doc),
997 #define GYOTO_PROPERTY_LONG_NODOC(class, name, fname) \
998  GYOTO_PROPERTY_LONG_DOC(class, name, fname, "")
999 
1000 #define GYOTO_PROPERTY_UNSIGNED_LONG_DOC(class, name, fname, doc) \
1001  Gyoto::Property \
1002  (#name, \
1003  (Gyoto::Property::set_unsigned_long_t)&class::fname, \
1004  (Gyoto::Property::get_unsigned_long_t)&class::fname, \
1005  doc),
1006 #define GYOTO_PROPERTY_UNSIGNED_LONG_NODOC(class, name, fname) \
1007  GYOTO_PROPERTY_UNSIGNED_LONG_DOC(class, name, fname, "")
1008 
1009 #define GYOTO_PROPERTY_SIZE_T_DOC(class, name, fname, doc) \
1010  Gyoto::Property \
1011  (#name, \
1012  (Gyoto::Property::set_size_t_t)&class::fname, \
1013  (Gyoto::Property::get_size_t_t)&class::fname, \
1014  1, \
1015  doc),
1016 #define GYOTO_PROPERTY_SIZE_T_NODOC(class, name, fname) \
1017  GYOTO_PROPERTY_SIZE_T_DOC(class, name, fname, "")
1018 
1019 #define GYOTO_PROPERTY_DOUBLE_UNIT_DOC(class, name, fname, doc) \
1020  Gyoto::Property \
1021  (#name, \
1022  (Gyoto::Property::set_double_t)&class::fname, \
1023  (Gyoto::Property::get_double_t)&class::fname, \
1024  (Gyoto::Property::set_double_unit_t)&class::fname, \
1025  (Gyoto::Property::get_double_unit_t)&class::fname, \
1026  doc),
1027 #define GYOTO_PROPERTY_DOUBLE_UNIT_NODOC(class, name, fname) \
1028  GYOTO_PROPERTY_DOUBLE_UNIT_DOC(class, name, fname, "")
1029 
1030 #define GYOTO_PROPERTY_FILENAME_DOC(class, name, fname, doc) \
1031  Gyoto::Property \
1032  (#name, \
1033  (Gyoto::Property::set_string_t)&class::fname, \
1034  (Gyoto::Property::get_string_t)&class::fname, \
1035  true, doc),
1036 #define GYOTO_PROPERTY_FILENAME_NODOC(class, name, fname) \
1037  GYOTO_PROPERTY_FILENAME_DOC(class, name, fname, "")
1038 
1039 #define GYOTO_PROPERTY_STRING_DOC(class, name, fname, doc) \
1040  Gyoto::Property \
1041  (#name, \
1042  (Gyoto::Property::set_string_t)&class::fname, \
1043  (Gyoto::Property::get_string_t)&class::fname, \
1044  false, doc),
1045 #define GYOTO_PROPERTY_STRING_NODOC(class, name, fname) \
1046  GYOTO_PROPERTY_STRING_DOC(class, name, fname, "")
1047 
1048 #define GYOTO_PROPERTY_VECTOR_DOUBLE_DOC(class, name, fname, doc) \
1049  Gyoto::Property \
1050  (#name, \
1051  (Gyoto::Property::set_vector_double_t)&class::fname, \
1052  (Gyoto::Property::get_vector_double_t)&class::fname, \
1053  doc),
1054 #define GYOTO_PROPERTY_VECTOR_DOUBLE_NODOC(class, name, fname) \
1055  GYOTO_PROPERTY_VECTOR_DOUBLE_DOC(class, name, fname, "")
1056 
1057 #define GYOTO_PROPERTY_VECTOR_DOUBLE_UNIT_DOC(class, name, fname, doc) \
1058  Gyoto::Property \
1059  (#name, \
1060  (Gyoto::Property::set_vector_double_t)&class::fname, \
1061  (Gyoto::Property::get_vector_double_t)&class::fname, \
1062  (Gyoto::Property::set_vector_double_unit_t)&class::fname, \
1063  (Gyoto::Property::get_vector_double_unit_t)&class::fname, \
1064  doc),
1065 #define GYOTO_PROPERTY_VECTOR_DOUBLE_UNIT_NODOC(class, name, fname) \
1066  GYOTO_PROPERTY_VECTOR_DOUBLE_UNIT_DOC(class, name, fname, "")
1067 
1068 #define GYOTO_PROPERTY_VECTOR_UNSIGNED_LONG_DOC(class, name, fname, doc) \
1069  Gyoto::Property \
1070  (#name, \
1071  (Gyoto::Property::set_vector_unsigned_long_t)&class::fname, \
1072  (Gyoto::Property::get_vector_unsigned_long_t)&class::fname, \
1073  doc),
1074 #define GYOTO_PROPERTY_VECTOR_UNSIGNED_LONG_NODOC(class, name, fname) \
1075  GYOTO_PROPERTY_VECTOR_UNSIGNED_LONG_DOC(class, name, fname, "")
1076 
1077 #define GYOTO_PROPERTY_METRIC_DOC(class, name, fname, doc) \
1078  Gyoto::Property \
1079  (#name, \
1080  (Gyoto::Property::set_metric_t)&class::fname, \
1081  (Gyoto::Property::get_metric_t)&class::fname, \
1082  doc),
1083 #define GYOTO_PROPERTY_METRIC_NODOC(class, name, fname) \
1084  GYOTO_PROPERTY_METRIC_DOC(class, name, fname, "")
1085 
1086 #define GYOTO_PROPERTY_SCREEN_DOC(class, name, fname, doc) \
1087  Gyoto::Property \
1088  (#name, \
1089  (Gyoto::Property::set_screen_t)&class::fname, \
1090  (Gyoto::Property::get_screen_t)&class::fname, \
1091  doc),
1092 #define GYOTO_PROPERTY_SCREEN_NODOC(class, name, fname) \
1093  GYOTO_PROPERTY_SCREEN_DOC(class, name, fname, "")
1094 
1095 #define GYOTO_PROPERTY_ASTROBJ_DOC(class, name, fname, doc) \
1096  Gyoto::Property \
1097  (#name, \
1098  (Gyoto::Property::set_astrobj_t)&class::fname, \
1099  (Gyoto::Property::get_astrobj_t)&class::fname, \
1100  doc),
1101 #define GYOTO_PROPERTY_ASTROBJ_NODOC(class, name, fname) \
1102  GYOTO_PROPERTY_ASTROBJ_DOC(class, name, fname, "")
1103 
1104 #define GYOTO_PROPERTY_SPECTRUM_DOC(class, name, fname, doc) \
1105  Gyoto::Property \
1106  (#name, \
1107  (Gyoto::Property::set_spectrum_t)&class::fname, \
1108  (Gyoto::Property::get_spectrum_t)&class::fname, \
1109  doc),
1110 #define GYOTO_PROPERTY_SPECTRUM_NODOC(class, name, fname) \
1111  GYOTO_PROPERTY_SPECTRUM_DOC(class, name, fname, "")
1112 
1113 #define GYOTO_PROPERTY_SPECTROMETER_DOC(class, name, fname, doc) \
1114  Gyoto::Property \
1115  (#name, \
1116  (Gyoto::Property::set_spectrometer_t)&class::fname, \
1117  (Gyoto::Property::get_spectrometer_t)&class::fname, \
1118  doc),
1119 #define GYOTO_PROPERTY_SPECTROMETER_NODOC(class, name, fname) \
1120  GYOTO_PROPERTY_SPECTROMETER_DOC(class, name, fname, "")
1121 // \endcond INTERNAL
1122 
1123 #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
static type_e typeFromString(std::string stype)
Get Property::type_e value from name.
std::vector< double >(Object::* get_vector_double_t)() const
Prototype for an accessor to get a std::vector<double>
Definition: GyotoProperty.h:707
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
Property()
Default constructor.
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
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
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
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 classname, std::string doc="")
Constructor for class name pseudo-property.
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.
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_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
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::Astrobj::Generic >(Object::* get_astrobj_t)() const
Prototype for an accessor to get a Gyoto::SmartPointer<Gyoto::Astrobj::Generic>
Definition: GyotoProperty.h:736
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::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
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::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
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.
Property(std::string name, int type)
Constructor setting only name and type.
void(Object::* set_bool_t)(bool val)
Prototype for an accessor to set a bool.
Definition: GyotoProperty.h:693
double(Object::* get_double_t)() const
Prototype for an accessor to get a double.
Definition: GyotoProperty.h:674
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
Gyoto::SmartPointer< Gyoto::Screen >(Object::* get_screen_t)() const
Prototype for an accessor to get a Gyoto::SmartPointer<Gyoto::Screen>
Definition: GyotoProperty.h:729
int type
Type of this instance.
Definition: GyotoProperty.h:670
Namespace for the Gyoto library.
Definition: GyotoAstrobj.h:44
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