GyotoProperty.h File Reference

Introspectable properties. More...

#include "GyotoConfig.h"
#include <string>
#include <vector>

Go to the source code of this file.

Classes

class  Gyoto::Property
 Property that can be set and got using standard methods. More...
union  Gyoto::Property::setter_t
 Union holding an accessor to set any type. More...
union  Gyoto::Property::getter_t
 Union holding an accessor to get any type. More...
union  Gyoto::Property::setter_unit_t
 Union holding an accessor to set double or vector<double> with unit. More...
union  Gyoto::Property::getter_unit_t
 Union holding an accessor to get double or vector<double> with unit. More...

Namespaces

namespace  Gyoto
 

Namespace for the Gyoto library.


namespace  Gyoto::Metric
 

Access to metrics.


namespace  Gyoto::Astrobj
 

Access to astronomical objects.


namespace  Gyoto::Spectrum
 

Spectrum of a simple object (e.g. a Gyoto::Astrobj::Star).


namespace  Gyoto::Spectrometer
 

Access to spectrometers.


Defines

#define GYOTO_PROPERTY_THREAD_UNSAFE(class)   bool class::isThreadSafe() const {return false;}
 Define the class as not beeing thread-safe.
#define GYOTO_PROPERTY_ACCESSORS(class, type, member, method)
 Define a pair of accessors to scalar member (double, long, size_t).
#define GYOTO_PROPERTY_ACCESSORS_SPECIAL(class, type, member, method, set, get)
 Define a pair of accessors to scalar member (double, long, size_t).
#define GYOTO_PROPERTY_ACCESSORS_GEOMETRICAL(class, member, method, metric)
 Define 4 accessors to double scalar member in geometrical units.
#define GYOTO_PROPERTY_ACCESSORS_GEOMETRICAL_SPECIAL(class, member, method, metric, set, get)
 GYOTO_PROPERTY_ACCESSORS_GEOMETRICAL + GYOTO_PROPERTY_ACCESSORS_SPECIAL.
#define GYOTO_PROPERTY_ACCESSORS_UNIT(class, member, method, unit)
 Define 4 accessors to double scalar member in specified units.
#define GYOTO_PROPERTY_START(...)
 Start Property list.
#define GYOTO_PROPERTY_BOOL(...)
 Define a new Property of type bool.
#define GYOTO_PROPERTY_DOUBLE(...)
 Define a Property of type double.
#define GYOTO_PROPERTY_DOUBLE_UNIT(...)
 Define a Property of type double with unit.
#define GYOTO_PROPERTY_VECTOR_DOUBLE(...)
 Define a Property of type vector<double>.
#define GYOTO_PROPERTY_VECTOR_DOUBLE_UNIT(...)
 Define a Property of type vector<double> with unit.
#define GYOTO_PROPERTY_STRING(...)
 Define a Property of type String.
#define GYOTO_PROPERTY_FILENAME(...)
 Define a Property of type Filename.
#define GYOTO_PROPERTY_LONG(...)
 Define a Property of type long.
#define GYOTO_PROPERTY_UNSIGNED_LONG(...)
 Define a Property of type unsigned long.
#define GYOTO_PROPERTY_VECTOR_UNSIGNED_LONG(...)
 Define a Property of type vector<unsigned long>.
#define GYOTO_PROPERTY_SIZE_T(...)
 Define a Property of type size_t.
#define GYOTO_PROPERTY_METRIC(...)
 Define a Property of type Gyoto::Metric::Generic.
#define GYOTO_PROPERTY_SPECTRUM(...)
 Define a Property of type Gyoto::Spectrum::Generic.
#define GYOTO_PROPERTY_ASTROBJ(...)
 Define a Property of type Gyoto::Astrobj::Generic.
#define GYOTO_PROPERTY_SCREEN(...)
 Define a Property of type Gyoto::Screen.
#define GYOTO_PROPERTY_SPECTROMETER(...)
 Define a Property of type Gyoto::Spectrometer::Generic.
#define GYOTO_PROPERTY_END(class, next)
 Define class::properties and class::getProperties().

Detailed Description

Introspectable properties.


Define Documentation

#define GYOTO_PROPERTY_ACCESSORS ( class,
type,
member,
method   ) 
Value:
void class::method(type v) {member=v;}                          \
  type class::method() const {return member;}

Define a pair of accessors to scalar member (double, long, size_t).

Accessors must also be declared in the class declaration, which can be done using GYOTO_OBJECT_SCALAR_ACCESSORS.

#define GYOTO_PROPERTY_ACCESSORS_GEOMETRICAL ( class,
member,
method,
metric   ) 
Value:
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 4 accessors to double scalar member in geometrical units.

Accessors must also be declared in the class declaration, which can be done using GYOTO_OBJECT_ACCESSORS_UNIT.

Parameters:
class class name
member member holding the value in geometrical unit
method name for accessors member or expression yielding metric (which defines the geometrical unit)
#define GYOTO_PROPERTY_ACCESSORS_GEOMETRICAL_SPECIAL ( class,
member,
method,
metric,
set,
get   ) 
Value:
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);                   \
  }

GYOTO_PROPERTY_ACCESSORS_GEOMETRICAL + GYOTO_PROPERTY_ACCESSORS_SPECIAL.

Accessors must also be declared in the class declaration, which can be done using GYOTO_OBJECT_ACCESSORS_UNIT.

Parameters:
class class name
member member holding the value in geometrical unit
method name for accessors member or expression yielding metric (which defines the geometrical unit)
#define GYOTO_PROPERTY_ACCESSORS_SPECIAL ( class,
type,
member,
method,
set,
get   ) 
Value:
void class::method(type v) {member=v; set }                             \
  type class::method() const {get ; return member;}

Define a pair of accessors to scalar member (double, long, size_t).

Accessors must also be declared in the class declaration, which can be done using GYOTO_OBJECT_SCALAR_ACCESSORS.

This version allows performing sepcial actions in the accessors, in addition to the usual stuff.

#define GYOTO_PROPERTY_ACCESSORS_UNIT ( class,
member,
method,
unit   ) 
Value:
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 4 accessors to double scalar member in specified units.

Accessors must also be declared in the class declaration, which can be done using GYOTO_OBJECT_ACCESSORS_UNIT.

Parameters:
class class name
member member holding the value in specified unit
method name for accessors unit
#define GYOTO_PROPERTY_ASTROBJ ( ...   ) 
Value:
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                                \
                         )

Define a Property of type Gyoto::Astrobj::Generic.

#define GYOTO_PROPERTY_BOOL ( ...   ) 
Value:
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"                    \
                         )

Define a new Property of type bool.

#define GYOTO_PROPERTY_DOUBLE ( ...   ) 
Value:
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                        \
                         )

Define a Property of type double.

#define GYOTO_PROPERTY_DOUBLE_UNIT ( ...   ) 
Value:
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                        \
                         )

Define a Property of type double with unit.

#define GYOTO_PROPERTY_END ( class,
next   ) 
Value:
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;                                                  \
  }

Define class::properties and class::getProperties().

#define GYOTO_PROPERTY_FILENAME ( ...   ) 
Value:
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                                \
                         )

Define a Property of type Filename.

#define GYOTO_PROPERTY_LONG ( ...   ) 
Value:
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                                \
                         )

Define a Property of type long.

#define GYOTO_PROPERTY_METRIC ( ...   ) 
Value:
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                                \
                         )

Define a Property of type Gyoto::Metric::Generic.

#define GYOTO_PROPERTY_SCREEN ( ...   ) 
Value:
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                                \
                         )

Define a Property of type Gyoto::Screen.

#define GYOTO_PROPERTY_SIZE_T ( ...   ) 
Value:
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                                \
                         )

Define a Property of type size_t.

#define GYOTO_PROPERTY_SPECTROMETER ( ...   ) 
Value:
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 a Property of type Gyoto::Spectrometer::Generic.

#define GYOTO_PROPERTY_SPECTRUM ( ...   ) 
Value:
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                                \
                         )

Define a Property of type Gyoto::Spectrum::Generic.

#define GYOTO_PROPERTY_START ( ...   ) 
Value:
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"                    \
                         )

Start Property list.

Parameters:
class Class for which we are defining a Property list
doc Documentation for this class. Optional but recommended.
#define GYOTO_PROPERTY_STRING ( ...   ) 
Value:
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                                \
                         )

Define a Property of type String.

#define GYOTO_PROPERTY_THREAD_UNSAFE ( class   )     bool class::isThreadSafe() const {return false;}

Define the class as not beeing thread-safe.

See also GYOTO_OBJECT_THREAD_SAFETY

#define GYOTO_PROPERTY_UNSIGNED_LONG ( ...   ) 
Value:
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                                \
                         )

Define a Property of type unsigned long.

#define GYOTO_PROPERTY_VECTOR_DOUBLE ( ...   ) 
Value:
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                                \
                         )

Define a Property of type vector<double>.

#define GYOTO_PROPERTY_VECTOR_DOUBLE_UNIT ( ...   ) 
Value:
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                                \
                         )

Define a Property of type vector<double> with unit.

#define GYOTO_PROPERTY_VECTOR_UNSIGNED_LONG ( ...   ) 
Value:
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                                \
                         )

Define a Property of type vector<unsigned long>.


Generated on 6 May 2017 for Gyoto by  doxygen 1.6.1