Gyoto
Classes | Namespaces | Macros
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::SmartPointer< T >
 Pointers performing reference counting. More...
 
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

 Gyoto
 Namespace for the Gyoto library.
 
 Gyoto::Metric
 Access to metrics.
 
 Gyoto::Astrobj
 Access to astronomical objects.
 
 Gyoto::Spectrum
 Spectrum of a simple object (e.g. a Gyoto::Astrobj::Star)
 
 Gyoto::Spectrometer
 Access to spectrometers.
 

Macros

#define GYOTO_PROPERTY_ACCESSORS(class, type, member, method)
 Define a pair of accessors to scalar member (double, long, size_t) More...
 
#define GYOTO_PROPERTY_ACCESSORS_GEOMETRICAL(class, member, method, metric)
 Define 4 accessors to double scalar member in geometrical units. More...
 
#define GYOTO_PROPERTY_START(class)   Property const class::properties[] = {
 Start Property list. More...
 
#define GYOTO_PROPERTY_BOOL(class, name, namef, fname)
 Define a new Property of type Bool. More...
 
#define GYOTO_PROPERTY_DOUBLE(class, name, fname)
 Define a Property of type Double. More...
 
#define GYOTO_PROPERTY_LONG(class, name, fname)
 Define a Property of type Long. More...
 
#define GYOTO_PROPERTY_UNSIGNED_LONG(class, name, fname)
 Define a Property of type Long. More...
 
#define GYOTO_PROPERTY_SIZE_T   GYOTO_PROPERTY_UNSIGNED_LONG
 
#define GYOTO_PROPERTY_DOUBLE_UNIT(class, name, fname)
 Define a Property of type Double supporting unit. More...
 
#define GYOTO_PROPERTY_FILENAME(class, name, fname)
 Define a Property of type Filename. More...
 
#define GYOTO_PROPERTY_STRING(class, name, fname)
 Define a Property of type String. More...
 
#define GYOTO_PROPERTY_VECTOR_DOUBLE(class, name, fname)
 Define a Property of type vector<double> More...
 
#define GYOTO_PROPERTY_VECTOR_DOUBLE_UNIT(class, name, fname)
 Define a Property of type vector<double> with unit support. More...
 
#define GYOTO_PROPERTY_VECTOR_UNSIGNED_LONG(class, name, fname)
 Define a Property of type vector<unsigned long> More...
 
#define GYOTO_PROPERTY_METRIC(class, name, fname)
 Define a Property of type Gyoto::Metric::Generic. More...
 
#define GYOTO_PROPERTY_SCREEN(class, name, fname)
 Define a Property of type Gyoto::Screen. More...
 
#define GYOTO_PROPERTY_ASTROBJ(class, name, fname)
 Define a Property of type Gyoto::Astrobj::Generic. More...
 
#define GYOTO_PROPERTY_SPECTRUM(class, name, fname)
 Define a Property of type Gyoto::Spectrum::Generic. More...
 
#define GYOTO_PROPERTY_SPECTROMETER(class, name, fname)
 Define a Property of type Gyoto::Spectrometer::Generic. More...
 
#define GYOTO_PROPERTY_END(class, next)
 Define class::properties and class::getProperties() More...
 

Detailed Description

Introspectable properties.

Macro Definition 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); \
}
double ToGeometrical(double value, const std::string &unit, const Gyoto::SmartPointer< Gyoto::Metric::Generic > &gg)
Convert from arbitrary length unit to geometrical units.
double FromGeometrical(double value, const std::string &unit, const Gyoto::SmartPointer< Gyoto::Metric::Generic > &gg)
Convert to arbitrary length unit from geometrical units.
#define GYOTO_PROPERTY_ACCESSORS(class, type, member, method)
Define a pair of accessors to scalar member (double, long, size_t)
Definition: GyotoProperty.h:50

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
classclass name
membermember holding the value in geometrical unit
methodname for accessors member or expression yielding metric (which defines the geometrical unit)
#define GYOTO_PROPERTY_ASTROBJ (   class,
  name,
  fname 
)
Value:
(#name, \
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_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

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

#define GYOTO_PROPERTY_BOOL (   class,
  name,
  namef,
  fname 
)
Value:
(#name, \
#namef, \
(Gyoto::Property::set_bool_t)&class :: fname, \
(Gyoto::Property::get_bool_t)&class :: fname),
Property that can be set and got using standard methods.
Definition: GyotoProperty.h:313

Define a new Property of type Bool.

#define GYOTO_PROPERTY_DOUBLE (   class,
  name,
  fname 
)
Value:
(#name, \
double(Object::* get_double_t)() const
Prototype for an accessor to get a double.
Definition: GyotoProperty.h:382
Property that can be set and got using standard methods.
Definition: GyotoProperty.h:313
void(Object::* set_double_t)(double val)
Prototype for an accessor to set a double.
Definition: GyotoProperty.h:380

Define a Property of type Double.

#define GYOTO_PROPERTY_DOUBLE_UNIT (   class,
  name,
  fname 
)
Value:
(#name, \
double(Object::* get_double_t)() const
Prototype for an accessor to get a double.
Definition: GyotoProperty.h:382
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
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
Property that can be set and got using standard methods.
Definition: GyotoProperty.h:313
void(Object::* set_double_t)(double val)
Prototype for an accessor to set a double.
Definition: GyotoProperty.h:380

Define a Property of type Double supporting unit.

#define GYOTO_PROPERTY_END (   class,
  next 
)
Value:
Property(next)}; \
Gyoto::Property const * class::getProperties() const { \
return class::properties; \
}

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

#define GYOTO_PROPERTY_FILENAME (   class,
  name,
  fname 
)
Value:
(#name, \
true),
void(Object::* set_string_t)(std::string const &)
Prototype for an accessor to set a string.
Definition: GyotoProperty.h:407
Property that can be set and got using standard methods.
Definition: GyotoProperty.h:313
std::string(Object::* get_string_t)() const
Prototype for an accessor to get a string.
Definition: GyotoProperty.h:409

Define a Property of type Filename.

#define GYOTO_PROPERTY_LONG (   class,
  name,
  fname 
)
Value:
(#name, \
(Gyoto::Property::set_long_t)&class::fname, \
(Gyoto::Property::get_long_t)&class::fname),
long(Object::* get_long_t)() const
Prototype for an accessor to get a long.
Definition: GyotoProperty.h:391
void(Object::* set_long_t)(long val)
Prototype for an accessor to set a long.
Definition: GyotoProperty.h:389
Property that can be set and got using standard methods.
Definition: GyotoProperty.h:313

Define a Property of type Long.

#define GYOTO_PROPERTY_METRIC (   class,
  name,
  fname 
)
Value:
(#name, \
void(Object::* set_metric_t)(Gyoto::SmartPointer< Gyoto::Metric::Generic >)
Prototype for an accessor to set a Gyoto::SmartPointer
Definition: GyotoProperty.h:429
Property that can be set and got using standard methods.
Definition: GyotoProperty.h:313
Gyoto::SmartPointer< Gyoto::Metric::Generic >(Object::* get_metric_t)() const
Prototype for an accessor to get a Gyoto::SmartPointer
Definition: GyotoProperty.h:432

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

#define GYOTO_PROPERTY_SCREEN (   class,
  name,
  fname 
)
Value:
(#name, \
Property that can be set and got using standard methods.
Definition: GyotoProperty.h:313
Gyoto::SmartPointer< Gyoto::Screen >(Object::* get_screen_t)() const
Prototype for an accessor to get a Gyoto::SmartPointer
Definition: GyotoProperty.h:439
void(Object::* set_screen_t)(Gyoto::SmartPointer< Gyoto::Screen >)
Prototype for an accessor to set a Gyoto::SmartPointer
Definition: GyotoProperty.h:436

Define a Property of type Gyoto::Screen.

#define GYOTO_PROPERTY_SPECTROMETER (   class,
  name,
  fname 
)
Value:
(#name, \
Gyoto::SmartPointer< Gyoto::Spectrometer::Generic >(Object::* get_spectrometer_t)() const
Prototype for an accessor to get a Gyoto::SmartPointer ...
Definition: GyotoProperty.h:460
Property that can be set and got using standard methods.
Definition: GyotoProperty.h:313
void(Object::* set_spectrometer_t)(Gyoto::SmartPointer< Gyoto::Spectrometer::Generic >)
Prototype for an accessor to set a Gyoto::SmartPointer ...
Definition: GyotoProperty.h:457

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

#define GYOTO_PROPERTY_SPECTRUM (   class,
  name,
  fname 
)
Value:
(#name, \
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
Property that can be set and got using standard methods.
Definition: GyotoProperty.h:313

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

#define GYOTO_PROPERTY_START (   class)    Property const class::properties[] = {

Start Property list.

Parameters
classClass for which we are defining a Property list
#define GYOTO_PROPERTY_STRING (   class,
  name,
  fname 
)
Value:
(#name, \
false),
void(Object::* set_string_t)(std::string const &)
Prototype for an accessor to set a string.
Definition: GyotoProperty.h:407
Property that can be set and got using standard methods.
Definition: GyotoProperty.h:313
std::string(Object::* get_string_t)() const
Prototype for an accessor to get a string.
Definition: GyotoProperty.h:409

Define a Property of type String.

#define GYOTO_PROPERTY_UNSIGNED_LONG (   class,
  name,
  fname 
)
Value:
(#name, \
unsigned long(Object::* get_unsigned_long_t)() const
Prototype for an accessor to get an unsigned long.
Definition: GyotoProperty.h:395
Property that can be set and got using standard methods.
Definition: GyotoProperty.h:313
void(Object::* set_unsigned_long_t)(unsigned long val)
Prototype for an accessor to set an unsigned long.
Definition: GyotoProperty.h:393

Define a Property of type Long.

#define GYOTO_PROPERTY_VECTOR_DOUBLE (   class,
  name,
  fname 
)
Value:
(#name, \
Property that can be set and got using standard methods.
Definition: GyotoProperty.h:313
std::vector< double >(Object::* get_vector_double_t)() const
Prototype for an accessor to get a std::vector
Definition: GyotoProperty.h:417
void(Object::* set_vector_double_t)(std::vector< double > const &)
Prototype for an accessor to set a std::vector
Definition: GyotoProperty.h:415

Define a Property of type vector<double>

#define GYOTO_PROPERTY_VECTOR_DOUBLE_UNIT (   class,
  name,
  fname 
)
Value:
(#name, \
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
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
std::vector< double >(Object::* get_vector_double_t)() const
Prototype for an accessor to get a std::vector
Definition: GyotoProperty.h:417
void(Object::* set_vector_double_t)(std::vector< double > const &)
Prototype for an accessor to set a std::vector
Definition: GyotoProperty.h:415

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

#define GYOTO_PROPERTY_VECTOR_UNSIGNED_LONG (   class,
  name,
  fname 
)
Value:
(#name, \
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_vector_unsigned_long_t)(std::vector< unsigned long > const &)
Prototype for an accessor to set a std::vector
Definition: GyotoProperty.h:423
Property that can be set and got using standard methods.
Definition: GyotoProperty.h:313

Define a Property of type vector<unsigned long>