Added RPOLYH & RPOLY2PH types to ResistorFamily.

This commit is contained in:
Jean-Paul Chaput 2019-11-22 11:32:48 +01:00
parent f38945d200
commit 5f53487036
2 changed files with 32 additions and 20 deletions

View File

@ -51,21 +51,23 @@ extern "C" {
}
DirectGetBoolAttribute (PyResistorFamily_isLOWRES,isLOWRES,PyResistorFamily,ResistorFamily)
DirectGetBoolAttribute (PyResistorFamily_isHIRES ,isHIRES ,PyResistorFamily,ResistorFamily)
DirectGetIntAttribute (PyResistorFamily_getBends,getBends,PyResistorFamily,ResistorFamily)
DirectGetLongAttribute (PyResistorFamily_getW ,getW ,PyResistorFamily,ResistorFamily)
DirectGetLongAttribute (PyResistorFamily_getL ,getL ,PyResistorFamily,ResistorFamily)
DirectSetIntAttribute (PyResistorFamily_setBends,setBends,PyResistorFamily,ResistorFamily)
DirectGetDoubleAttribute(PyResistorFamily_getR ,getR ,PyResistorFamily,ResistorFamily)
DirectGetDoubleAttribute(PyResistorFamily_getWE ,getWE ,PyResistorFamily,ResistorFamily)
DirectGetDoubleAttribute(PyResistorFamily_getLE ,getLE ,PyResistorFamily,ResistorFamily)
DirectSetDoubleAttribute(PyResistorFamily_setR ,setR ,PyResistorFamily,ResistorFamily)
DirectSetDoubleAttribute(PyResistorFamily_setWE ,setWE ,PyResistorFamily,ResistorFamily)
DirectSetDoubleAttribute(PyResistorFamily_setLE ,setLE ,PyResistorFamily,ResistorFamily)
DirectGetBoolAttribute (PyResistorFamily_isLOWRES ,isLOWRES ,PyResistorFamily,ResistorFamily)
DirectGetBoolAttribute (PyResistorFamily_isHIRES ,isHIRES ,PyResistorFamily,ResistorFamily)
DirectGetBoolAttribute (PyResistorFamily_isRPOLYH ,isRPOLYH ,PyResistorFamily,ResistorFamily)
DirectGetBoolAttribute (PyResistorFamily_isRPOLY2PH,isRPOLY2PH,PyResistorFamily,ResistorFamily)
DirectGetIntAttribute (PyResistorFamily_getBends ,getBends ,PyResistorFamily,ResistorFamily)
DirectGetLongAttribute (PyResistorFamily_getW ,getW ,PyResistorFamily,ResistorFamily)
DirectGetLongAttribute (PyResistorFamily_getL ,getL ,PyResistorFamily,ResistorFamily)
DirectSetIntAttribute (PyResistorFamily_setBends ,setBends ,PyResistorFamily,ResistorFamily)
DirectGetDoubleAttribute(PyResistorFamily_getR ,getR ,PyResistorFamily,ResistorFamily)
DirectGetDoubleAttribute(PyResistorFamily_getWE ,getWE ,PyResistorFamily,ResistorFamily)
DirectGetDoubleAttribute(PyResistorFamily_getLE ,getLE ,PyResistorFamily,ResistorFamily)
DirectSetDoubleAttribute(PyResistorFamily_setR ,setR ,PyResistorFamily,ResistorFamily)
DirectSetDoubleAttribute(PyResistorFamily_setWE ,setWE ,PyResistorFamily,ResistorFamily)
DirectSetDoubleAttribute(PyResistorFamily_setLE ,setLE ,PyResistorFamily,ResistorFamily)
// ---------------------------------------------------------------
@ -74,10 +76,14 @@ extern "C" {
PyMethodDef PyResistorFamily_Methods[] =
{ { "getType" , (PyCFunction)PyResistorFamily_getType , METH_NOARGS
, "Returns the type of the resistor (as a numric constant)." }
, { "isLOWRES" , (PyCFunction)PyResistorFamily_isLOWRES , METH_NOARGS
, { "isLOWRES" , (PyCFunction)PyResistorFamily_isLOWRES , METH_NOARGS
, "Returns True if it is a LOWRES resistor." }
, { "isHIRES" , (PyCFunction)PyResistorFamily_isHIRES , METH_NOARGS
, { "isHIRES" , (PyCFunction)PyResistorFamily_isHIRES , METH_NOARGS
, "Returns True if it is a HIRES resistor." }
, { "isRPOLYH" , (PyCFunction)PyResistorFamily_isRPOLYH , METH_NOARGS
, "Returns True if it is a RPOLYH resistor." }
, { "isRPOLY2PH" , (PyCFunction)PyResistorFamily_isRPOLY2PH , METH_NOARGS
, "Returns True if it is a RPOLY2PH resistor." }
, { "getBends" , (PyCFunction)PyResistorFamily_getBends , METH_NOARGS
, "Self explanatory." }
, { "getW" , (PyCFunction)PyResistorFamily_getW , METH_NOARGS
@ -126,8 +132,10 @@ extern "C" {
{
PyObject* constant;
LoadObjectConstant(PyTypeResistorFamily.tp_dict,ResistorFamily::LOWRES,"LOWRES");
LoadObjectConstant(PyTypeResistorFamily.tp_dict,ResistorFamily::HIRES ,"HIRES" );
LoadObjectConstant(PyTypeResistorFamily.tp_dict,ResistorFamily::LOWRES ,"LOWRES" );
LoadObjectConstant(PyTypeResistorFamily.tp_dict,ResistorFamily::HIRES ,"HIRES" );
LoadObjectConstant(PyTypeResistorFamily.tp_dict,ResistorFamily::RPOLYH ,"RPOLYH" );
LoadObjectConstant(PyTypeResistorFamily.tp_dict,ResistorFamily::RPOLY2PH,"RPOLY2PH");
}

View File

@ -34,7 +34,7 @@ namespace Analog {
public:
typedef Device Super;
enum Type { LOWRES=1, HIRES };
enum Type { LOWRES=1, HIRES, RPOLYH, RPOLY2PH };
public:
inline MetaResistor* getReferenceResistor ();
inline const MetaResistor* getReferenceResistor () const;
@ -42,6 +42,8 @@ namespace Analog {
// Geometrical (layout) parameters commons to all resistors.
inline bool isLOWRES () const;
inline bool isHIRES () const;
inline bool isRPOLYH () const;
inline bool isRPOLY2PH () const;
inline int getBends () const;
inline DbU::Unit getW () const;
inline DbU::Unit getL () const;
@ -79,6 +81,8 @@ namespace Analog {
inline void ResistorFamily::setReferenceResistor ( MetaResistor* mr ) { _referenceResistor = mr; }
inline bool ResistorFamily::isLOWRES () const { return getType() == LOWRES; }
inline bool ResistorFamily::isHIRES () const { return getType() == HIRES; }
inline bool ResistorFamily::isRPOLYH () const { return getType() == RPOLYH; }
inline bool ResistorFamily::isRPOLY2PH () const { return getType() == RPOLY2PH; }
// Mutators.
inline void ResistorFamily::setR ( float r ) { _secureGetReferenceResistor()->setR (r ); _r ->setValue(r ); }
inline void ResistorFamily::setBends ( int bends ) { _secureGetReferenceResistor()->setBends(bends); _bends->setValue(bends); }