GyotoProperty.h
Go to the documentation of this file.
/*
Copyright 2014-2016 Thibaut Paumard
This file is part of Gyoto.
Gyoto is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Gyoto is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Gyoto. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GyotoProperty_H_
#define __GyotoProperty_H_
#include "GyotoConfig.h"
#include <string>
#include <vector>
#ifndef GYOTO_PLUGIN
#define GYOTO_PLUGIN
#endif
namespace Gyoto {
class Object;
class Property;
namespace Metric { class Generic; }
namespace Astrobj { class Generic; }
namespace Spectrum { class Generic; }
namespace Spectrometer { class Generic; }
class Screen;
template <class T> class SmartPointer;
}
#define GYOTO_PROPERTY_THREAD_UNSAFE(class) \
bool class::isThreadSafe() const {return false;}
#define GYOTO_PROPERTY_ACCESSORS(class, type, member, method) \
void class::method(type v) {member=v;} \
type class::method() const {return member;}
#define GYOTO_PROPERTY_ACCESSORS_SPECIAL(class, type, member, method, set, get) \
void class::method(type v) {member=v; set } \
type class::method() const {get ; return member;}
#define GYOTO_PROPERTY_ACCESSORS_GEOMETRICAL(class, member, method, metric) \
GYOTO_PROPERTY_ACCESSORS(class, double, member, method) \
void class::method(double v, std::string const &u) { \
member=Units::ToGeometrical(v, u, metric); \
} \
double class::method(std::string const &u) const { \
return Units::FromGeometrical(member, u, metric); \
}
#define GYOTO_PROPERTY_ACCESSORS_GEOMETRICAL_SPECIAL(class, member, method, metric, set, get) \
GYOTO_PROPERTY_ACCESSORS_SPECIAL(class, double, member, method, set, get) \
void class::method(double v, std::string const &u) { \
member=Units::ToGeometrical(v, u, metric); \
} \
double class::method(std::string const &u) const { \
return Units::FromGeometrical(member, u, metric); \
}
#define GYOTO_PROPERTY_ACCESSORS_UNIT(class, member, method, unit) \
GYOTO_PROPERTY_ACCESSORS(class, double, member, method) \
void class::method(double v, std::string const &u) { \
method(Units::Converter(u, unit)(v)); \
} \
double class::method(std::string const &u) const { \
return Units::Converter(unit, u)(method()); \
}
#define GYOTO_PROPERTY_START(...) \
GYOTO_PROPERTY_CHOOSER(,##__VA_ARGS__, \
"wrong number of arguments", \
"wrong number of arguments", \
"wrong number of arguments", \
"wrong number of arguments", \
GYOTO_PROPERTY_START_DOC(__VA_ARGS__), \
GYOTO_PROPERTY_START_NODOC(__VA_ARGS__), \
"wrong number of arguments" \
)
/*
* Declares a Property named "name". name and namef should not
* be quoted.
*
* \param[in] class Class name
* \param[in] name Name of property if true;
* \param[in] namef Name of property if false;
* \param[in] fname Name of functions for setting or getting the property
* \param[in] doc Document string (optional but recommended)
*/
#define GYOTO_PROPERTY_BOOL(...) \
GYOTO_PROPERTY_CHOOSER(,##__VA_ARGS__, \
"wrong number of arguments", \
GYOTO_PROPERTY_BOOL_DOC(__VA_ARGS__), \
GYOTO_PROPERTY_BOOL_NODOC(__VA_ARGS__), \
"wrong number of arguments", \
"wrong number of arguments", \
"wrong number of arguments", \
"wrong number of arguments" \
)
/*
* Declares a Property named "name". name and namef should not
* be quoted.
*
* \param[in] class Class name
* \param[in] name Name of property if true;
* \param[in] fname Name of functions for setting or getting the property
* \param[in] doc Document string (optional but recommended)
*/
#define GYOTO_PROPERTY_DOUBLE(...) \
GYOTO_PROPERTY_CHOOSER(,##__VA_ARGS__, \
GYOTO_NOTHING_6, \
GYOTO_NOTHING_5, \
GYOTO_PROPERTY_DOUBLE_DOC(__VA_ARGS__), \
GYOTO_PROPERTY_DOUBLE_NODOC(__VA_ARGS__), \
GYOTO_NOTHING_2, \
GYOTO_NOTHING_1, \
GYOTO_NOTHING_0 \
)
/*
* Declares a Property named "name". name and namef should not
* be quoted.
*
* \param[in] class Class name
* \param[in] name Name of property if true;
* \param[in] fname Name of functions for setting or getting the property
* \param[in] doc Document string (optional but recommended)
*/
#define GYOTO_PROPERTY_DOUBLE_UNIT(...) \
GYOTO_PROPERTY_CHOOSER(,##__VA_ARGS__, \
GYOTO_NOTHING_6, \
GYOTO_NOTHING_5, \
GYOTO_PROPERTY_DOUBLE_UNIT_DOC(__VA_ARGS__), \
GYOTO_PROPERTY_DOUBLE_UNIT_NODOC(__VA_ARGS__), \
GYOTO_NOTHING_2, \
GYOTO_NOTHING_1, \
GYOTO_NOTHING_0 \
)
/*
* Declares a Property named "name". name and namef should not
* be quoted.
*
* \param[in] class Class name
* \param[in] name Name of property if true;
* \param[in] fname Name of functions for setting or getting the property
* \param[in] doc Document string (optional but recommended)
*/
#define GYOTO_PROPERTY_VECTOR_DOUBLE(...) \
GYOTO_PROPERTY_CHOOSER(,##__VA_ARGS__, \
GYOTO_NOTHING_6, \
GYOTO_NOTHING_5, \
GYOTO_PROPERTY_VECTOR_DOUBLE_DOC(__VA_ARGS__), \
GYOTO_PROPERTY_VECTOR_DOUBLE_NODOC(__VA_ARGS__), \
GYOTO_NOTHING_2, \
GYOTO_NOTHING_1, \
GYOTO_NOTHING_0 \
)
/*
* Declares a Property named "name". name and namef should not
* be quoted.
*
* \param[in] class Class name
* \param[in] name Name of property if true;
* \param[in] fname Name of functions for setting or getting the property
* \param[in] doc Document string (optional but recommended)
*/
#define GYOTO_PROPERTY_VECTOR_DOUBLE_UNIT(...) \
GYOTO_PROPERTY_CHOOSER(,##__VA_ARGS__, \
GYOTO_NOTHING_6, \
GYOTO_NOTHING_5, \
GYOTO_PROPERTY_VECTOR_DOUBLE_UNIT_DOC(__VA_ARGS__), \
GYOTO_PROPERTY_VECTOR_DOUBLE_UNIT_NODOC(__VA_ARGS__), \
GYOTO_NOTHING_2, \
GYOTO_NOTHING_1, \
GYOTO_NOTHING_0 \
)
/*
* Declares a Property named "name". name and namef should not
* be quoted.
*
* \param[in] class Class name
* \param[in] name Name of property if true;
* \param[in] fname Name of functions for setting or getting the property
* \param[in] doc Document string (optional but recommended)
*/
#define GYOTO_PROPERTY_STRING(...) \
GYOTO_PROPERTY_CHOOSER(,##__VA_ARGS__, \
GYOTO_NOTHING_6, \
GYOTO_NOTHING_5, \
GYOTO_PROPERTY_STRING_DOC(__VA_ARGS__), \
GYOTO_PROPERTY_STRING_NODOC(__VA_ARGS__), \
GYOTO_NOTHING_2, \
GYOTO_NOTHING_1, \
GYOTO_NOTHING_0 \
)
/*
* Declares a Property named "name". name and namef should not
* be quoted.
*
* \param[in] class Class name
* \param[in] name Name of property if true;
* \param[in] fname Name of functions for setting or getting the property
* \param[in] doc Document string (optional but recommended)
*/
#define GYOTO_PROPERTY_FILENAME(...) \
GYOTO_PROPERTY_CHOOSER(,##__VA_ARGS__, \
GYOTO_NOTHING_6, \
GYOTO_NOTHING_5, \
GYOTO_PROPERTY_FILENAME_DOC(__VA_ARGS__), \
GYOTO_PROPERTY_FILENAME_NODOC(__VA_ARGS__), \
GYOTO_NOTHING_2, \
GYOTO_NOTHING_1, \
GYOTO_NOTHING_0 \
)
/*
* Declares a Property named "name". name and namef should not
* be quoted.
*
* \param[in] class Class name
* \param[in] name Name of property if true;
* \param[in] fname Name of functions for setting or getting the property
* \param[in] doc Document string (optional but recommended)
*/
#define GYOTO_PROPERTY_LONG(...) \
GYOTO_PROPERTY_CHOOSER(,##__VA_ARGS__, \
GYOTO_NOTHING_6, \
GYOTO_NOTHING_5, \
GYOTO_PROPERTY_LONG_DOC(__VA_ARGS__), \
GYOTO_PROPERTY_LONG_NODOC(__VA_ARGS__), \
GYOTO_NOTHING_2, \
GYOTO_NOTHING_1, \
GYOTO_NOTHING_0 \
)
/*
* Declares a Property named "name". name and namef should not
* be quoted.
*
* \param[in] class Class name
* \param[in] name Name of property if true;
* \param[in] fname Name of functions for setting or getting the property
* \param[in] doc Document string (optional but recommended)
*/
#define GYOTO_PROPERTY_UNSIGNED_LONG(...) \
GYOTO_PROPERTY_CHOOSER(,##__VA_ARGS__, \
GYOTO_NOTHING_6, \
GYOTO_NOTHING_5, \
GYOTO_PROPERTY_UNSIGNED_LONG_DOC(__VA_ARGS__), \
GYOTO_PROPERTY_UNSIGNED_LONG_NODOC(__VA_ARGS__), \
GYOTO_NOTHING_2, \
GYOTO_NOTHING_1, \
GYOTO_NOTHING_0 \
)
/*
* Declares a Property named "name". name and namef should not
* be quoted.
*
* \param[in] class Class name
* \param[in] name Name of property if true;
* \param[in] fname Name of functions for setting or getting the property
* \param[in] doc Document string (optional but recommended)
*/
#define GYOTO_PROPERTY_VECTOR_UNSIGNED_LONG(...) \
GYOTO_PROPERTY_CHOOSER(,##__VA_ARGS__, \
GYOTO_NOTHING_6, \
GYOTO_NOTHING_5, \
GYOTO_PROPERTY_VECTOR_UNSIGNED_LONG_DOC(__VA_ARGS__), \
GYOTO_PROPERTY_VECTOR_UNSIGNED_LONG_NODOC(__VA_ARGS__), \
GYOTO_NOTHING_2, \
GYOTO_NOTHING_1, \
GYOTO_NOTHING_0 \
)
/*
* Declares a Property named "name". name and namef should not
* be quoted.
*
* \param[in] class Class name
* \param[in] name Name of property if true;
* \param[in] fname Name of functions for setting or getting the property
* \param[in] doc Document string (optional but recommended)
*/
#define GYOTO_PROPERTY_SIZE_T(...) \
GYOTO_PROPERTY_CHOOSER(,##__VA_ARGS__, \
GYOTO_NOTHING_6, \
GYOTO_NOTHING_5, \
GYOTO_PROPERTY_SIZE_T_DOC(__VA_ARGS__), \
GYOTO_PROPERTY_SIZE_T_NODOC(__VA_ARGS__), \
GYOTO_NOTHING_2, \
GYOTO_NOTHING_1, \
GYOTO_NOTHING_0 \
)
/*
* Declares a Property named "name". name and namef should not
* be quoted.
*
* \param[in] class Class name
* \param[in] name Name of property if true;
* \param[in] fname Name of functions for setting or getting the property
* \param[in] doc Document string (optional but recommended)
*/
#define GYOTO_PROPERTY_METRIC(...) \
GYOTO_PROPERTY_CHOOSER(,##__VA_ARGS__, \
GYOTO_NOTHING_6, \
GYOTO_NOTHING_5, \
GYOTO_PROPERTY_METRIC_DOC(__VA_ARGS__), \
GYOTO_PROPERTY_METRIC_NODOC(__VA_ARGS__), \
GYOTO_NOTHING_2, \
GYOTO_NOTHING_1, \
GYOTO_NOTHING_0 \
)
/*
* Declares a Property named "name". name and namef should not
* be quoted.
*
* \param[in] class Class name
* \param[in] name Name of property if true;
* \param[in] fname Name of functions for setting or getting the property
* \param[in] doc Document string (optional but recommended)
*/
#define GYOTO_PROPERTY_SPECTRUM(...) \
GYOTO_PROPERTY_CHOOSER(,##__VA_ARGS__, \
GYOTO_NOTHING_6, \
GYOTO_NOTHING_5, \
GYOTO_PROPERTY_SPECTRUM_DOC(__VA_ARGS__), \
GYOTO_PROPERTY_SPECTRUM_NODOC(__VA_ARGS__), \
GYOTO_NOTHING_2, \
GYOTO_NOTHING_1, \
GYOTO_NOTHING_0 \
)
/*
* Declares a Property named "name". name and namef should not
* be quoted.
*
* \param[in] class Class name
* \param[in] name Name of property if true;
* \param[in] fname Name of functions for setting or getting the property
* \param[in] doc Document string (optional but recommended)
*/
#define GYOTO_PROPERTY_ASTROBJ(...) \
GYOTO_PROPERTY_CHOOSER(,##__VA_ARGS__, \
GYOTO_NOTHING_6, \
GYOTO_NOTHING_5, \
GYOTO_PROPERTY_ASTROBJ_DOC(__VA_ARGS__), \
GYOTO_PROPERTY_ASTROBJ_NODOC(__VA_ARGS__), \
GYOTO_NOTHING_2, \
GYOTO_NOTHING_1, \
GYOTO_NOTHING_0 \
)
/*
* Declares a Property named "name". name and namef should not
* be quoted.
*
* \param[in] class Class name
* \param[in] name Name of property if true;
* \param[in] fname Name of functions for setting or getting the property
* \param[in] doc Document string (optional but recommended)
*/
#define GYOTO_PROPERTY_SCREEN(...) \
GYOTO_PROPERTY_CHOOSER(,##__VA_ARGS__, \
GYOTO_NOTHING_6, \
GYOTO_NOTHING_5, \
GYOTO_PROPERTY_SCREEN_DOC(__VA_ARGS__), \
GYOTO_PROPERTY_SCREEN_NODOC(__VA_ARGS__), \
GYOTO_NOTHING_2, \
GYOTO_NOTHING_1, \
GYOTO_NOTHING_0 \
)
/*
* Declares a Property named "name". name and namef should not
* be quoted.
*
* \param[in] class Class name
* \param[in] name Name of property if true;
* \param[in] fname Name of functions for setting or getting the property
* \param[in] doc Document string (optional but recommended)
*/
#define GYOTO_PROPERTY_SPECTROMETER(...) \
GYOTO_PROPERTY_CHOOSER(,##__VA_ARGS__, \
GYOTO_NOTHING_6, \
GYOTO_NOTHING_5, \
GYOTO_PROPERTY_SPECTROMETER_DOC(__VA_ARGS__), \
GYOTO_PROPERTY_SPECTROMETER_NODOC(__VA_ARGS__), \
GYOTO_NOTHING_2, \
GYOTO_NOTHING_1, \
GYOTO_NOTHING_0 \
)
#define GYOTO_PROPERTY_END(class, next) \
Property(next)}; \
Gyoto::Property const * class::getProperties() const { \
return class::properties; \
} \
const std::string class::builtinPluginValue ( GYOTO_STRINGIFY(GYOTO_PLUGIN) ); \
std::vector<std::string> class::plugins() const { \
if (plugins_.size() == 0) { \
std::vector<std::string> p; \
p.push_back(class::builtinPluginValue); \
return p; \
} \
return plugins_; \
} \
void class::plugins(std::vector<std::string> const & plugname) { \
plugins_=plugname; \
}
class Gyoto::Property
{
private:
public:
enum type_e {
double_t,
long_t,
unsigned_long_t,
size_t_t,
bool_t,
string_t,
filename_t,
vector_double_t,
vector_unsigned_long_t,
metric_t,
screen_t,
astrobj_t,
spectrum_t,
spectrometer_t,
empty_t};
std::string name;
std::string name_false;
int type;
typedef void (Object::* set_double_t)(double val);
typedef double (Object::* get_double_t)() const;
typedef void (Object::* set_double_unit_t)(double val,
std::string const &unit);
typedef double (Object::* get_double_unit_t)(std::string const &unit) const;
typedef void (Object::* set_long_t)(long val);
typedef long (Object::* get_long_t)() const;
typedef void (Object::* set_unsigned_long_t)(unsigned long val);
typedef unsigned long (Object::* get_unsigned_long_t)() const;
typedef void (Object::* set_size_t_t)(size_t val);
typedef size_t (Object::* get_size_t_t)() const;
typedef void (Object::* set_bool_t)(bool val);
typedef bool (Object::* get_bool_t)() const;
typedef void (Object::* set_string_t)(std::string const&);
typedef std::string (Object::* get_string_t)() const;
typedef void (Object::* set_fname_t)(std::string const&);
typedef std::string (Object::* get_fname_t)() const;
typedef void (Object::* set_vector_double_t)(std::vector<double> const&);
typedef std::vector<double> (Object::* get_vector_double_t)() const;
typedef void (Object::* set_vector_double_unit_t)(std::vector<double> const&, std::string const &);
typedef std::vector<double> (Object::* get_vector_double_unit_t)(std::string const &) const;
typedef void (Object::* set_vector_unsigned_long_t)(std::vector<unsigned long> const&);
typedef std::vector<unsigned long> (Object::* get_vector_unsigned_long_t)() const;
typedef void (Object::* set_metric_t)
(Gyoto::SmartPointer<Gyoto::Metric::Generic>);
typedef Gyoto::SmartPointer<Gyoto::Metric::Generic>
(Object::* get_metric_t)() const;
typedef void (Object::* set_screen_t)
(Gyoto::SmartPointer<Gyoto::Screen>);
typedef Gyoto::SmartPointer<Gyoto::Screen>
(Object::* get_screen_t)() const;
typedef void (Object::* set_astrobj_t)
(Gyoto::SmartPointer<Gyoto::Astrobj::Generic>);
typedef Gyoto::SmartPointer<Gyoto::Astrobj::Generic>
(Object::* get_astrobj_t)() const;
typedef void (Object::* set_spectrum_t)
(Gyoto::SmartPointer<Gyoto::Spectrum::Generic>);
typedef Gyoto::SmartPointer<Gyoto::Spectrum::Generic>
(Object::* get_spectrum_t)() const;
typedef void (Object::* set_spectrometer_t)
(Gyoto::SmartPointer<Gyoto::Spectrometer::Generic>);
typedef Gyoto::SmartPointer<Gyoto::Spectrometer::Generic>
(Object::* get_spectrometer_t)() const;
union setter_t {
set_double_t set_double;
set_long_t set_long;
set_unsigned_long_t set_unsigned_long;
set_size_t_t set_size_t;
set_bool_t set_bool;
set_string_t set_string;
set_vector_double_t set_vdouble;
set_vector_unsigned_long_t set_vulong;
set_metric_t set_metric;
set_screen_t set_screen;
set_astrobj_t set_astrobj;
set_spectrum_t set_spectrum;
set_spectrometer_t set_spectrometer;
};
union getter_t {
get_double_t get_double;
get_long_t get_long;
get_unsigned_long_t get_unsigned_long;
get_size_t_t get_size_t;
get_bool_t get_bool;
get_string_t get_string;
get_vector_double_t get_vdouble;
get_vector_unsigned_long_t get_vulong;
get_metric_t get_metric;
get_screen_t get_screen;
get_astrobj_t get_astrobj;
get_spectrum_t get_spectrum;
get_spectrometer_t get_spectrometer;
};
union setter_unit_t {
set_double_unit_t set_double;
set_vector_double_unit_t set_vdouble;
};
union getter_unit_t {
get_double_unit_t get_double;
get_vector_double_unit_t get_vdouble;
};
setter_t setter;
getter_t getter;
setter_unit_t setter_unit;
getter_unit_t getter_unit;
std::string doc;
operator bool() const ;
Property const * const parent;
Property();
Property(Property const * const ancestor);
Property(std::string classname, std::string doc="");
Property(std::string name,
set_long_t set_long,
get_long_t get_long,
std::string doc);
Property(std::string name,
set_unsigned_long_t set_unsigned_long,
get_unsigned_long_t get_unsigned_long,
std::string doc);
Property(std::string name,
set_size_t_t set_size_t,
get_size_t_t get_size_t,
int dummy,
std::string doc);
Property(std::string name,
set_double_t set_double,
get_double_t get_double,
std::string doc);
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);
Property(std::string name,
std::string name_false,
set_bool_t set_bool,
get_bool_t get_bool,
std::string doc);
Property(std::string name,
set_string_t set_string,
get_string_t get_string,
bool is_filename,
std::string doc);
Property(std::string name,
set_vector_double_t set_vdouble,
get_vector_double_t get_vdouble,
std::string doc);
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);
Property(std::string name,
set_vector_unsigned_long_t set_vulong,
get_vector_unsigned_long_t get_vulong,
std::string doc);
Property(std::string name,
set_metric_t set_metric,
get_metric_t get_metric,
std::string doc);
Property(std::string name,
set_screen_t set_screen,
get_screen_t get_screen,
std::string doc);
Property(std::string name,
set_astrobj_t set_astrobj,
get_astrobj_t get_astrobj,
std::string doc);
Property(std::string name,
set_spectrum_t set_spectrum,
get_spectrum_t get_spectrum,
std::string doc);
Property(std::string name,
set_spectrometer_t set_spectrometer,
get_spectrometer_t get_spectrometer,
std::string doc);
Property(std::string name, int type);
static type_e typeFromString(std::string stype);
};
#define GYOTO_PROPERTY_CHOOSER(x, A, B, C, D, E, F, FUNC, ...) FUNC
#define GYOTO_PROPERTY_START_DOC(class, doc) \
Property const class::properties[] = { \
Property (#class, doc),
#define GYOTO_PROPERTY_START_NODOC(class) \
GYOTO_PROPERTY_START_DOC(class, "")
#define GYOTO_PROPERTY_BOOL_DOC(class, name, namef, fname, doc) \
Gyoto::Property \
(#name, \
#namef, \
(Gyoto::Property::set_bool_t)&class :: fname, \
(Gyoto::Property::get_bool_t)&class :: fname, \
doc),
#define GYOTO_PROPERTY_BOOL_NODOC(class, name, namef, fname) \
GYOTO_PROPERTY_BOOL_DOC(class, name, namef, fname, "")
#define GYOTO_PROPERTY_DOUBLE_DOC(class, name, fname, doc) \
Gyoto::Property \
(#name, \
(Gyoto::Property::set_double_t)&class::fname, \
(Gyoto::Property::get_double_t)&class::fname, \
doc),
#define GYOTO_PROPERTY_DOUBLE_NODOC(class, name, fname) \
GYOTO_PROPERTY_DOUBLE_DOC(class, name, fname, "")
#define GYOTO_PROPERTY_LONG_DOC(class, name, fname, doc) \
Gyoto::Property \
(#name, \
(Gyoto::Property::set_long_t)&class::fname, \
(Gyoto::Property::get_long_t)&class::fname, \
doc),
#define GYOTO_PROPERTY_LONG_NODOC(class, name, fname) \
GYOTO_PROPERTY_LONG_DOC(class, name, fname, "")
#define GYOTO_PROPERTY_UNSIGNED_LONG_DOC(class, name, fname, doc) \
Gyoto::Property \
(#name, \
(Gyoto::Property::set_unsigned_long_t)&class::fname, \
(Gyoto::Property::get_unsigned_long_t)&class::fname, \
doc),
#define GYOTO_PROPERTY_UNSIGNED_LONG_NODOC(class, name, fname) \
GYOTO_PROPERTY_UNSIGNED_LONG_DOC(class, name, fname, "")
#define GYOTO_PROPERTY_SIZE_T_DOC(class, name, fname, doc) \
Gyoto::Property \
(#name, \
(Gyoto::Property::set_size_t_t)&class::fname, \
(Gyoto::Property::get_size_t_t)&class::fname, \
1, \
doc),
#define GYOTO_PROPERTY_SIZE_T_NODOC(class, name, fname) \
GYOTO_PROPERTY_SIZE_T_DOC(class, name, fname, "")
#define GYOTO_PROPERTY_DOUBLE_UNIT_DOC(class, name, fname, doc) \
Gyoto::Property \
(#name, \
(Gyoto::Property::set_double_t)&class::fname, \
(Gyoto::Property::get_double_t)&class::fname, \
(Gyoto::Property::set_double_unit_t)&class::fname, \
(Gyoto::Property::get_double_unit_t)&class::fname, \
doc),
#define GYOTO_PROPERTY_DOUBLE_UNIT_NODOC(class, name, fname) \
GYOTO_PROPERTY_DOUBLE_UNIT_DOC(class, name, fname, "")
#define GYOTO_PROPERTY_FILENAME_DOC(class, name, fname, doc) \
Gyoto::Property \
(#name, \
(Gyoto::Property::set_string_t)&class::fname, \
(Gyoto::Property::get_string_t)&class::fname, \
true, doc),
#define GYOTO_PROPERTY_FILENAME_NODOC(class, name, fname) \
GYOTO_PROPERTY_FILENAME_DOC(class, name, fname, "")
#define GYOTO_PROPERTY_STRING_DOC(class, name, fname, doc) \
Gyoto::Property \
(#name, \
(Gyoto::Property::set_string_t)&class::fname, \
(Gyoto::Property::get_string_t)&class::fname, \
false, doc),
#define GYOTO_PROPERTY_STRING_NODOC(class, name, fname) \
GYOTO_PROPERTY_STRING_DOC(class, name, fname, "")
#define GYOTO_PROPERTY_VECTOR_DOUBLE_DOC(class, name, fname, doc) \
Gyoto::Property \
(#name, \
(Gyoto::Property::set_vector_double_t)&class::fname, \
(Gyoto::Property::get_vector_double_t)&class::fname, \
doc),
#define GYOTO_PROPERTY_VECTOR_DOUBLE_NODOC(class, name, fname) \
GYOTO_PROPERTY_VECTOR_DOUBLE_DOC(class, name, fname, "")
#define GYOTO_PROPERTY_VECTOR_DOUBLE_UNIT_DOC(class, name, fname, doc) \
Gyoto::Property \
(#name, \
(Gyoto::Property::set_vector_double_t)&class::fname, \
(Gyoto::Property::get_vector_double_t)&class::fname, \
(Gyoto::Property::set_vector_double_unit_t)&class::fname, \
(Gyoto::Property::get_vector_double_unit_t)&class::fname, \
doc),
#define GYOTO_PROPERTY_VECTOR_DOUBLE_UNIT_NODOC(class, name, fname) \
GYOTO_PROPERTY_VECTOR_DOUBLE_UNIT_DOC(class, name, fname, "")
#define GYOTO_PROPERTY_VECTOR_UNSIGNED_LONG_DOC(class, name, fname, doc) \
Gyoto::Property \
(#name, \
(Gyoto::Property::set_vector_unsigned_long_t)&class::fname, \
(Gyoto::Property::get_vector_unsigned_long_t)&class::fname, \
doc),
#define GYOTO_PROPERTY_VECTOR_UNSIGNED_LONG_NODOC(class, name, fname) \
GYOTO_PROPERTY_VECTOR_UNSIGNED_LONG_DOC(class, name, fname, "")
#define GYOTO_PROPERTY_METRIC_DOC(class, name, fname, doc) \
Gyoto::Property \
(#name, \
(Gyoto::Property::set_metric_t)&class::fname, \
(Gyoto::Property::get_metric_t)&class::fname, \
doc),
#define GYOTO_PROPERTY_METRIC_NODOC(class, name, fname) \
GYOTO_PROPERTY_METRIC_DOC(class, name, fname, "")
#define GYOTO_PROPERTY_SCREEN_DOC(class, name, fname, doc) \
Gyoto::Property \
(#name, \
(Gyoto::Property::set_screen_t)&class::fname, \
(Gyoto::Property::get_screen_t)&class::fname, \
doc),
#define GYOTO_PROPERTY_SCREEN_NODOC(class, name, fname) \
GYOTO_PROPERTY_SCREEN_DOC(class, name, fname, "")
#define GYOTO_PROPERTY_ASTROBJ_DOC(class, name, fname, doc) \
Gyoto::Property \
(#name, \
(Gyoto::Property::set_astrobj_t)&class::fname, \
(Gyoto::Property::get_astrobj_t)&class::fname, \
doc),
#define GYOTO_PROPERTY_ASTROBJ_NODOC(class, name, fname) \
GYOTO_PROPERTY_ASTROBJ_DOC(class, name, fname, "")
#define GYOTO_PROPERTY_SPECTRUM_DOC(class, name, fname, doc) \
Gyoto::Property \
(#name, \
(Gyoto::Property::set_spectrum_t)&class::fname, \
(Gyoto::Property::get_spectrum_t)&class::fname, \
doc),
#define GYOTO_PROPERTY_SPECTRUM_NODOC(class, name, fname) \
GYOTO_PROPERTY_SPECTRUM_DOC(class, name, fname, "")
#define GYOTO_PROPERTY_SPECTROMETER_DOC(class, name, fname, doc) \
Gyoto::Property \
(#name, \
(Gyoto::Property::set_spectrometer_t)&class::fname, \
(Gyoto::Property::get_spectrometer_t)&class::fname, \
doc),
#define GYOTO_PROPERTY_SPECTROMETER_NODOC(class, name, fname) \
GYOTO_PROPERTY_SPECTROMETER_DOC(class, name, fname, "")
// \endcond INTERNAL
#endif
GyotoConfig.h
Compile-time configuration.
size_t
#define size_t
If not defined in <sys/types.h>.
Definition GyotoConfig.h:390
Gyoto::Astrobj::Generic
Base class for astronomical object.
Definition GyotoAstrobj.h:200
Gyoto::Metric::Generic
Base class for metrics.
Definition GyotoMetric.h:162
Gyoto::Object
Object with properties.
Definition GyotoObject.h:152
Gyoto::Property
Property that can be set and got using standard methods.
Definition GyotoProperty.h:608
Gyoto::Property::set_long_t
void(Object::* set_long_t)(long val)
Prototype for an accessor to set a long.
Definition GyotoProperty.h:681
Gyoto::Property::set_size_t_t
void(Object::* set_size_t_t)(size_t val)
Prototype for an accessor to set a size_t.
Definition GyotoProperty.h:689
Gyoto::Property::set_metric_t
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
Gyoto::Property::typeFromString
static type_e typeFromString(std::string stype)
Get Property::type_e value from name.
Gyoto::Property::set_spectrometer_t
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
Gyoto::Property::Property
Property()
Default constructor.
Gyoto::Property::get_size_t_t
size_t(Object::* get_size_t_t)() const
Prototype for an accessor to get a size_t.
Definition GyotoProperty.h:691
Gyoto::Property::get_string_t
std::string(Object::* get_string_t)() const
Prototype for an accessor to get a string.
Definition GyotoProperty.h:699
Gyoto::Property::get_vector_double_t
std::vector< double >(Object::* get_vector_double_t)() const
Prototype for an accessor to get a std::vector<double>.
Definition GyotoProperty.h:707
Gyoto::Property::get_spectrum_t
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
Gyoto::Property::setter
setter_t setter
Pointer to the setter method.
Definition GyotoProperty.h:808
Gyoto::Property::get_metric_t
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
Gyoto::Property::Property
Property(std::string name, set_spectrum_t set_spectrum, get_spectrum_t get_spectrum, std::string doc)
Constructor for type==spectrum_t.
Gyoto::Property::get_unsigned_long_t
unsigned long(Object::* get_unsigned_long_t)() const
Prototype for an accessor to get an unsigned long.
Definition GyotoProperty.h:687
Gyoto::Property::set_spectrum_t
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
Gyoto::Property::set_vector_double_t
void(Object::* set_vector_double_t)(std::vector< double > const &)
Prototype for an accessor to set a std::vector<double>.
Definition GyotoProperty.h:705
Gyoto::Property::Property
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.
Gyoto::Property::set_vector_double_unit_t
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
Gyoto::Property::Property
Property(std::string name, set_astrobj_t set_astrobj, get_astrobj_t get_astrobj, std::string doc)
Constructor for type==astrobj_t.
Gyoto::Property::Property
Property(Property const *const ancestor)
Constructor for type==empty_t.
Gyoto::Property::get_double_unit_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
Gyoto::Property::set_double_t
void(Object::* set_double_t)(double val)
Prototype for an accessor to set a double.
Definition GyotoProperty.h:672
Gyoto::Property::get_long_t
long(Object::* get_long_t)() const
Prototype for an accessor to get a long.
Definition GyotoProperty.h:683
Gyoto::Property::Property
Property(std::string classname, std::string doc="")
Constructor for class name pseudo-property.
Gyoto::Property::get_astrobj_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
Gyoto::Property::set_unsigned_long_t
void(Object::* set_unsigned_long_t)(unsigned long val)
Prototype for an accessor to set an unsigned long.
Definition GyotoProperty.h:685
Gyoto::Property::get_bool_t
bool(Object::* get_bool_t)() const
Prototype for an accessor to get a bool.
Definition GyotoProperty.h:695
Gyoto::Property::Property
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.
Gyoto::Property::getter
getter_t getter
Pointer to the getter method.
Definition GyotoProperty.h:813
Gyoto::Property::set_string_t
void(Object::* set_string_t)(std::string const &)
Prototype for an accessor to set a string.
Definition GyotoProperty.h:697
Gyoto::Property::type_e
type_e
Possible type of a Property instance.
Definition GyotoProperty.h:616
Gyoto::Property::size_t_t
@ size_t_t
Type is size_t (only if distinct from unsigned long).
Definition GyotoProperty.h:624
Gyoto::Property::vector_unsigned_long_t
@ vector_unsigned_long_t
Type is std::vector<unsigned long>.
Definition GyotoProperty.h:642
Gyoto::Property::double_t
@ double_t
Type is double.
Definition GyotoProperty.h:618
Gyoto::Property::metric_t
@ metric_t
Type is Gyoto::SmartPointer<Gyoto::Metric::Generic>.
Definition GyotoProperty.h:644
Gyoto::Property::bool_t
@ bool_t
Type is bool.
Definition GyotoProperty.h:626
Gyoto::Property::astrobj_t
@ astrobj_t
Type is Gyoto::SmartPointer<Gyoto::Astrobj::Generic>.
Definition GyotoProperty.h:648
Gyoto::Property::filename_t
@ filename_t
Type is std::string and holds a file name.
Definition GyotoProperty.h:638
Gyoto::Property::spectrometer_t
@ spectrometer_t
Type is Gyoto::SmartPointer<Gyoto::Spectrometer::Generic>.
Definition GyotoProperty.h:652
Gyoto::Property::empty_t
@ empty_t
Property is empty.
Definition GyotoProperty.h:661
Gyoto::Property::spectrum_t
@ spectrum_t
Type is Gyoto::SmartPointer<Gyoto::Spectrum::Generic>.
Definition GyotoProperty.h:650
Gyoto::Property::string_t
@ string_t
Type is std::string.
Definition GyotoProperty.h:628
Gyoto::Property::unsigned_long_t
@ unsigned_long_t
Type is unsigned long (a.k.a. size_t).
Definition GyotoProperty.h:622
Gyoto::Property::screen_t
@ screen_t
Type is Gyoto::SmartPointer<Gyoto::Screen::Generic>.
Definition GyotoProperty.h:646
Gyoto::Property::long_t
@ long_t
Type is long.
Definition GyotoProperty.h:620
Gyoto::Property::vector_double_t
@ vector_double_t
Type is std::vector<double>.
Definition GyotoProperty.h:640
Gyoto::Property::Property
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::Property::Property
Property(std::string name, set_screen_t set_screen, get_screen_t get_screen, std::string doc)
Constructor for type==screen_t.
Gyoto::Property::Property
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.
Gyoto::Property::set_screen_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
Gyoto::Property::setter_unit
setter_unit_t setter_unit
Pointer to the setter (with unit) method.
Definition GyotoProperty.h:818
Gyoto::Property::get_vector_double_unit_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
Gyoto::Property::Property
Property(std::string name, set_long_t set_long, get_long_t get_long, std::string doc)
Constructor for type==long_t.
Gyoto::Property::get_spectrometer_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
Gyoto::Property::Property
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.
Gyoto::Property::set_fname_t
void(Object::* set_fname_t)(std::string const &)
Prototype for an accessor to set a filename.
Definition GyotoProperty.h:701
Gyoto::Property::Property
Property(std::string name, set_metric_t set_metric, get_metric_t get_metric, std::string doc)
Constructor for type==metric_t.
Gyoto::Property::set_double_unit_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
Gyoto::Property::name
std::string name
Name of this instance.
Definition GyotoProperty.h:663
Gyoto::Property::parent
Property const *const parent
If type is empty_t, link to another Property list.
Definition GyotoProperty.h:831
Gyoto::Property::Property
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.
Gyoto::Property::get_fname_t
std::string(Object::* get_fname_t)() const
Prototype for an accessor to get a filename.
Definition GyotoProperty.h:703
Gyoto::Property::name_false
std::string name_false
Name if false.
Definition GyotoProperty.h:668
Gyoto::Property::Property
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.
Gyoto::Property::Property
Property(std::string name, int type)
Constructor setting only name and type.
Gyoto::Property::set_bool_t
void(Object::* set_bool_t)(bool val)
Prototype for an accessor to set a bool.
Definition GyotoProperty.h:693
Gyoto::Property::get_vector_unsigned_long_t
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
Gyoto::Property::get_double_t
double(Object::* get_double_t)() const
Prototype for an accessor to get a double.
Definition GyotoProperty.h:674
Gyoto::Property::get_screen_t
Gyoto::SmartPointer< Gyoto::Screen >(Object::* get_screen_t)() const
Prototype for an accessor to get a Gyoto::SmartPointer<Gyoto::Screen>.
Definition GyotoProperty.h:729
Gyoto::Property::getter_unit
getter_unit_t getter_unit
Pointer to the getter (with unit) method.
Definition GyotoProperty.h:823
Gyoto::Property::Property
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.
Gyoto::Property::Property
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.
Gyoto::Property::Property
Property(std::string name, set_spectrometer_t set_spectrometer, get_spectrometer_t get_spectrometer, std::string doc)
Constructor for type==spectrometer_t.
Gyoto::Property::set_astrobj_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
Gyoto::Property::set_vector_unsigned_long_t
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::Property::type
int type
Type of this instance.
Definition GyotoProperty.h:670
Gyoto::Screen
The camera with which the Astrobj is observed.
Definition GyotoScreen.h:176
Gyoto::SmartPointer
Pointers performing reference counting.
Definition GyotoSmartPointer.h:135
Gyoto::Spectrometer::Generic
Base class for spectrometers.
Definition GyotoSpectrometer.h:186
Gyoto::Spectrum::Generic
Spectrum emitted by an Astrobj.
Definition GyotoSpectrum.h:137
Gyoto::Astrobj
Access to astronomical objects.
Definition GyotoAstrobj.h:49
Gyoto::Metric
Access to metrics.
Definition GyotoAstrobj.h:47
Gyoto::Spectrometer
Access to spectrometers.
Definition GyotoComplexSpectrometer.h:34
Gyoto::Spectrum
Spectrum of a simple object (e.g. a Gyoto::Astrobj::Star).
Definition GyotoBlackBodySpectrum.h:35
Gyoto
Namespace for the Gyoto library.
Definition GyotoAstrobj.h:44
Gyoto::Property::getter_t
Union holding an accessor to get any type.
Definition GyotoProperty.h:775
Gyoto::Property::getter_unit_t
Union holding an accessor to get double or vector<double> with unit.
Definition GyotoProperty.h:799
Gyoto::Property::setter_t
Union holding an accessor to set any type.
Definition GyotoProperty.h:756
Gyoto::Property::setter_unit_t
Union holding an accessor to set double or vector<double> with unit.
Definition GyotoProperty.h:794