From 5f53487036d7f5cb6571af7c9063ef98f75a6371 Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Fri, 22 Nov 2019 11:32:48 +0100 Subject: [PATCH] Added RPOLYH & RPOLY2PH types to ResistorFamily. --- hurricane/src/analog/PyResistorFamily.cpp | 46 +++++++++++-------- .../analog/hurricane/analog/ResistorFamily.h | 6 ++- 2 files changed, 32 insertions(+), 20 deletions(-) diff --git a/hurricane/src/analog/PyResistorFamily.cpp b/hurricane/src/analog/PyResistorFamily.cpp index 26310249..ec1fbd40 100644 --- a/hurricane/src/analog/PyResistorFamily.cpp +++ b/hurricane/src/analog/PyResistorFamily.cpp @@ -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"); } diff --git a/hurricane/src/analog/hurricane/analog/ResistorFamily.h b/hurricane/src/analog/hurricane/analog/ResistorFamily.h index c5c32ef2..9445d586 100644 --- a/hurricane/src/analog/hurricane/analog/ResistorFamily.h +++ b/hurricane/src/analog/hurricane/analog/ResistorFamily.h @@ -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); }