The python export class for Quantity. More...

#include <QuantityPy.h>

Public Types

typedef QuantityPointerType
 
- Public Types inherited from Base::PyObjectBase
typedef void * PointerType
 
enum  Status { Valid = 0, Immutable = 1, Notify = 2, NoTrack = 3 }
 

Public Member Functions

virtual PyTypeObject * GetType (void)
 
virtual int PyInit (PyObject *args, PyObject *k)
 PyInit method Override this method to initialize a newly created instance of the class (Constructor) More...
 
 QuantityPy (Quantity *pcObject, PyTypeObject *T=&Type)
 
std::string representation (void) const
 
- Public Member Functions inherited from Base::PyObjectBase
PyObjectBaseDecRef (void)
 decref method wrapper (see python extending manual)
More...
 
PyObjectBaseIncRef (void)
 incref method wrapper (see python extending manual) More...
 
bool isConst ()
 
bool isNotTracking () const
 
bool isValid ()
 
 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 PyObjectPyMake (struct _typeobject *, PyObject *, PyObject *)
 
static PyObjectrichCompare (PyObject *v, PyObject *w, int op)
 
callbacks and implementers for the python object number protocol
static PyObjectnumber_add_handler (PyObject *self, PyObject *other)
 callback for the number_add_handler More...
 
static PyObjectnumber_subtract_handler (PyObject *self, PyObject *other)
 callback for the number_subtract_handler More...
 
static PyObjectnumber_multiply_handler (PyObject *self, PyObject *other)
 callback for the number_multiply_handler More...
 
static PyObjectnumber_divide_handler (PyObject *self, PyObject *other)
 callback for the number_divide_handler More...
 
static PyObjectnumber_remainder_handler (PyObject *self, PyObject *other)
 callback for the number_remainder_handler More...
 
static PyObjectnumber_divmod_handler (PyObject *self, PyObject *other)
 callback for the number_divmod_handler More...
 
static PyObjectnumber_power_handler (PyObject *self, PyObject *other, PyObject *modulo)
 callback for the number_power_handler More...
 
static PyObjectnumber_negative_handler (PyObject *self)
 callback for the number_negative_handler More...
 
static PyObjectnumber_positive_handler (PyObject *self)
 callback for the number_positive_handler More...
 
static PyObjectnumber_absolute_handler (PyObject *self)
 callback for the number_absolute_handler More...
 
static int number_nonzero_handler (PyObject *self)
 callback for the number_nonzero_handler More...
 
static PyObjectnumber_invert_handler (PyObject *self)
 callback for the number_invert_handler More...
 
static PyObjectnumber_lshift_handler (PyObject *self, PyObject *other)
 callback for the number_lshift_handler More...
 
static PyObjectnumber_rshift_handler (PyObject *self, PyObject *other)
 callback for the number_rshift_handler More...
 
static PyObjectnumber_and_handler (PyObject *self, PyObject *other)
 callback for the number_and_handler More...
 
static PyObjectnumber_xor_handler (PyObject *self, PyObject *other)
 callback for the number_xor_handler More...
 
static PyObjectnumber_or_handler (PyObject *self, PyObject *other)
 callback for the number_or_handler More...
 
static int number_coerce_handler (PyObject **self, PyObject **other)
 callback for the number_coerce_handler More...
 
static PyObjectnumber_int_handler (PyObject *self)
 callback for the number_int_handler More...
 
static PyObjectnumber_long_handler (PyObject *self)
 callback for the number_long_handler More...
 
static PyObjectnumber_float_handler (PyObject *self)
 callback for the number_float_handler More...
 
static PyObjectnumber_oct_handler (PyObject *self)
 callback for the number_oct_handler More...
 
static PyObjectnumber_hex_handler (PyObject *self)
 callback for the number_hex_handler More...
 
- Static Public Member Functions inherited from Base::PyObjectBase
static void PyDestructor (PyObject *P)
 Wrapper for the Python destructor. More...
 

Static Public Attributes

static PyGetSetDef GetterSetter []
 Attribute structure of QuantityPy. More...
 
static PyMethodDef Methods []
 Methods structure of QuantityPy. More...
 
static PyNumberMethods Number []
 
static PyTypeObject Type
 Type structure of QuantityPy. More...
 
- Static Public Attributes inherited from Base::PyObjectBase
static PyMethodDef Methods []
 
static PyTypeObject Type
 Py_Header struct from python.h. More...
 

Protected Member Functions

 ~QuantityPy ()
 
- Protected Member Functions inherited from Base::PyObjectBase
virtual ~PyObjectBase ()
 destructor More...
 

callbacks and implementers for the python object methods

static PyObjectstaticCallback_getUserPreferred (PyObject *self, PyObject *args)
 callback for the getUserPreferred() method More...
 
static PyObjectstaticCallback_getValueAs (PyObject *self, PyObject *args)
 callback for the getValueAs() method More...
 
PyObjectgetUserPreferred (PyObject *args)
 implementer for the getUserPreferred() method More...
 
PyObjectgetValueAs (PyObject *args)
 implementer for the getValueAs() method More...
 

callbacks and implementers for the python object attributes

static PyObjectstaticCallback_getValue (PyObject *self, void *closure)
 getter callback for the Value attribute More...
 
static int staticCallback_setValue (PyObject *self, PyObject *value, void *closure)
 setter callback for the Value attribute More...
 
static PyObjectstaticCallback_getUnit (PyObject *self, void *closure)
 getter callback for the Unit attribute More...
 
static int staticCallback_setUnit (PyObject *self, PyObject *value, void *closure)
 setter callback for the Unit attribute More...
 
static PyObjectstaticCallback_getUserString (PyObject *self, void *closure)
 getter callback for the UserString attribute More...
 
static int staticCallback_setUserString (PyObject *self, PyObject *value, void *closure)
 setter callback for the UserString attribute More...
 
static PyObjectstaticCallback_getFormat (PyObject *self, void *closure)
 getter callback for the Format attribute More...
 
static int staticCallback_setFormat (PyObject *self, PyObject *value, void *closure)
 setter callback for the Format attribute More...
 
Py::Float getValue (void) const
 getter for the Value attribute More...
 
void setValue (Py::Float arg)
 setter for the Value attribute More...
 
Py::Object getUnit (void) const
 getter for the Unit attribute More...
 
void setUnit (Py::Object arg)
 setter for the Unit attribute More...
 
Py::String getUserString (void) const
 getter for the UserString attribute More...
 
Py::Dict getFormat (void) const
 getter for the Format attribute More...
 
void setFormat (Py::Dict arg)
 setter for the Format attribute More...
 
PyObjectgetCustomAttributes (const char *attr) const
 getter method for special attributes (e.g. dynamic ones) More...
 
int setCustomAttributes (const char *attr, PyObject *obj)
 setter for special attributes (e.g. More...
 
QuantitygetQuantityPtr (void) const
 getter for the object handled by this class More...
 

Additional Inherited Members

- Protected Attributes inherited from Base::PyObjectBase
std::bitset< 32 > StatusBits
 

Detailed Description

The python export class for Quantity.

Member Typedef Documentation

◆ PointerType

Constructor & Destructor Documentation

◆ ~QuantityPy()

QuantityPy::~QuantityPy ( )
protected

◆ QuantityPy()

Member Function Documentation

◆ getCustomAttributes()

PyObject * QuantityPy::getCustomAttributes ( const char *  attr) const

◆ getFormat()

Py::Dict QuantityPy::getFormat ( void  ) const

getter for the Format attribute

References Base::Quantity::getFormat(), and getQuantityPtr().

Referenced by staticCallback_getFormat().

◆ getQuantityPtr()

◆ GetType()

virtual PyTypeObject* Base::QuantityPy::GetType ( void  )
virtual

Reimplemented from Base::PyObjectBase.

◆ getUnit()

Py::Object QuantityPy::getUnit ( void  ) const

getter for the Unit attribute

References getQuantityPtr().

Referenced by getValueAs(), Base::UnitPy::PyInit(), and staticCallback_getUnit().

◆ getUserPreferred()

PyObject * QuantityPy::getUserPreferred ( PyObject args)

◆ getUserString()

Py::String QuantityPy::getUserString ( void  ) const

getter for the UserString attribute

References getQuantityPtr().

Referenced by staticCallback_getUserString().

◆ getValue()

Py::Float QuantityPy::getValue ( void  ) const

getter for the Value attribute

References getQuantityPtr().

Referenced by staticCallback_getValue().

◆ getValueAs()

◆ number_absolute_handler()

PyObject * QuantityPy::number_absolute_handler ( PyObject self)
static

callback for the number_absolute_handler

References getQuantityPtr(), QuantityPy(), and Type.

◆ number_add_handler()

PyObject * QuantityPy::number_add_handler ( PyObject self,
PyObject other 
)
static

callback for the number_add_handler

References getQuantityPtr(), QuantityPy(), and Type.

◆ number_and_handler()

PyObject * QuantityPy::number_and_handler ( PyObject self,
PyObject other 
)
static

callback for the number_and_handler

◆ number_coerce_handler()

int QuantityPy::number_coerce_handler ( PyObject **  self,
PyObject **  other 
)
static

callback for the number_coerce_handler

◆ number_divide_handler()

PyObject * QuantityPy::number_divide_handler ( PyObject self,
PyObject other 
)
static

callback for the number_divide_handler

References getQuantityPtr(), QuantityPy(), and Type.

◆ number_divmod_handler()

PyObject * QuantityPy::number_divmod_handler ( PyObject self,
PyObject other 
)
static

callback for the number_divmod_handler

◆ number_float_handler()

PyObject * QuantityPy::number_float_handler ( PyObject self)
static

callback for the number_float_handler

References Type.

◆ number_hex_handler()

PyObject * QuantityPy::number_hex_handler ( PyObject self)
static

callback for the number_hex_handler

◆ number_int_handler()

PyObject * QuantityPy::number_int_handler ( PyObject self)
static

callback for the number_int_handler

References Type.

◆ number_invert_handler()

PyObject * QuantityPy::number_invert_handler ( PyObject self)
static

callback for the number_invert_handler

◆ number_long_handler()

PyObject * QuantityPy::number_long_handler ( PyObject self)
static

callback for the number_long_handler

References Type.

◆ number_lshift_handler()

PyObject * QuantityPy::number_lshift_handler ( PyObject self,
PyObject other 
)
static

callback for the number_lshift_handler

◆ number_multiply_handler()

PyObject * QuantityPy::number_multiply_handler ( PyObject self,
PyObject other 
)
static

callback for the number_multiply_handler

References getQuantityPtr(), QuantityPy(), and Type.

◆ number_negative_handler()

PyObject * QuantityPy::number_negative_handler ( PyObject self)
static

callback for the number_negative_handler

References getQuantityPtr(), QuantityPy(), and Type.

◆ number_nonzero_handler()

int QuantityPy::number_nonzero_handler ( PyObject self)
static

callback for the number_nonzero_handler

References getQuantityPtr(), Base::Quantity::getValue(), and Type.

◆ number_oct_handler()

PyObject * QuantityPy::number_oct_handler ( PyObject self)
static

callback for the number_oct_handler

◆ number_or_handler()

PyObject * QuantityPy::number_or_handler ( PyObject self,
PyObject other 
)
static

callback for the number_or_handler

◆ number_positive_handler()

PyObject * QuantityPy::number_positive_handler ( PyObject self)
static

callback for the number_positive_handler

References getQuantityPtr(), QuantityPy(), and Type.

◆ number_power_handler()

PyObject * QuantityPy::number_power_handler ( PyObject self,
PyObject other,
PyObject modulo 
)
static

callback for the number_power_handler

References getQuantityPtr(), QuantityPy(), and Type.

◆ number_remainder_handler()

PyObject * QuantityPy::number_remainder_handler ( PyObject self,
PyObject other 
)
static

callback for the number_remainder_handler

References getQuantityPtr(), Base::Quantity::getValue(), QuantityPy(), and Type.

◆ number_rshift_handler()

PyObject * QuantityPy::number_rshift_handler ( PyObject self,
PyObject other 
)
static

callback for the number_rshift_handler

◆ number_subtract_handler()

PyObject * QuantityPy::number_subtract_handler ( PyObject self,
PyObject other 
)
static

callback for the number_subtract_handler

References getQuantityPtr(), QuantityPy(), and Type.

◆ number_xor_handler()

PyObject * QuantityPy::number_xor_handler ( PyObject self,
PyObject other 
)
static

callback for the number_xor_handler

◆ PyInit()

int QuantityPy::PyInit ( PyObject ,
PyObject  
)
virtual

PyInit method Override this method to initialize a newly created instance of the class (Constructor)

Reimplemented from Base::PyObjectBase.

References getQuantityPtr(), Base::Quantity::parse(), Base::UnitPy::Type, and Type.

◆ PyMake()

PyObject * QuantityPy::PyMake ( struct _typeobject *  ,
PyObject ,
PyObject  
)
static

References QuantityPy().

◆ representation()

◆ richCompare()

PyObject * QuantityPy::richCompare ( PyObject v,
PyObject w,
int  op 
)
static

References getQuantityPtr(), and Type.

◆ setCustomAttributes()

int QuantityPy::setCustomAttributes ( const char *  attr,
PyObject obj 
)

setter for special attributes (e.g.

dynamic ones) Output: Success=1, Failure=-1, Ignore=0

◆ setFormat()

◆ setUnit()

void QuantityPy::setUnit ( Py::Object  arg)

◆ setValue()

void QuantityPy::setValue ( Py::Float  arg)

setter for the Value attribute

References getQuantityPtr(), and Base::Quantity::setValue().

Referenced by staticCallback_setValue().

◆ staticCallback_getFormat()

PyObject * QuantityPy::staticCallback_getFormat ( PyObject self,
void *  closure 
)
static

getter callback for the Format attribute

References Base::BaseExceptionFreeCADError, getFormat(), and Base::PyObjectBase::isValid().

◆ staticCallback_getUnit()

PyObject * QuantityPy::staticCallback_getUnit ( PyObject self,
void *  closure 
)
static

getter callback for the Unit attribute

References Base::BaseExceptionFreeCADError, getUnit(), and Base::PyObjectBase::isValid().

◆ staticCallback_getUserPreferred()

PyObject * QuantityPy::staticCallback_getUserPreferred ( PyObject self,
PyObject args 
)
static

◆ staticCallback_getUserString()

PyObject * QuantityPy::staticCallback_getUserString ( PyObject self,
void *  closure 
)
static

getter callback for the UserString attribute

References Base::BaseExceptionFreeCADError, getUserString(), and Base::PyObjectBase::isValid().

◆ staticCallback_getValue()

PyObject * QuantityPy::staticCallback_getValue ( PyObject self,
void *  closure 
)
static

getter callback for the Value attribute

References Base::BaseExceptionFreeCADError, getValue(), and Base::PyObjectBase::isValid().

◆ staticCallback_getValueAs()

PyObject * QuantityPy::staticCallback_getValueAs ( PyObject self,
PyObject args 
)
static

◆ staticCallback_setFormat()

int QuantityPy::staticCallback_setFormat ( PyObject self,
PyObject value,
void *  closure 
)
static

◆ staticCallback_setUnit()

int QuantityPy::staticCallback_setUnit ( PyObject self,
PyObject value,
void *  closure 
)
static

◆ staticCallback_setUserString()

int QuantityPy::staticCallback_setUserString ( PyObject self,
PyObject value,
void *  closure 
)
static

setter callback for the UserString attribute

References Base::PyObjectBase::isValid().

◆ staticCallback_setValue()

int QuantityPy::staticCallback_setValue ( PyObject self,
PyObject value,
void *  closure 
)
static

Member Data Documentation

◆ GetterSetter

PyGetSetDef QuantityPy::GetterSetter
static
Initial value:
= {
{"Value",
"Numeric Value of the Quantity (in internal system mm,kg,s)",
NULL
},
{"Unit",
"Unit of the Quantity",
NULL
},
{"UserString",
"Unit of the Quantity",
NULL
},
{"Format",
"Format of the Quantity",
NULL
},
{NULL, NULL, NULL, NULL, NULL}
}

Attribute structure of QuantityPy.

◆ Methods

PyMethodDef QuantityPy::Methods
static
Initial value:
= {
{"getUserPreferred",
reinterpret_cast<PyCFunction>( staticCallback_getUserPreferred ),
METH_VARARGS,
"\n returns a quantity with the translation factor and a string with the prevered unit\n "
},
{"getValueAs",
reinterpret_cast<PyCFunction>( staticCallback_getValueAs ),
METH_VARARGS,
"\n returns a floating point value as the provided unit\n\n Following parameters are allowed:\n getValueAs('m/s') # unit string to parse\n getValueAs(2.45,1) # translatrion value and unit signature\n getValueAs(FreeCAD.Units.Pascal) # predefined standard units \n getValueAs(Qantity('N/m^2')) # a quantity\n getValueAs(Unit(0,1,0,0,0,0,0,0)) # a unit\n "
},
{NULL, NULL, 0, NULL}
}

Methods structure of QuantityPy.

◆ Number

PyNumberMethods QuantityPy::Number
static

◆ Type


The documentation for this class was generated from the following files:
  • build/webdoc/src/Base/QuantityPy.h
  • src/Base/QuantityPyImp.cpp
  • build/webdoc/src/Base/QuantityPy.cpp
static PyObject * staticCallback_getValue(PyObject *self, void *closure)
getter callback for the Value attribute
Definition: QuantityPy.cpp:349
static PyObject * staticCallback_getValueAs(PyObject *self, PyObject *args)
callback for the getValueAs() method
Definition: QuantityPy.cpp:273
static int staticCallback_setUserString(PyObject *self, PyObject *value, void *closure)
setter callback for the UserString attribute
Definition: QuantityPy.cpp:455
static PyObject * staticCallback_getUserPreferred(PyObject *self, PyObject *args)
callback for the getUserPreferred() method
Definition: QuantityPy.cpp:197
static int staticCallback_setUnit(PyObject *self, PyObject *value, void *closure)
setter callback for the Unit attribute
Definition: QuantityPy.cpp:411
static int staticCallback_setFormat(PyObject *self, PyObject *value, void *closure)
setter callback for the Format attribute
Definition: QuantityPy.cpp:487
static PyObject * staticCallback_getUserString(PyObject *self, void *closure)
getter callback for the UserString attribute
Definition: QuantityPy.cpp:437
static PyObject * staticCallback_getFormat(PyObject *self, void *closure)
getter callback for the Format attribute
Definition: QuantityPy.cpp:469
static PyObject * staticCallback_getUnit(PyObject *self, void *closure)
getter callback for the Unit attribute
Definition: QuantityPy.cpp:393
static int staticCallback_setValue(PyObject *self, PyObject *value, void *closure)
setter callback for the Value attribute
Definition: QuantityPy.cpp:367