|
Gyoto
|
Class template to implement parts of the Gyoto::Object API. More...
#include <GyotoPython.h>
Public Member Functions | |
| Object (const Object &o) | |
| virtual bool | knowsProperty (const std::string &name) const |
| virtual void | set (std::string const &key, Value val) |
| virtual void | set (std::string const &key, Value val, std::string const &unit) |
| 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 |
| virtual Value | get (std::string const &key, std::string const &unit) 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 | fillProperty (Gyoto::FactoryMessenger *fmp, Property const &p) const |
| 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. More... | |
| virtual std::string | inlineModule () const |
| Return inline_module_. | |
| virtual void | inlineModule (const std::string &) |
| Set inline_module_ and import the Python module. More... | |
| virtual void | instance (PyObject *pinstance) |
| Set pInstance_. More... | |
| virtual std::string | klass () const |
| Retrieve class_. | |
| virtual void | klass (const std::string &c) |
| Set class_ and instantiate the Python class. More... | |
| virtual std::vector< double > | parameters () const |
| Retrieve parameters_. | |
| virtual void | parameters (const std::vector< double > &) |
| Set parameters_ and send them to pInstance_. More... | |
| virtual bool | hasPythonProperty (std::string const &key) const |
| virtual void | setPythonProperty (std::string const &key, Value val) |
| virtual void | setPythonProperty (std::string const &key, Value val, std::string const &unit) |
| virtual Value | getPythonProperty (std::string const &key) const |
| virtual Value | getPythonProperty (std::string const &key, std::string const &unit) const |
| virtual Gyoto::Property::type_e | pythonPropertyType (std::string const &key) const |
| void | checkModuleForSingleClass () |
| Look for single class in pModule_. More... | |
| virtual void | detachInstance () |
| Detach pInstance_ and cached method pointers. More... | |
| virtual void | attachInstance (PyObject *instance) |
| Attach pInstance_ and cached method pointers. More... | |
| PyObject * | instantiateClass (std::string &klass) const |
Creates an instance of class klass in module module_. 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. | |
| PyObject * | pProperties_ |
| Reference to the properties member. | |
| PyObject * | pSet_ |
| Reference to the (optional) Set method. | |
| PyObject * | pGet_ |
| Reference to the (optional) Get method. | |
Class template to implement parts of the Gyoto::Object API.
|
virtualinherited |
Attach pInstance_ and cached method pointers.
Attaches pInstance_, #pProperties, pSet_ and pGet_. Increments their reference counters.
Derived classes should call Base::attachInstance and attach the other pointers.
Reimplemented in Gyoto::Astrobj::Python::ThinDisk, Gyoto::Astrobj::Python::Standard, Gyoto::Metric::Python, and Gyoto::Spectrum::Python.
|
inherited |
|
virtualinherited |
Detach pInstance_ and cached method pointers.
Detaches (=calls Py_XDECREF and sets to NULL) #pProperties, pSet_ and pGet_.
Derived classes should detach the other pointers and call Base::detachInstance().
Reimplemented in Gyoto::Astrobj::Python::ThinDisk, Gyoto::Astrobj::Python::Standard, Gyoto::Metric::Python, and Gyoto::Spectrum::Python.
|
virtualinherited |
Set inline_module_ and import the Python module.
Side effects:
Reimplemented in Gyoto::Astrobj::Python::ThinDisk, Gyoto::Astrobj::Python::Standard, Gyoto::Metric::Python, and Gyoto::Spectrum::Python.
|
virtualinherited |
Set pInstance_.
Detach the previously set instance, sets pModule_ to nullptr and class_ to "", then calls attachInstance() if instance is not null.
|
inherited |
Creates an instance of class klass in module module_.
Returns a new reference.
|
virtualinherited |
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::ThinDisk, Gyoto::Astrobj::Python::Standard, Gyoto::Metric::Python, and Gyoto::Spectrum::Python.
|
virtualinherited |
Set module_ and import the Python module.
Side effects:
Reimplemented in Gyoto::Astrobj::Python::ThinDisk, Gyoto::Astrobj::Python::Standard, Gyoto::Metric::Python, and Gyoto::Spectrum::Python.
|
virtualinherited |
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::ThinDisk, Gyoto::Astrobj::Python::Standard, Gyoto::Metric::Python, and Gyoto::Spectrum::Python.
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
1.8.14