Gyoto::Python::Object< O > Class Template Reference

Class template to implement parts of the Gyoto::Object API. More...

`#include <GyotoPython.h>`

Inheritance diagram for Gyoto::Python::Object< O >:

## Public Member Functions

| Object (const Object &o)
virtual void | set (std::string const &key, Value val)
virtual void | set (Property const &p, Value val)
virtual void | set (Property const &p, Value val, std::string const &unit)
virtual Value | get (std::string const &key) const
Value | get (Property const &p, std::string const &unit) const
Value | get (Property const &p) const
virtual int | setParameter (std::string name, std::string content, std::string unit)
virtual void | fillElement (Gyoto::FactoryMessenger *fmp) const
void | setParameters (Gyoto::FactoryMessenger *fmp)
virtual std::string | module () const
| Return module_.
virtual void | module (const std::string &)
| Set module_ and import the Python module.
virtual std::string | inlineModule () const
| Return inline_module_.
virtual void | inlineModule (const std::string &)
| Set inline_module_ and import the Python module.
virtual std::string | klass () const
| Retrieve class_.
virtual void | klass (const std::string &c)
| Set class_ and instantiate the Python class.
virtual std::vector< double > | parameters () const
| Retrieve parameters_.
virtual void | parameters (const std::vector< double > &)
| Set parameters_ and send them to pInstance_.
virtual bool | hasPythonProperty (std::string const &key) const
virtual void | setPythonProperty (std::string const &key, Value val)
virtual Value | getPythonProperty (std::string const &key) const
virtual int | pythonPropertyType (std::string const &key) const

## Protected Attributes

std::string | module_
| Name of the Python module that holds the class.
std::string | inline_module_
| Python source code for module that holds the class.
std::string | class_
| Name of the Python class that we want to expose.
std::vector< double > | parameters_
| Parameters that this class needs.
PyObject * | pModule_
| Reference to the python module once it has been loaded.
PyObject * | pInstance_
| Reference to the python instance once it has been instantiated.
PyObject * | pProperties_
| Reference to the properties member.
PyObject * | pSet_
| Reference to the (optional) Set method.
PyObject * | pGet_
| Reference to the (optional) Get method.

## Detailed Description

template<class O>
class Gyoto::Python::Object< O >

Class template to implement parts of the Gyoto::Object API.

## Member Function Documentation

## inlineModule() [1/2]

virtual std::string Gyoto::Python::Base::inlineModule | ( |  | ) | const

virtual inherited

Return inline_module_.

Reimplemented in Gyoto::Astrobj::Python::Standard, Gyoto::Astrobj::Python::ThinDisk, Gyoto::Metric::Python, and Gyoto::Spectrum::Python.

## inlineModule() [2/2]

virtual void Gyoto::Python::Base::inlineModule | ( | const std::string & |  | ) |

virtual inherited

Set inline_module_ and import the Python module.

Side effects:

- sets module_ to "";
- calls klass(class_) if class_ is already known, so module_ can be set (or reset) after class_.

Reimplemented in Gyoto::Astrobj::Python::Standard, Gyoto::Astrobj::Python::ThinDisk, Gyoto::Metric::Python, and Gyoto::Spectrum::Python.

## klass() [1/2]

virtual std::string Gyoto::Python::Base::klass | ( |  | ) | const

virtual inherited

Retrieve class_.

Reimplemented in Gyoto::Astrobj::Python::Standard, Gyoto::Astrobj::Python::ThinDisk, Gyoto::Metric::Python, and Gyoto::Spectrum::Python.

## klass() [2/2]

virtual void Gyoto::Python::Base::klass | ( | const std::string & | c | ) |

virtual inherited

Set class_ and instantiate the Python class.

Sets pInstance_.

This generic implementation takes care of the common ground, but does not set 'this' or call parameters(parameters_). Therefore, all the derived classes should reimplement this method and at least call Python::Base::klass(c) and parameters(parameters_). Between the two is the right moment to check that the Python class implements the required API and to cache PyObject* pointers to class methods.

Reimplemented in Gyoto::Astrobj::Python::Standard, Gyoto::Astrobj::Python::ThinDisk, Gyoto::Metric::Python, and Gyoto::Spectrum::Python.

## module() [1/2]

virtual std::string Gyoto::Python::Base::module | ( |  | ) | const

virtual inherited

Return module_.

Reimplemented in Gyoto::Astrobj::Python::Standard, Gyoto::Astrobj::Python::ThinDisk, Gyoto::Metric::Python, and Gyoto::Spectrum::Python.

## module() [2/2]

virtual void Gyoto::Python::Base::module | ( | const std::string & |  | ) |

virtual inherited

Set module_ and import the Python module.

Side effects:

- sets inline_module_ to "";
- calls klass(class_) if class_ is already known, so module_ can be set (or reset) after class_.

Reimplemented in Gyoto::Astrobj::Python::Standard, Gyoto::Astrobj::Python::ThinDisk, Gyoto::Metric::Python, and Gyoto::Spectrum::Python.

## parameters() [1/2]

virtual std::vector< double > Gyoto::Python::Base::parameters | ( |  | ) | const

virtual inherited

Retrieve parameters_.

Reimplemented in Gyoto::Astrobj::Python::Standard, Gyoto::Astrobj::Python::ThinDisk, Gyoto::Metric::Python, and Gyoto::Spectrum::Python.

## parameters() [2/2]

virtual void Gyoto::Python::Base::parameters | ( | const std::vector< double > & |  | ) |

virtual inherited

Set parameters_ and send them to pInstance_.

The parameters are sent to the class instance using the setitem method with numerical keys.

Reimplemented in Gyoto::Astrobj::Python::Standard, Gyoto::Astrobj::Python::ThinDisk, Gyoto::Metric::Python, and Gyoto::Spectrum::Python.

## Member Data Documentation

## class_

std::string Gyoto::Python::Base::class_

protected inherited

Name of the Python class that we want to expose.

Property name: Class.

## module_

std::string Gyoto::Python::Base::module_

protected inherited

Name of the Python module that holds the class.

For instance, if the class is implemented in toto.py, the module name is "toto". Property name: Module.

## parameters_

std::vector<double> Gyoto::Python::Base::parameters_

protected inherited

Parameters that this class needs.

A list of parameters (doubles) can be passed in the Property Parameters. They will be sent to the Python instance using setitem.

The documentation for this class was generated from the following file:

- GyotoPython.h