The PyHandler class This class is the base class of all FreeCAD classes which exports into the python space. More...
#include <PyExport.h>
Public Member Functions | |
PyObject * | getPyObject (void) const |
returns the type as PyObject | |
bool | IsNull (void) const |
Test if it not handels something. | |
bool | IsValid (void) const |
Test if it handels something. | |
const HandledType & | operator* () const |
derefrence operators | |
HandledType & | operator* () |
derefrence operators | |
const HandledType * | operator-> () const |
derefrence operators | |
HandledType * | operator-> () |
derefrence operators | |
bool | operator< (const PyHandle< HandledType > &other) const |
lower operator needed for sorting in maps and sets | |
PyHandle< HandledType > & | operator= (const PyHandle< HandledType > &other) |
PyHandle< HandledType > & | operator= (HandledType *other) |
bool | operator== (const PyHandle< HandledType > &other) const |
equal operator | |
PyHandle (const PyHandle< HandledType > &ToHandel) | |
Copy constructor. | |
PyHandle (HandledType *ToHandel=0L) | |
pointer and default constructor the good way would be not using pointer instead using a overwriten new operator in the HandledType class! But is not easy to inforce! | |
~PyHandle () | |
destructor Release the referenc count which cause, if was the last one, the referenced object to destruct! |
The PyHandler class This class is the base class of all FreeCAD classes which exports into the python space.
This class handles the creation referencing of the python export object.
E.g. if GetPyObject() always returns a new Python object then no increment is necessary, because at construction time the reference counter is already set to 1. If the Python interpreter stores this object pointer into a local variable and destroys this variable then the reference counter gets decremented (to 0) and the object gets destroyed automatically. In case we didn't make this specification and increment the Python object from outside once again then the reference counter would be set to 2 and there would be no chance to destroy the object again.
The other case is that we have a member variable in our C++ class that holds the Python object then we either can create this Python in the constructor or create it the first time when GetPyObject() gets called. In the destructor then we must decrement the Python object to avoid a memory leak while GetPyObject() then increments the Python object everytime it gets called.
Definition at line 104 of file PyExport.h.
Base::PyHandle< HandledType >::PyHandle | ( | HandledType * | ToHandel = 0L |
) | [inline] |
pointer and default constructor the good way would be not using pointer instead using a overwriten new operator in the HandledType class! But is not easy to inforce!
Definition at line 115 of file PyExport.h.
Base::PyHandle< HandledType >::PyHandle | ( | const PyHandle< HandledType > & | ToHandel | ) | [inline] |
Copy constructor.
Definition at line 122 of file PyExport.h.
Base::PyHandle< HandledType >::~PyHandle | ( | ) | [inline] |
destructor Release the referenc count which cause, if was the last one, the referenced object to destruct!
Definition at line 133 of file PyExport.h.
PyObject* Base::PyHandle< HandledType >::getPyObject | ( | void | ) | const [inline] |
returns the type as PyObject
Definition at line 199 of file PyExport.h.
bool Base::PyHandle< HandledType >::IsNull | ( | void | ) | const [inline] |
Test if it not handels something.
Definition at line 213 of file PyExport.h.
bool Base::PyHandle< HandledType >::IsValid | ( | void | ) | const [inline] |
Test if it handels something.
Definition at line 208 of file PyExport.h.
const HandledType& Base::PyHandle< HandledType >::operator* | ( | ) | const [inline] |
derefrence operators
Definition at line 173 of file PyExport.h.
HandledType& Base::PyHandle< HandledType >::operator* | ( | ) | [inline] |
derefrence operators
Definition at line 163 of file PyExport.h.
const HandledType* Base::PyHandle< HandledType >::operator-> | ( | ) | const [inline] |
derefrence operators
Definition at line 178 of file PyExport.h.
HandledType* Base::PyHandle< HandledType >::operator-> | ( | ) | [inline] |
derefrence operators
Definition at line 168 of file PyExport.h.
bool Base::PyHandle< HandledType >::operator< | ( | const PyHandle< HandledType > & | other | ) | const [inline] |
lower operator needed for sorting in maps and sets
Definition at line 185 of file PyExport.h.
PyHandle<HandledType>& Base::PyHandle< HandledType >::operator= | ( | const PyHandle< HandledType > & | other | ) | [inline] |
Definition at line 153 of file PyExport.h.
PyHandle<HandledType>& Base::PyHandle< HandledType >::operator= | ( | HandledType * | other | ) | [inline] |
Definition at line 142 of file PyExport.h.
bool Base::PyHandle< HandledType >::operator== | ( | const PyHandle< HandledType > & | other | ) | const [inline] |
equal operator
Definition at line 192 of file PyExport.h.