2008-03-06 10:46:43 -06:00
// x-----------------------------------------------------------------x
// | |
// | C O R I O L I S |
// | I s o b a r - Hurricane / Python Interface |
// | |
// | Author : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
// | =============================================================== |
// | C++ Module : "./PyCell.cpp" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
2008-05-21 17:46:29 -05:00
# include "hurricane/isobar/PyCell.h"
# include "hurricane/isobar/PyBox.h"
# include "hurricane/isobar/PyLibrary.h"
# include "hurricane/isobar/PyInstance.h"
# include "hurricane/isobar/PyOccurrence.h"
# include "hurricane/isobar/ProxyProperty.h"
# include "hurricane/isobar/PyNet.h"
2008-10-14 05:48:53 -05:00
# include "hurricane/isobar/PyNetCollection.h"
2008-10-17 12:27:20 -05:00
# include "hurricane/isobar/PyReferenceCollection.h"
# include "hurricane/isobar/PyInstanceCollection.h"
# include "hurricane/isobar/PyOccurrenceCollection.h"
2008-03-06 10:46:43 -06:00
namespace Isobar {
2008-03-28 04:48:47 -05:00
using namespace Hurricane ;
2008-03-06 10:46:43 -06:00
extern " C " {
# undef ACCESS_OBJECT
# undef ACCESS_CLASS
# define ACCESS_OBJECT _baseObject._object
# define ACCESS_CLASS(_pyObject) &(_pyObject->_baseObject)
# define METHOD_HEAD(function) GENERIC_METHOD_HEAD(Cell,cell,function)
// x=================================================================x
// | "PyCell" Python Module Code Part |
// x=================================================================x
# if defined(__PYTHON_MODULE__)
// x-------------------------------------------------------------x
// | "PyCell" Attribute Methods |
// x-------------------------------------------------------------x
// Standart Accessors (Attributes).
// Standart Delete (Attribute).
2008-03-17 08:54:33 -05:00
DBoDestroyAttribute ( PyCell_destroy , PyCell )
2008-03-06 10:46:43 -06:00
// ---------------------------------------------------------------
2008-03-17 08:54:33 -05:00
// Attribute Method : "PyCell_getLibrary ()"
2008-03-06 10:46:43 -06:00
2008-03-17 08:54:33 -05:00
static PyObject * PyCell_getLibrary ( PyCell * self ) {
trace < < " PyCell_getLibrary () " < < endl ;
2008-03-06 10:46:43 -06:00
Library * library = NULL ;
HTRY
2008-03-17 08:54:33 -05:00
METHOD_HEAD ( " Cell.getLibrary() " )
library = cell - > getLibrary ( ) ;
2008-03-06 10:46:43 -06:00
HCATCH
2008-10-17 12:27:20 -05:00
return PyLibrary_Link ( library ) ;
2008-03-06 10:46:43 -06:00
}
// ---------------------------------------------------------------
2008-03-17 08:54:33 -05:00
// Attribute Method : "PyCell_getName ()"
2008-03-06 10:46:43 -06:00
2008-12-11 06:25:02 -06:00
GetNameMethod ( Cell , cell )
2008-03-06 10:46:43 -06:00
// ---------------------------------------------------------------
2008-03-17 08:54:33 -05:00
// Attribute Method : "PyCell_getInstance ()"
2008-03-06 10:46:43 -06:00
2008-03-17 08:54:33 -05:00
static PyObject * PyCell_getInstance ( PyCell * self , PyObject * args ) {
trace < < " PyCell_getInstance () " < < endl ;
2008-12-10 12:37:32 -06:00
METHOD_HEAD ( " Cell.getInstance() " )
2008-03-06 10:46:43 -06:00
Instance * instance = NULL ;
HTRY
2008-12-10 12:37:32 -06:00
char * name ;
if ( PyArg_ParseTuple ( args , " s:Cell.getInstance " , & name ) ) {
instance = cell - > getInstance ( Name ( name ) ) ;
} else {
PyErr_SetString ( ConstructorError , " invalid number of parameters for Cell.getInstance. " ) ;
2008-10-17 12:27:20 -05:00
return NULL ;
2008-12-10 12:37:32 -06:00
}
2008-03-06 10:46:43 -06:00
HCATCH
2008-12-10 12:37:32 -06:00
return PyInstance_Link ( instance ) ;
2008-03-06 10:46:43 -06:00
}
// ---------------------------------------------------------------
2008-10-17 12:27:20 -05:00
// Attribute Method : "PyCell_getInstances()"
2008-03-06 10:46:43 -06:00
2008-10-17 12:27:20 -05:00
static PyObject * PyCell_getInstances ( PyCell * self ) {
trace < < " PyCell_getInstances() " < < endl ;
2008-03-06 10:46:43 -06:00
2008-10-17 12:27:20 -05:00
METHOD_HEAD ( " Cell.getInstances() " )
2008-03-06 10:46:43 -06:00
2008-10-17 12:27:20 -05:00
PyInstanceCollection * pyInstanceCollection = NULL ;
2008-03-06 10:46:43 -06:00
HTRY
2008-10-17 12:27:20 -05:00
Instances * instances = new Instances ( cell - > getInstances ( ) ) ;
2008-03-06 10:46:43 -06:00
2008-10-17 12:27:20 -05:00
pyInstanceCollection = PyObject_NEW ( PyInstanceCollection , & PyTypeInstanceCollection ) ;
if ( pyInstanceCollection = = NULL ) {
return NULL ;
}
pyInstanceCollection - > _object = instances ;
HCATCH
return ( PyObject * ) pyInstanceCollection ;
2008-03-06 10:46:43 -06:00
}
// ---------------------------------------------------------------
2008-10-17 12:27:20 -05:00
// Attribute Method : "PyCell_getInstancesUnder()"
2008-03-06 10:46:43 -06:00
2008-10-17 12:27:20 -05:00
static PyObject * PyCell_getInstancesUnder ( PyCell * self , PyObject * args ) {
trace < < " PyCell_getInstancesUnder() " < < endl ;
2008-03-06 10:46:43 -06:00
2008-10-17 12:27:20 -05:00
METHOD_HEAD ( " Cell.getInstancesUnder() " )
2008-03-06 10:46:43 -06:00
2008-12-12 12:49:17 -06:00
PyBox * pyBox ;
if ( ! PyArg_ParseTuple ( args , " O!:Cell.getInstancesUnder " , & PyTypeBox , & pyBox ) ) {
return NULL ;
}
2008-03-06 10:46:43 -06:00
2008-10-17 12:27:20 -05:00
PyInstanceCollection * pyInstanceCollection = NULL ;
2008-03-06 10:46:43 -06:00
HTRY
2008-12-12 12:49:17 -06:00
Instances * instances = new Instances ( cell - > getInstancesUnder ( * PYBOX_O ( pyBox ) ) ) ;
2008-10-17 12:27:20 -05:00
pyInstanceCollection = PyObject_NEW ( PyInstanceCollection , & PyTypeInstanceCollection ) ;
if ( pyInstanceCollection = = NULL ) {
return NULL ;
}
2008-03-06 10:46:43 -06:00
2008-10-17 12:27:20 -05:00
pyInstanceCollection - > _object = instances ;
HCATCH
return ( PyObject * ) pyInstanceCollection ;
2008-03-06 10:46:43 -06:00
}
// ---------------------------------------------------------------
2008-10-17 12:27:20 -05:00
// Attribute Method : "PyCell_getSlaveInstances()"
2008-03-06 10:46:43 -06:00
2008-10-17 12:27:20 -05:00
static PyObject * PyCell_getSlaveInstances ( PyCell * self ) {
trace < < " PyCell_getSlaveInstances() " < < endl ;
2008-03-06 10:46:43 -06:00
2008-10-17 12:27:20 -05:00
METHOD_HEAD ( " Cell.getSlaveInstances() " )
2008-03-06 10:46:43 -06:00
2008-10-17 12:27:20 -05:00
PyInstanceCollection * pyInstanceCollection = NULL ;
2008-03-06 10:46:43 -06:00
HTRY
2008-10-17 12:27:20 -05:00
Instances * instances = new Instances ( cell - > getSlaveInstances ( ) ) ;
2008-03-06 10:46:43 -06:00
2008-10-17 12:27:20 -05:00
pyInstanceCollection = PyObject_NEW ( PyInstanceCollection , & PyTypeInstanceCollection ) ;
if ( pyInstanceCollection = = NULL ) {
return NULL ;
}
pyInstanceCollection - > _object = instances ;
HCATCH
return ( PyObject * ) pyInstanceCollection ;
2008-03-06 10:46:43 -06:00
}
// ---------------------------------------------------------------
2008-10-17 12:27:20 -05:00
// Attribute Method : "PyCell_getOccurrences()"
2008-03-06 10:46:43 -06:00
2008-10-17 12:27:20 -05:00
static PyObject * PyCell_getOccurrences ( PyCell * self ) {
trace < < " PyCell_getOccurrences() " < < endl ;
2008-03-06 10:46:43 -06:00
2008-10-17 12:27:20 -05:00
METHOD_HEAD ( " Cell.getOccurrences() " )
2008-03-06 10:46:43 -06:00
2008-10-17 12:27:20 -05:00
PyOccurrenceCollection * pyOccurrenceCollection = NULL ;
2008-03-06 10:46:43 -06:00
HTRY
2008-10-17 12:27:20 -05:00
Occurrences * occurrences = new Occurrences ( cell - > getOccurrences ( ) ) ;
2008-03-06 10:46:43 -06:00
2008-10-17 12:27:20 -05:00
pyOccurrenceCollection = PyObject_NEW ( PyOccurrenceCollection , & PyTypeOccurrenceCollection ) ;
if ( pyOccurrenceCollection = = NULL ) {
return NULL ;
}
pyOccurrenceCollection - > _object = occurrences ;
HCATCH
return ( PyObject * ) pyOccurrenceCollection ;
2008-03-06 10:46:43 -06:00
}
// ---------------------------------------------------------------
2008-10-17 12:27:20 -05:00
// Attribute Method : "PyCell_getOccurrencesUnder()"
2008-03-06 10:46:43 -06:00
2008-10-17 12:27:20 -05:00
static PyObject * PyCell_getOccurrencesUnder ( PyCell * self , PyObject * args ) {
trace < < " PyCell_getOccurrencesUnder() " < < endl ;
2008-03-06 10:46:43 -06:00
2008-10-17 12:27:20 -05:00
METHOD_HEAD ( " Cell.getOccurrencesUnder() " )
2008-03-06 10:46:43 -06:00
2008-12-12 12:49:17 -06:00
PyBox * pyBox ;
if ( ! PyArg_ParseTuple ( args , " O!:Cell.getInstancesUnder " , & PyTypeBox , & pyBox ) ) {
2008-10-17 12:27:20 -05:00
return NULL ;
2008-12-12 12:49:17 -06:00
}
2008-10-17 12:27:20 -05:00
PyOccurrenceCollection * pyOccurrenceCollection = NULL ;
2008-03-06 10:46:43 -06:00
HTRY
2008-12-12 12:49:17 -06:00
Occurrences * occurrences = new Occurrences ( cell - > getOccurrencesUnder ( * PYBOX_O ( pyBox ) ) ) ;
2008-10-17 12:27:20 -05:00
pyOccurrenceCollection = PyObject_NEW ( PyOccurrenceCollection , & PyTypeOccurrenceCollection ) ;
if ( pyOccurrenceCollection = = NULL ) {
return NULL ;
}
2008-03-06 10:46:43 -06:00
2008-10-17 12:27:20 -05:00
pyOccurrenceCollection - > _object = occurrences ;
HCATCH
return ( PyObject * ) pyOccurrenceCollection ;
2008-03-06 10:46:43 -06:00
}
// ---------------------------------------------------------------
2008-10-17 12:27:20 -05:00
// Attribute Method : "PyCell_getLeafInstanceOccurrences()"
2008-03-06 10:46:43 -06:00
2008-10-17 12:27:20 -05:00
static PyObject * PyCell_getLeafInstanceOccurrences ( PyCell * self ) {
trace < < " PyCell_getLeafInstanceOccurrences() " < < endl ;
2008-03-06 10:46:43 -06:00
2008-10-17 12:27:20 -05:00
METHOD_HEAD ( " Cell.getLeafInstanceOccurrences() " )
2008-03-06 10:46:43 -06:00
2008-10-17 12:27:20 -05:00
PyOccurrenceCollection * pyOccurrenceCollection = NULL ;
2008-03-06 10:46:43 -06:00
HTRY
2008-10-17 12:27:20 -05:00
Occurrences * occurrences = new Occurrences ( cell - > getLeafInstanceOccurrences ( ) ) ;
2008-03-06 10:46:43 -06:00
2008-10-17 12:27:20 -05:00
pyOccurrenceCollection = PyObject_NEW ( PyOccurrenceCollection , & PyTypeOccurrenceCollection ) ;
if ( pyOccurrenceCollection = = NULL ) {
return NULL ;
}
pyOccurrenceCollection - > _object = occurrences ;
HCATCH
return ( PyObject * ) pyOccurrenceCollection ;
2008-03-06 10:46:43 -06:00
}
// ---------------------------------------------------------------
2008-10-17 12:27:20 -05:00
// Attribute Method : "PyCell_getLeafInstanceOccurrencesUnder()"
2008-03-06 10:46:43 -06:00
2008-10-17 12:27:20 -05:00
static PyObject * PyCell_getLeafInstanceOccurrencesUnder ( PyCell * self , PyObject * args ) {
trace < < " PyCell_getLeafInstanceOccurrencesUnder() " < < endl ;
2008-03-06 10:46:43 -06:00
2008-10-17 12:27:20 -05:00
METHOD_HEAD ( " Cell.getLeafInstanceOccurrencesUnder() " )
2008-03-06 10:46:43 -06:00
2008-12-12 12:49:17 -06:00
PyBox * pyBox ;
if ( ! PyArg_ParseTuple ( args , " O!:Cell.getInstancesUnder " , & PyTypeBox , & pyBox ) ) {
return NULL ;
}
2008-03-06 10:46:43 -06:00
2008-10-17 12:27:20 -05:00
PyOccurrenceCollection * pyOccurrenceCollection = NULL ;
2008-03-06 10:46:43 -06:00
HTRY
2008-12-12 12:49:17 -06:00
Occurrences * occurrences = new Occurrences ( cell - > getLeafInstanceOccurrencesUnder ( * PYBOX_O ( pyBox ) ) ) ;
2008-10-17 12:27:20 -05:00
pyOccurrenceCollection = PyObject_NEW ( PyOccurrenceCollection , & PyTypeOccurrenceCollection ) ;
if ( pyOccurrenceCollection = = NULL ) {
return NULL ;
}
2008-03-06 10:46:43 -06:00
2008-10-17 12:27:20 -05:00
pyOccurrenceCollection - > _object = occurrences ;
HCATCH
return ( PyObject * ) pyOccurrenceCollection ;
2008-03-06 10:46:43 -06:00
}
// ---------------------------------------------------------------
2008-10-17 12:27:20 -05:00
// Attribute Method : "PyCell_getReferences()"
2008-03-06 10:46:43 -06:00
2008-10-17 12:27:20 -05:00
static PyObject * PyCell_getReferences ( PyCell * self ) {
trace < < " PyCell_getReferences() " < < endl ;
2008-03-06 10:46:43 -06:00
2008-10-17 12:27:20 -05:00
METHOD_HEAD ( " Cell.getReferences() " )
2008-03-06 10:46:43 -06:00
2008-10-17 12:27:20 -05:00
PyReferenceCollection * pyReferenceCollection = NULL ;
2008-03-06 10:46:43 -06:00
HTRY
2008-10-17 12:27:20 -05:00
References * references = new References ( cell - > getReferences ( ) ) ;
2008-03-06 10:46:43 -06:00
2008-10-17 12:27:20 -05:00
pyReferenceCollection = PyObject_NEW ( PyReferenceCollection , & PyTypeReferenceCollection ) ;
if ( pyReferenceCollection = = NULL ) {
return NULL ;
}
pyReferenceCollection - > _object = references ;
HCATCH
return ( PyObject * ) pyReferenceCollection ;
2008-03-06 10:46:43 -06:00
}
// ---------------------------------------------------------------
2008-10-17 12:27:20 -05:00
// Attribute Method : "PyCell_getHyperNets()"
2008-03-06 10:46:43 -06:00
2008-10-17 12:27:20 -05:00
static PyObject * PyCell_getHyperNets ( PyCell * self ) {
trace < < " PyCell_getHyperNets() " < < endl ;
2008-03-06 10:46:43 -06:00
2008-10-17 12:27:20 -05:00
METHOD_HEAD ( " Cell.getHyperNets() " )
2008-03-06 10:46:43 -06:00
2008-10-17 12:27:20 -05:00
PyOccurrenceCollection * pyOccurrenceCollection = NULL ;
2008-03-06 10:46:43 -06:00
HTRY
2008-10-17 12:27:20 -05:00
Occurrences * occurrences = new Occurrences ( cell - > getHyperNetRootNetOccurrences ( ) ) ;
2008-03-06 10:46:43 -06:00
2008-10-17 12:27:20 -05:00
pyOccurrenceCollection = PyObject_NEW ( PyOccurrenceCollection , & PyTypeOccurrenceCollection ) ;
if ( pyOccurrenceCollection = = NULL ) {
return NULL ;
}
pyOccurrenceCollection - > _object = occurrences ;
HCATCH
return ( ( PyObject * ) pyOccurrenceCollection ) ;
2008-03-06 10:46:43 -06:00
}
// ---------------------------------------------------------------
2008-03-17 08:54:33 -05:00
// Attribute Method : "PyCell_getNet ()"
2008-03-06 10:46:43 -06:00
2008-12-10 12:37:32 -06:00
static PyObject * PyCell_getNet ( PyCell * self , PyObject * args ) {
trace < < " PyCell_getNet () " < < endl ;
METHOD_HEAD ( " Cell.getNet() " )
Net * net = NULL ;
HTRY
char * name = NULL ;
2008-12-12 12:49:17 -06:00
if ( ! PyArg_ParseTuple ( args , " s:Cell.getNet " , & name ) ) {
2008-12-10 12:37:32 -06:00
return NULL ;
2008-12-12 12:49:17 -06:00
}
net = cell - > getNet ( Name ( name ) ) ;
2008-12-10 12:37:32 -06:00
HCATCH
return PyNet_Link ( net ) ;
2008-03-06 10:46:43 -06:00
}
// ---------------------------------------------------------------
2008-10-14 05:48:53 -05:00
// Attribute Method : "PyCell_getNets ()"
2008-03-06 10:46:43 -06:00
2008-10-14 05:48:53 -05:00
static PyObject * PyCell_getNets ( PyCell * self ) {
trace < < " PyCell_getNets() " < < endl ;
2008-03-06 10:46:43 -06:00
2008-10-14 13:44:20 -05:00
METHOD_HEAD ( " Cell.getNets() " )
2008-03-06 10:46:43 -06:00
2008-10-14 05:48:53 -05:00
PyNetCollection * pyNetCollection = NULL ;
2008-03-06 10:46:43 -06:00
HTRY
2008-10-14 13:44:20 -05:00
Nets * nets = new Nets ( cell - > getNets ( ) ) ;
2008-03-06 10:46:43 -06:00
2008-10-14 13:44:20 -05:00
pyNetCollection = PyObject_NEW ( PyNetCollection , & PyTypeNetCollection ) ;
if ( pyNetCollection = = NULL ) {
return NULL ;
}
2008-03-06 10:46:43 -06:00
2008-10-14 05:48:53 -05:00
pyNetCollection - > _object = nets ;
2008-03-06 10:46:43 -06:00
HCATCH
2008-10-14 13:44:20 -05:00
2008-10-14 05:48:53 -05:00
return ( ( PyObject * ) pyNetCollection ) ;
2008-03-06 10:46:43 -06:00
}
// ---------------------------------------------------------------
2008-10-14 13:44:20 -05:00
// Attribute Method : "PyCell_getExternalNets()"
2008-03-06 10:46:43 -06:00
2008-10-14 13:44:20 -05:00
static PyObject * PyCell_getExternalNets ( PyCell * self ) {
trace < < " PyCell_getExternalNets() " < < endl ;
2008-03-06 10:46:43 -06:00
2008-10-14 13:44:20 -05:00
METHOD_HEAD ( " Cell.getExternalNets() " )
2008-03-06 10:46:43 -06:00
2008-10-14 13:44:20 -05:00
PyNetCollection * pyNetCollection = NULL ;
2008-03-06 10:46:43 -06:00
HTRY
2008-10-14 13:44:20 -05:00
Nets * nets = new Nets ( cell - > getExternalNets ( ) ) ;
2008-03-06 10:46:43 -06:00
2008-10-14 13:44:20 -05:00
pyNetCollection = PyObject_NEW ( PyNetCollection , & PyTypeNetCollection ) ;
if ( pyNetCollection = = NULL ) {
return NULL ;
}
pyNetCollection - > _object = nets ;
2008-03-06 10:46:43 -06:00
HCATCH
2008-10-14 13:44:20 -05:00
return ( ( PyObject * ) pyNetCollection ) ;
2008-03-06 10:46:43 -06:00
}
// ---------------------------------------------------------------
2008-10-14 13:44:20 -05:00
// Attribute Method : "PyCell_getClockNets()"
2008-03-06 10:46:43 -06:00
2008-10-14 13:44:20 -05:00
static PyObject * PyCell_getClockNets ( PyCell * self ) {
trace < < " PyCell_getClockNets() " < < endl ;
2008-03-06 10:46:43 -06:00
2008-10-14 13:44:20 -05:00
METHOD_HEAD ( " Cell.getClockNets " )
2008-03-06 10:46:43 -06:00
2008-10-14 13:44:20 -05:00
PyNetCollection * pyNetCollection = NULL ;
2008-03-06 10:46:43 -06:00
HTRY
2008-10-14 13:44:20 -05:00
Nets * nets = new Nets ( cell - > getClockNets ( ) ) ;
2008-03-06 10:46:43 -06:00
2008-10-14 13:44:20 -05:00
pyNetCollection = PyObject_NEW ( PyNetCollection , & PyTypeNetCollection ) ;
if ( pyNetCollection = = NULL ) {
return NULL ;
}
pyNetCollection - > _object = nets ;
2008-03-06 10:46:43 -06:00
HCATCH
2008-10-14 13:44:20 -05:00
return ( ( PyObject * ) pyNetCollection ) ;
2008-03-06 10:46:43 -06:00
}
// ---------------------------------------------------------------
2008-10-14 13:44:20 -05:00
// Attribute Method : "PyCell_getSupplyNets()"
2008-03-06 10:46:43 -06:00
2008-10-14 13:44:20 -05:00
static PyObject * PyCell_getSupplyNets ( PyCell * self ) {
trace < < " PyCell_getSupplyNets() " < < endl ;
2008-03-06 10:46:43 -06:00
2008-10-14 13:44:20 -05:00
METHOD_HEAD ( " Cell.getSupplyNets() " )
2008-03-06 10:46:43 -06:00
2008-10-14 13:44:20 -05:00
PyNetCollection * pyNetCollection = NULL ;
2008-03-06 10:46:43 -06:00
HTRY
2008-10-14 13:44:20 -05:00
Nets * nets = new Nets ( cell - > getSupplyNets ( ) ) ;
2008-03-06 10:46:43 -06:00
2008-10-14 13:44:20 -05:00
pyNetCollection = PyObject_NEW ( PyNetCollection , & PyTypeNetCollection ) ;
if ( pyNetCollection = = NULL ) {
return NULL ;
}
pyNetCollection - > _object = nets ;
2008-03-06 10:46:43 -06:00
HCATCH
2008-10-14 13:44:20 -05:00
return ( ( PyObject * ) pyNetCollection ) ;
2008-03-06 10:46:43 -06:00
}
// ---------------------------------------------------------------
2008-10-14 13:44:20 -05:00
// Attribute Method : "PyCell_getPowerNets()"
2008-03-06 10:46:43 -06:00
2008-10-14 13:44:20 -05:00
static PyObject * PyCell_getPowerNets ( PyCell * self ) {
trace < < " PyCell_getPowerNets() " < < endl ;
2008-03-06 10:46:43 -06:00
2008-10-14 13:44:20 -05:00
METHOD_HEAD ( " Cell.getPowerNets() " )
2008-03-06 10:46:43 -06:00
2008-10-14 13:44:20 -05:00
PyNetCollection * pyNetCollection = NULL ;
2008-03-06 10:46:43 -06:00
HTRY
2008-10-14 13:44:20 -05:00
Nets * nets = new Nets ( cell - > getPowerNets ( ) ) ;
2008-03-06 10:46:43 -06:00
2008-10-14 13:44:20 -05:00
pyNetCollection = PyObject_NEW ( PyNetCollection , & PyTypeNetCollection ) ;
if ( pyNetCollection = = NULL ) {
return NULL ;
}
pyNetCollection - > _object = nets ;
2008-03-06 10:46:43 -06:00
HCATCH
2008-10-14 13:44:20 -05:00
return ( ( PyObject * ) pyNetCollection ) ;
2008-03-06 10:46:43 -06:00
}
// ---------------------------------------------------------------
2008-10-14 13:44:20 -05:00
// Attribute Method : "PyCell_getGroundNets()"
2008-03-06 10:46:43 -06:00
2008-10-14 13:44:20 -05:00
static PyObject * PyCell_getGroundNets ( PyCell * self ) {
trace < < " PyCell_getGroundNets() " < < endl ;
2008-03-06 10:46:43 -06:00
2008-10-14 13:44:20 -05:00
METHOD_HEAD ( " Cell.getGroundNets() " )
2008-03-06 10:46:43 -06:00
2008-10-14 13:44:20 -05:00
PyNetCollection * pyNetCollection = NULL ;
2008-03-06 10:46:43 -06:00
HTRY
2008-10-14 13:44:20 -05:00
Nets * nets = new Nets ( cell - > getGroundNets ( ) ) ;
2008-03-06 10:46:43 -06:00
2008-10-14 13:44:20 -05:00
pyNetCollection = PyObject_NEW ( PyNetCollection , & PyTypeNetCollection ) ;
if ( pyNetCollection = = NULL ) {
return NULL ;
}
pyNetCollection - > _object = nets ;
2008-03-06 10:46:43 -06:00
HCATCH
2008-10-14 13:44:20 -05:00
return ( ( PyObject * ) pyNetCollection ) ;
2008-03-06 10:46:43 -06:00
}
// ---------------------------------------------------------------
2008-03-17 08:54:33 -05:00
// Attribute Method : "PyCell_getAbutmentBox ()"
2008-03-06 10:46:43 -06:00
2008-03-17 08:54:33 -05:00
static PyObject * PyCell_getAbutmentBox ( PyCell * self ) {
trace < < " PyCell_getAbutmentBox() " < < endl ;
2008-03-06 10:46:43 -06:00
2008-03-17 08:54:33 -05:00
METHOD_HEAD ( " Cell.getAbutmentBox() " )
2008-03-06 10:46:43 -06:00
PyBox * abutmentBox = PyObject_NEW ( PyBox , & PyTypeBox ) ;
if ( abutmentBox = = NULL ) { return NULL ; }
HTRY
2008-03-17 08:54:33 -05:00
abutmentBox - > _object = new Box ( cell - > getAbutmentBox ( ) ) ;
2008-03-06 10:46:43 -06:00
HCATCH
return ( ( PyObject * ) abutmentBox ) ;
}
// ---------------------------------------------------------------
2008-03-22 08:18:26 -05:00
// Attribute Method : "PyCell_setName ()"
2008-03-06 10:46:43 -06:00
2008-12-11 06:25:02 -06:00
SetNameMethod ( Cell , cell )
2008-03-06 10:46:43 -06:00
// ---------------------------------------------------------------
2008-03-22 08:18:26 -05:00
// Attribute Method : "PyCell_setAbutmentBox ()"
2008-03-06 10:46:43 -06:00
2008-03-22 08:18:26 -05:00
static PyObject * PyCell_setAbutmentBox ( PyCell * self , PyObject * args ) {
trace < < " Cell.setAbutmentBox() " < < endl ;
2008-03-06 10:46:43 -06:00
HTRY
2008-03-22 08:18:26 -05:00
METHOD_HEAD ( " Cell.setAbutmentBox() " )
2008-03-06 10:46:43 -06:00
2008-12-12 12:49:17 -06:00
PyBox * pyBox ;
2012-12-04 06:29:45 -06:00
if ( ! PyArg_ParseTuple ( args , " O!:Cell.setAbutmentBox " , & PyTypeBox , & pyBox ) ) {
2008-10-17 12:27:20 -05:00
return NULL ;
2008-12-12 12:49:17 -06:00
}
cell - > setAbutmentBox ( * PYBOX_O ( pyBox ) ) ;
2008-03-06 10:46:43 -06:00
HCATCH
Py_RETURN_NONE ;
}
// ---------------------------------------------------------------
2008-03-22 08:18:26 -05:00
// Attribute Method : "PyCell_setTerminal ()"
2008-03-06 10:46:43 -06:00
2008-03-22 08:18:26 -05:00
static PyObject * PyCell_setTerminal ( PyCell * self , PyObject * args ) {
trace < < " PyCell_setTerminal () " < < endl ;
2008-03-06 10:46:43 -06:00
HTRY
2008-03-22 08:18:26 -05:00
METHOD_HEAD ( " Cell.setTerminal() " )
2008-03-06 10:46:43 -06:00
PyObject * arg0 ;
2008-12-12 12:49:17 -06:00
if ( ! PyArg_ParseTuple ( args , " O:Cell.setTerminal " , & arg0 ) & & PyBool_Check ( arg0 ) ) {
return NULL ;
}
2012-11-16 06:48:38 -06:00
PyObject_IsTrue ( arg0 ) ? cell - > setTerminal ( true ) : cell - > setTerminal ( false ) ;
2008-03-06 10:46:43 -06:00
HCATCH
Py_RETURN_NONE ;
}
// Standart Predicates (Attributes).
2008-03-22 08:18:26 -05:00
DirectGetBoolAttribute ( PyCell_isTerminal , isTerminal , PyCell , Cell )
DirectGetBoolAttribute ( PyCell_isLeaf , isLeaf , PyCell , Cell )
2008-03-06 10:46:43 -06:00
2008-03-22 08:18:26 -05:00
GetBoundStateAttribute ( PyCell_isPyBound , PyCell , Cell )
2008-03-06 10:46:43 -06:00
// ---------------------------------------------------------------
// PyCell Attribute Method table.
PyMethodDef PyCell_Methods [ ] =
2008-03-17 08:54:33 -05:00
{ { " getLibrary " , ( PyCFunction ) PyCell_getLibrary , METH_NOARGS , " Returns the library owning the cell. " }
, { " getName " , ( PyCFunction ) PyCell_getName , METH_NOARGS , " Returns the name of the cell. " }
, { " getInstance " , ( PyCFunction ) PyCell_getInstance , METH_VARARGS , " Returns the instance of name <name> if it exists, else NULL. " }
2008-10-17 12:27:20 -05:00
, { " getInstances " , ( PyCFunction ) PyCell_getInstances , METH_NOARGS , " Returns the locator of the collection of all instances called by the cell. " } // getInstances
, { " getInstancesUnder " , ( PyCFunction ) PyCell_getInstancesUnder , METH_VARARGS , " Returns the locator of the collection of all instances of the cell intersecting the given rectangular area. " } // getInstancesUnder
, { " getSlaveInstances " , ( PyCFunction ) PyCell_getSlaveInstances , METH_NOARGS , " Returns the locator of the collection of instances whose master is this cell. " } // getSlaveInstances
, { " getOccurrences " , ( PyCFunction ) PyCell_getOccurrences , METH_VARARGS , " Returns the collection of all occurrences belonging to the cell. " }
, { " getOccurrencesUnder " , ( PyCFunction ) PyCell_getOccurrencesUnder , METH_NOARGS , " Returns the collection of all occurrences belonging to this cell and intersecting the given rectangular area. " }
, { " getLeafInstanceOccurrences " , ( PyCFunction ) PyCell_getLeafInstanceOccurrences , METH_VARARGS , " Returns the collection of all occurrences belonging to the cell. " }
, { " getLeafInstanceOccurrencesUnder " , ( PyCFunction ) PyCell_getLeafInstanceOccurrencesUnder , METH_NOARGS , " Returns the collection of all occurrences belonging to this cell and intersecting the given rectangular area. " }
, { " getReferences " , ( PyCFunction ) PyCell_getReferences , METH_VARARGS , " Returns the collection of all references belonging to the cell. " }
, { " getHyperNets " , ( PyCFunction ) PyCell_getHyperNets , METH_VARARGS , " Returns the collection of all hyperNets belonging to the cell. " }
2008-03-17 08:54:33 -05:00
, { " getNet " , ( PyCFunction ) PyCell_getNet , METH_VARARGS , " Returns the net of name <name> if it exists, else NULL. " }
2008-10-14 05:48:53 -05:00
, { " getNets " , ( PyCFunction ) PyCell_getNets , METH_NOARGS , " Returns the collection of all nets of the cell. " }
2008-10-14 13:44:20 -05:00
, { " getExternalNets " , ( PyCFunction ) PyCell_getExternalNets , METH_NOARGS , " Returns the collection of all external nets of the cell. " }
, { " getClockNets " , ( PyCFunction ) PyCell_getClockNets , METH_NOARGS , " Returns the collection of all clock nets of the cell. " }
, { " getSupplyNets " , ( PyCFunction ) PyCell_getSupplyNets , METH_NOARGS , " Returns the collection of all supply nets of the cell. " }
, { " getPowerNets " , ( PyCFunction ) PyCell_getPowerNets , METH_NOARGS , " Returns the collection of all power nets of the cell. " }
, { " getGroundNets " , ( PyCFunction ) PyCell_getGroundNets , METH_NOARGS , " Returns the collection of all ground nets of the cell. " }
2008-03-17 08:54:33 -05:00
, { " getAbutmentBox " , ( PyCFunction ) PyCell_getAbutmentBox , METH_NOARGS , " Returns the abutment box of the cell(which is defined by the designer unlike the bounding box which is managed dynamically) " }
2008-03-22 08:18:26 -05:00
, { " isTerminal " , ( PyCFunction ) PyCell_isTerminal , METH_NOARGS , " Returns true if the cell is marked as terminal, else false. " }
, { " isLeaf " , ( PyCFunction ) PyCell_isLeaf , METH_NOARGS , " Returns true if the cell is a leaf of the hierarchy, else false. " }
, { " isBound " , ( PyCFunction ) PyCell_isPyBound , METH_NOARGS , " Returns true if the cell is bounded to the hurricane cell " }
, { " setName " , ( PyCFunction ) PyCell_setName , METH_VARARGS , " Allows to change the cell name. " }
, { " setAbutmentBox " , ( PyCFunction ) PyCell_setAbutmentBox , METH_VARARGS , " Sets the cell abutment box. " }
, { " setTerminal " , ( PyCFunction ) PyCell_setTerminal , METH_VARARGS , " Sets the cell terminal status. " }
, { " destroy " , ( PyCFunction ) PyCell_destroy , METH_NOARGS
2008-03-17 08:54:33 -05:00
, " Destroy associated hurricane object The python object remains. " }
2008-03-06 10:46:43 -06:00
, { NULL , NULL , 0 , NULL } /* sentinel */
} ;
// x-------------------------------------------------------------x
// | "PyCell" Object Methods |
// x-------------------------------------------------------------x
2009-09-30 10:11:49 -05:00
DBoDeleteMethod ( Cell )
PyTypeObjectLinkPyType ( Cell )
# else // End of Python Module Code Part.
// x=================================================================x
// | "PyCell" Shared Library Code Part |
// x=================================================================x
// ---------------------------------------------------------------
// Attribute Method : "PyCell_create ()"
PyObject * PyCell_create ( PyObject * module , PyObject * args ) {
trace < < " PyCell_create() " < < endl ;
2008-03-06 10:46:43 -06:00
2008-12-10 12:37:32 -06:00
char * name = NULL ;
PyLibrary * pyLibrary = NULL ;
2008-03-06 10:46:43 -06:00
Cell * cell = NULL ;
HTRY
2009-09-30 10:11:49 -05:00
if ( PyArg_ParseTuple ( args , " O!s:Cell.create " , & PyTypeLibrary , & pyLibrary , & name ) ) {
2008-12-10 12:37:32 -06:00
cell = Cell : : create ( PYLIBRARY_O ( pyLibrary ) , Name ( name ) ) ;
} else {
PyErr_SetString ( ConstructorError , " invalid number of parameters for Cell constructor. " ) ;
return NULL ;
}
2008-03-06 10:46:43 -06:00
HCATCH
return PyCell_Link ( cell ) ;
}
// Link/Creation Method.
2008-10-12 08:37:33 -05:00
DBoLinkCreateMethod ( Cell )
2008-03-06 10:46:43 -06:00
// ---------------------------------------------------------------
// PyCell Object Definitions.
2009-09-30 10:11:49 -05:00
PyTypeInheritedObjectDefinitions ( Cell , Entity )
2008-03-06 10:46:43 -06:00
# endif // End of Shared Library Code Part.
} // End of extern "C".
} // End of Isobar namespace.