26 #ifndef __GyotoProperty_H_
27 #define __GyotoProperty_H_
36 namespace Metric {
class Generic; }
37 namespace Astrobj {
class Generic; }
38 namespace Spectrum {
class Generic; }
39 namespace Spectrometer {
class Generic; }
50 #define GYOTO_PROPERTY_ACCESSORS(class, type, member, method) \
51 void class::method(type v) {member=v;} \
52 type class::method() const {return member;}
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); \
70 double class::method(std::string const &u) const { \
71 return Units::FromGeometrical(member, u, metric); \
78 #define GYOTO_PROPERTY_START(class) \
79 Property const class::properties[] = {
92 #define GYOTO_PROPERTY_BOOL(class, name, namef, fname) \
96 (Gyoto::Property::set_bool_t)&class :: fname, \
97 (Gyoto::Property::get_bool_t)&class :: fname),
100 #define GYOTO_PROPERTY_DOUBLE(class, name, fname) \
103 (Gyoto::Property::set_double_t)&class::fname, \
104 (Gyoto::Property::get_double_t)&class::fname),
107 #define GYOTO_PROPERTY_LONG(class, name, fname) \
110 (Gyoto::Property::set_long_t)&class::fname, \
111 (Gyoto::Property::get_long_t)&class::fname),
114 #define GYOTO_PROPERTY_UNSIGNED_LONG(class, name, fname) \
117 (Gyoto::Property::set_unsigned_long_t)&class::fname, \
118 (Gyoto::Property::get_unsigned_long_t)&class::fname),
120 #if defined(GYOTO_SIZE__T_IS_UNSIGNED_LONG)
121 # define GYOTO_PROPERTY_SIZE_T GYOTO_PROPERTY_UNSIGNED_LONG
123 #define GYOTO_PROPERTY_SIZE_T(class, name, fname) \
126 (Gyoto::Property::set_size_t_t)&class::fname, \
127 (Gyoto::Property::get_size_t_t)&class::fname),
131 #define GYOTO_PROPERTY_DOUBLE_UNIT(class, name, fname) \
134 (Gyoto::Property::set_double_t)&class::fname, \
135 (Gyoto::Property::get_double_t)&class::fname, \
136 (Gyoto::Property::set_double_unit_t)&class::fname, \
137 (Gyoto::Property::get_double_unit_t)&class::fname),
140 #define GYOTO_PROPERTY_FILENAME(class, name, fname) \
143 (Gyoto::Property::set_string_t)&class::fname, \
144 (Gyoto::Property::get_string_t)&class::fname, \
148 #define GYOTO_PROPERTY_STRING(class, name, fname) \
151 (Gyoto::Property::set_string_t)&class::fname, \
152 (Gyoto::Property::get_string_t)&class::fname, \
156 #define GYOTO_PROPERTY_VECTOR_DOUBLE(class, name, fname) \
159 (Gyoto::Property::set_vector_double_t)&class::fname, \
160 (Gyoto::Property::get_vector_double_t)&class::fname),
163 #define GYOTO_PROPERTY_VECTOR_DOUBLE_UNIT(class, name, fname) \
166 (Gyoto::Property::set_vector_double_t)&class::fname, \
167 (Gyoto::Property::get_vector_double_t)&class::fname, \
168 (Gyoto::Property::set_vector_double_unit_t)&class::fname, \
169 (Gyoto::Property::get_vector_double_unit_t)&class::fname),
172 #define GYOTO_PROPERTY_VECTOR_UNSIGNED_LONG(class, name, fname) \
175 (Gyoto::Property::set_vector_unsigned_long_t)&class::fname, \
176 (Gyoto::Property::get_vector_unsigned_long_t)&class::fname),
179 #define GYOTO_PROPERTY_METRIC(class, name, fname) \
182 (Gyoto::Property::set_metric_t)&class::fname, \
183 (Gyoto::Property::get_metric_t)&class::fname),
186 #define GYOTO_PROPERTY_SCREEN(class, name, fname) \
189 (Gyoto::Property::set_screen_t)&class::fname, \
190 (Gyoto::Property::get_screen_t)&class::fname),
193 #define GYOTO_PROPERTY_ASTROBJ(class, name, fname) \
196 (Gyoto::Property::set_astrobj_t)&class::fname, \
197 (Gyoto::Property::get_astrobj_t)&class::fname),
200 #define GYOTO_PROPERTY_SPECTRUM(class, name, fname) \
203 (Gyoto::Property::set_spectrum_t)&class::fname, \
204 (Gyoto::Property::get_spectrum_t)&class::fname),
207 #define GYOTO_PROPERTY_SPECTROMETER(class, name, fname) \
210 (Gyoto::Property::set_spectrometer_t)&class::fname, \
211 (Gyoto::Property::get_spectrometer_t)&class::fname),
214 #define GYOTO_PROPERTY_END(class, next) \
216 Gyoto::Property const * class::getProperties() const { \
217 return class::properties; \
329 #if !defined(GYOTO_SIZE__T_IS_UNSIGNED_LONG)
385 std::string
const &unit);
396 #if !defined(GYOTO_SIZE__T_IS_UNSIGNED_LONG)
397 typedef void (
Object::* set_size_t_t)(
size_t val);
470 #if !defined(GYOTO_SIZE__T_IS_UNSIGNED_LONG)
471 set_size_t_t set_size_t;
491 #if !defined(GYOTO_SIZE__T_IS_UNSIGNED_LONG)
492 get_size_t_t get_size_t;
540 operator bool()
const ;
558 #if !defined(GYOTO_SIZE__T_IS_UNSIGNED_LONG)
561 set_size_t_t set_size_t,
562 get_size_t_t get_size_t);
579 std::string name_false,
void(Object::* set_bool_t)(bool val)
Prototype for an accessor to set a bool.
Definition: GyotoProperty.h:403
void(Object::* set_string_t)(std::string const &)
Prototype for an accessor to set a string.
Definition: GyotoProperty.h:407
Union holding an accessor to set any type.
Definition: GyotoProperty.h:466
Gyoto::SmartPointer< Gyoto::Spectrometer::Generic >(Object::* get_spectrometer_t)() const
Prototype for an accessor to get a Gyoto::SmartPointer ...
Definition: GyotoProperty.h:460
std::vector< unsigned long >(Object::* get_vector_unsigned_long_t)() const
Prototype for an accessor to get a std::vector
Definition: GyotoProperty.h:425
void(Object::* set_metric_t)(Gyoto::SmartPointer< Gyoto::Metric::Generic >)
Prototype for an accessor to set a Gyoto::SmartPointer
Definition: GyotoProperty.h:429
double(Object::* get_double_t)() const
Prototype for an accessor to get a double.
Definition: GyotoProperty.h:382
Type is std::string and holds a file name.
Definition: GyotoProperty.h:346
long(Object::* get_long_t)() const
Prototype for an accessor to get a long.
Definition: GyotoProperty.h:391
Union holding an accessor to get any type.
Definition: GyotoProperty.h:487
Type is bool.
Definition: GyotoProperty.h:334
void(Object::* set_long_t)(long val)
Prototype for an accessor to set a long.
Definition: GyotoProperty.h:389
unsigned long(Object::* get_unsigned_long_t)() const
Prototype for an accessor to get an unsigned long.
Definition: GyotoProperty.h:395
std::string name_false
Name if false.
Definition: GyotoProperty.h:376
Type is long.
Definition: GyotoProperty.h:326
#define size_t
If not defined in .
Definition: GyotoConfig.h:366
void(Object::* set_vector_unsigned_long_t)(std::vector< unsigned long > const &)
Prototype for an accessor to set a std::vector
Definition: GyotoProperty.h:423
Type is Gyoto::SmartPointer
Definition: GyotoProperty.h:352
Gyoto::SmartPointer< Gyoto::Astrobj::Generic >(Object::* get_astrobj_t)() const
Prototype for an accessor to get a Gyoto::SmartPointer
Definition: GyotoProperty.h:446
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:384
std::string(Object::* get_fname_t)() const
Prototype for an accessor to get a filename.
Definition: GyotoProperty.h:413
setter_t setter
Pointer to the setter method.
Definition: GyotoProperty.h:522
std::string name
Name of this instance.
Definition: GyotoProperty.h:371
Gyoto::SmartPointer< Gyoto::Spectrum::Generic >(Object::* get_spectrum_t)() const
Prototype for an accessor to get a Gyoto::SmartPointer
Definition: GyotoProperty.h:453
void(Object::* set_spectrum_t)(Gyoto::SmartPointer< Gyoto::Spectrum::Generic >)
Prototype for an accessor to set a Gyoto::SmartPointer
Definition: GyotoProperty.h:450
Type is std::vector
Definition: GyotoProperty.h:350
double(Object::* get_double_unit_t)(std::string const &unit) const
Prototype for an accessor to get a double, with unit.
Definition: GyotoProperty.h:387
Type is double.
Definition: GyotoProperty.h:324
Compile-time configuration.
type_e
Possible type of a Property instance.
Definition: GyotoProperty.h:322
void(Object::* set_astrobj_t)(Gyoto::SmartPointer< Gyoto::Astrobj::Generic >)
Prototype for an accessor to set a Gyoto::SmartPointer
Definition: GyotoProperty.h:443
Property that can be set and got using standard methods.
Definition: GyotoProperty.h:313
std::vector< double >(Object::* get_vector_double_unit_t)(std::string const &) const
Prototype for an accessor to get a std::vector, with unit.
Definition: GyotoProperty.h:421
setter_unit_t setter_unit
Pointer to the setter (with unit) method.
Definition: GyotoProperty.h:532
getter_unit_t getter_unit
Pointer to the getter (with unit) method.
Definition: GyotoProperty.h:537
void(Object::* set_spectrometer_t)(Gyoto::SmartPointer< Gyoto::Spectrometer::Generic >)
Prototype for an accessor to set a Gyoto::SmartPointer ...
Definition: GyotoProperty.h:457
void(Object::* set_unsigned_long_t)(unsigned long val)
Prototype for an accessor to set an unsigned long.
Definition: GyotoProperty.h:393
Type is Gyoto::SmartPointer
Definition: GyotoProperty.h:358
int type
Type of this instance.
Definition: GyotoProperty.h:378
Union holding an accessor to get double or vector with unit.
Definition: GyotoProperty.h:513
void(Object::* set_vector_double_unit_t)(std::vector< double > const &, std::string const &)
Prototype for an accessor to set a std::vector, with unit.
Definition: GyotoProperty.h:419
Namespace for the Gyoto library.
Definition: GyotoAstrobj.h:43
Union holding an accessor to set double or vector with unit.
Definition: GyotoProperty.h:508
Type is Gyoto::SmartPointer
Definition: GyotoProperty.h:360
std::string(Object::* get_string_t)() const
Prototype for an accessor to get a string.
Definition: GyotoProperty.h:409
void(Object::* set_double_t)(double val)
Prototype for an accessor to set a double.
Definition: GyotoProperty.h:380
Property(Property const *const ancestor)
Constructor for type==empty_t.
Pointers performing reference counting.
Definition: GyotoProperty.h:41
Type is std::vector
Definition: GyotoProperty.h:348
Type is Gyoto::SmartPointer
Definition: GyotoProperty.h:356
std::vector< double >(Object::* get_vector_double_t)() const
Prototype for an accessor to get a std::vector
Definition: GyotoProperty.h:417
bool(Object::* get_bool_t)() const
Prototype for an accessor to get a bool.
Definition: GyotoProperty.h:405
Type is std::string.
Definition: GyotoProperty.h:336
Object with properties.
Definition: GyotoObject.h:136
void(Object::* set_vector_double_t)(std::vector< double > const &)
Prototype for an accessor to set a std::vector
Definition: GyotoProperty.h:415
Type is Gyoto::SmartPointer
Definition: GyotoProperty.h:354
getter_t getter
Pointer to the getter method.
Definition: GyotoProperty.h:527
Type is unsigned long (a.k.a. size_t)
Definition: GyotoProperty.h:328
void(Object::* set_fname_t)(std::string const &)
Prototype for an accessor to set a filename.
Definition: GyotoProperty.h:411
Gyoto::SmartPointer< Gyoto::Metric::Generic >(Object::* get_metric_t)() const
Prototype for an accessor to get a Gyoto::SmartPointer
Definition: GyotoProperty.h:432
Gyoto::SmartPointer< Gyoto::Screen >(Object::* get_screen_t)() const
Prototype for an accessor to get a Gyoto::SmartPointer
Definition: GyotoProperty.h:439
Property is empty.
Definition: GyotoProperty.h:369
Property const *const parent
If type is empty_t, link to another Property list.
Definition: GyotoProperty.h:543
void(Object::* set_screen_t)(Gyoto::SmartPointer< Gyoto::Screen >)
Prototype for an accessor to set a Gyoto::SmartPointer
Definition: GyotoProperty.h:436