The PyObjectBase class, exports the class as a python type PyObjectBase is the base class for all C++ classes which need to get exported into the python namespace. More...
#include <PyObjectBase.h>
Public Types | |
typedef void * | PointerType |
enum | Status { Valid = 0 , Immutable = 1 , Notify = 2 , NoTrack = 3 } |
Public Member Functions | |
PyObjectBase * | DecRef () |
decref method wrapper (see python extending manual) More... | |
void * | getTwinPointer () const |
Get the pointer of the twin object. More... | |
virtual PyTypeObject * | GetType (void) |
PyObjectBase * | IncRef () |
incref method wrapper (see python extending manual) More... | |
bool | isConst () |
bool | isNotTracking () const |
bool | isValid () |
virtual int | PyInit (PyObject *, PyObject *) |
PyInit method Override this method to initialize a newly created instance of the class (Constructor) More... | |
PyObjectBase (void *, PyTypeObject *T) | |
Constructor Sets the Type of the object (for inheritance) and decrease the the reference count of the PyObject. More... | |
void | setConst () |
void | setInvalid () |
void | setNotTracking (bool on=true) |
void | setShouldNotify (bool on) |
bool | shouldNotify () const |
void | startNotify () |
Static Public Member Functions | |
static void | PyDestructor (PyObject *P) |
Wrapper for the Python destructor. More... | |
Public Attributes | |
PyObject * | baseProxy |
Static Public Attributes | |
static PyMethodDef | Methods [] |
static PyTypeObject | Type |
Py_Header struct from python.h. More... | |
Protected Member Functions | |
void | setTwinPointer (void *ptr) |
Overrides the pointer to the twin object. More... | |
virtual | ~PyObjectBase () |
destructor More... | |
Protected Attributes | |
std::bitset< 32 > | StatusBits |
The PyObjectBase class, exports the class as a python type PyObjectBase is the base class for all C++ classes which need to get exported into the python namespace.
This class is very important because nearly all important classes in FreeCAD are visible in python for macro recording and automation purpose. The class App::Document is a good expample for an exported class. There are some convenience macros to make it easier to inherit from this class and defining new methods exported to python. PYFUNCDEF_D defines a new exported method. PYFUNCIMP_D defines the implementation of the new exported method. In the implementation you can use Py_Return, Py_Error, Py_Try and Py_Assert. PYMETHODEDEF makes the entry in the python method table.
typedef void* Base::PyObjectBase::PointerType |
|
protectedvirtual |
destructor
References baseProxy, Base::Console(), and Base::ConsoleSingleton::Log().
PyObjectBase::PyObjectBase | ( | void * | p, |
PyTypeObject * | T | ||
) |
Constructor Sets the Type of the object (for inheritance) and decrease the the reference count of the PyObject.
References Base::Console(), Base::ConsoleSingleton::Log(), Notify, StatusBits, and Valid.
PyObjectBase * Base::PyObjectBase::DecRef | ( | ) |
decref method wrapper (see python extending manual)
void * Base::PyObjectBase::getTwinPointer | ( | ) | const |
Get the pointer of the twin object.
|
virtual |
PyObjectBase * Base::PyObjectBase::IncRef | ( | ) |
incref method wrapper (see python extending manual)
bool Base::PyObjectBase::isConst | ( | ) |
bool Base::PyObjectBase::isNotTracking | ( | ) | const |
bool Base::PyObjectBase::isValid | ( | ) |
|
static |
Wrapper for the Python destructor.
PyInit method Override this method to initialize a newly created instance of the class (Constructor)
void Base::PyObjectBase::setConst | ( | ) |
Referenced by Part::PropertyPartShape::getPyObject().
void Base::PyObjectBase::setInvalid | ( | ) |
void Base::PyObjectBase::setNotTracking | ( | bool | on = true | ) |
Referenced by Part::TopoShape::getPyObject().
void Base::PyObjectBase::setShouldNotify | ( | bool | on | ) |
|
protected |
Overrides the pointer to the twin object.
bool Base::PyObjectBase::shouldNotify | ( | ) | const |
Referenced by startNotify().
void PyObjectBase::startNotify | ( | ) |
References shouldNotify().
PyObject* Base::PyObjectBase::baseProxy |
Referenced by ~PyObjectBase().
|
static |
|
protected |
Referenced by PyObjectBase().
|
static |
Py_Header struct from python.h.
Every PyObjectBase object is also a python object. So you can use every Python C-Library function also on a PyObjectBase object
Referenced by ArchPanel.CommandPanelSheet::Activated(), ArchStructure.CommandStructuralSystem::Activated(), draftobjects.draft_annotation.DraftAnnotation::add_missing_properties_0v19(), ArchStructure.StructSelectionObserver::addSelection(), ArchSite.Compass::buildCoordinates(), ArchComponent.Component::execute(), draftobjects.layer.LayerContainer::execute(), ArchSchedule.CommandArchSchedule::IsActive(), draftobjects.layer.Layer::set_properties(), and ArchReference.ArchReference::setProperties().