Gyoto
|
Base class for classes in the Python plug-in. More...
#include <GyotoPython.h>
Public Member Functions | |
Base (const Base &) | |
virtual std::string | module () const |
Return module_. More... | |
virtual std::string | inlineModule () const |
Return inline_module_. More... | |
virtual void | module (const std::string &) |
Set module_ and import the Python module. More... | |
virtual void | inlineModule (const std::string &) |
Set inline_module_ and import the Python module. More... | |
virtual std::string | klass () const |
Retrieve class_. More... | |
virtual void | klass (const std::string &c) |
Set class_ and instantiate the Python class. More... | |
virtual std::vector< double > | parameters () const |
Retrieve parameters_. More... | |
virtual void | parameters (const std::vector< double > &) |
Set parameters_ and send them to pInstance_. More... | |
Protected Attributes | |
std::string | module_ |
Name of the Python module that holds the class. More... | |
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. More... | |
std::vector< double > | parameters_ |
Parameters that this class needs. More... | |
PyObject * | pModule_ |
Reference to the python module once it has been loaded. | |
PyObject * | pInstance_ |
Reference to the python instance once it has been instantiated. | |
Base class for classes in the Python plug-in.
All classes have those three Properties:
All the Gyoto instances of the classes descending from Gyoto::Python::Base expose themselves to the Python instance they wrap immediately after instantiation by setting the 'this' attribute. If the 'gyoto' Python extension can be loaded, then 'this' will be an instance of one of the classes gyoto.Metric, gyoto.Spectrum, gyoto.StandardAstrobj or gyoto.ThinDisk pointing to the underlying C++ instance. If the 'gyoto' extension is not available, 'this' will be None.
|
virtual |
Return inline_module_.
Reimplemented in Gyoto::Spectrum::Python, Gyoto::Metric::Python, Gyoto::Astrobj::Python::Standard, and Gyoto::Astrobj::Python::ThinDisk.
|
virtual |
Set inline_module_ and import the Python module.
Side effects:
Reimplemented in Gyoto::Spectrum::Python, Gyoto::Metric::Python, Gyoto::Astrobj::Python::Standard, and Gyoto::Astrobj::Python::ThinDisk.
|
virtual |
Retrieve class_.
Reimplemented in Gyoto::Spectrum::Python, Gyoto::Metric::Python, Gyoto::Astrobj::Python::Standard, and Gyoto::Astrobj::Python::ThinDisk.
|
virtual |
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::Spectrum::Python, Gyoto::Metric::Python, Gyoto::Astrobj::Python::Standard, and Gyoto::Astrobj::Python::ThinDisk.
|
virtual |
Return module_.
Reimplemented in Gyoto::Spectrum::Python, Gyoto::Metric::Python, Gyoto::Astrobj::Python::Standard, and Gyoto::Astrobj::Python::ThinDisk.
|
virtual |
Set module_ and import the Python module.
Side effects:
Reimplemented in Gyoto::Spectrum::Python, Gyoto::Metric::Python, Gyoto::Astrobj::Python::Standard, and Gyoto::Astrobj::Python::ThinDisk.
|
virtual |
Retrieve parameters_.
Reimplemented in Gyoto::Spectrum::Python, Gyoto::Metric::Python, Gyoto::Astrobj::Python::Standard, and Gyoto::Astrobj::Python::ThinDisk.
|
virtual |
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::Spectrum::Python, Gyoto::Metric::Python, Gyoto::Astrobj::Python::Standard, and Gyoto::Astrobj::Python::ThinDisk.
|
protected |
|
protected |
|
protected |