2008-03-06 10:46:43 -06:00
// -*- C++ -*-
//
// This file is part of the Coriolis Project.
// Copyright (C) Laboratoire LIP6 - Departement ASIM
// Universite Pierre et Marie Curie
//
// Main contributors :
// Christophe Alexandre <Christophe.Alexandre@lip6.fr>
// Sophie Belloeil <Sophie.Belloeil@lip6.fr>
// Hugo Cl<43> ment <Hugo.Clement@lip6.fr>
// Jean-Paul Chaput <Jean-Paul.Chaput@lip6.fr>
// Damien Dupuis <Damien.Dupuis@lip6.fr>
// Christian Masson <Christian.Masson@lip6.fr>
// Marek Sroka <Marek.Sroka@lip6.fr>
//
// The Coriolis Project is free software; you can redistribute it
// and/or modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2 of
// the License, or (at your option) any later version.
//
// The Coriolis Project is distributed in the hope that it will be
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with the Coriolis Project; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA
//
// License-Tag
// Authors-Tag
// ===================================================================
//
// $Id: PyCell.cpp,v 1.34 2008/02/07 17:09:41 xtof Exp $
//
// 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/PyName.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"
# include "hurricane/isobar/PyNetLocator.h"
# include "hurricane/isobar/PyReferenceLocator.h"
# include "hurricane/isobar/PyInstanceLocator.h"
# include "hurricane/isobar/PyOccurrenceLocator.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
return PyLibrary_Link ( library ) ;
}
// ---------------------------------------------------------------
2008-03-17 08:54:33 -05:00
// Attribute Method : "PyCell_getName ()"
2008-03-06 10:46:43 -06:00
2008-03-17 08:54:33 -05:00
static PyObject * PyCell_getName ( PyCell * self ) {
trace < < " PyCell_getName () " < < endl ;
2008-03-06 10:46:43 -06:00
2008-03-17 08:54:33 -05:00
METHOD_HEAD ( " Cell.getName() " )
2008-03-06 10:46:43 -06:00
PyName * pyName = PyObject_NEW ( PyName , & PyTypeName ) ;
if ( pyName = = NULL ) { return NULL ; }
HTRY
2008-03-17 08:54:33 -05:00
pyName - > _object = new Name ( cell - > getName ( ) ) ;
2008-03-06 10:46:43 -06:00
HCATCH
return ( ( PyObject * ) pyName ) ;
}
// ---------------------------------------------------------------
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-03-06 10:46:43 -06:00
Instance * instance = NULL ;
HTRY
2008-03-17 08:54:33 -05:00
METHOD_HEAD ( " Cell.getInstance() " )
2008-03-06 10:46:43 -06:00
PyName * arg0 ;
2008-03-17 08:54:33 -05:00
if ( ! ParseOneArg ( " Cell.getInstance " , args , NAME_ARG , ( PyObject * * ) & arg0 ) ) return ( NULL ) ;
2008-03-06 10:46:43 -06:00
2008-03-17 08:54:33 -05:00
instance = cell - > getInstance ( * PYNAME_O ( arg0 ) ) ;
2008-03-06 10:46:43 -06:00
HCATCH
return PyInstance_Link ( instance ) ;
}
// ---------------------------------------------------------------
2008-03-17 08:54:33 -05:00
// Attribute Method : "PyCell_getInstancesLocator ()"
2008-03-06 10:46:43 -06:00
2008-03-17 08:54:33 -05:00
static PyObject * PyCell_getInstancesLocator ( PyCell * self ) {
trace < < " PyCell_getInstancesLocator () " < < endl ;
2008-03-06 10:46:43 -06:00
2008-03-17 08:54:33 -05:00
METHOD_HEAD ( " Cell.getInstancesLocator() " )
2008-03-06 10:46:43 -06:00
2008-03-17 08:54:33 -05:00
Instances instances = cell - > getInstances ( ) ;
2008-03-06 10:46:43 -06:00
PyInstanceLocator * pyInstanceLocator = PyObject_NEW ( PyInstanceLocator , & PyTypeInstanceLocator ) ;
if ( pyInstanceLocator = = NULL ) { return NULL ; }
HTRY
2008-03-17 08:54:33 -05:00
pyInstanceLocator - > _object = instances . getLocator ( ) ;
2008-03-06 10:46:43 -06:00
HCATCH
return ( ( PyObject * ) pyInstanceLocator ) ;
}
// ---------------------------------------------------------------
2008-03-17 08:54:33 -05:00
// Attribute Method : "PyCell_getInstancesUnderLocator ()"
2008-03-06 10:46:43 -06:00
2008-03-17 08:54:33 -05:00
static PyObject * PyCell_getInstancesUnderLocator ( PyCell * self , PyObject * args ) {
2008-03-06 10:46:43 -06:00
PyInstanceLocator * pyInstanceLocator ;
2008-03-17 08:54:33 -05:00
trace < < " PyCell_getInstancesUnderLocator () " < < endl ;
2008-03-06 10:46:43 -06:00
2008-03-17 08:54:33 -05:00
METHOD_HEAD ( " Cell.getInstancesUnderLocator() " )
2008-03-06 10:46:43 -06:00
PyBox * arg0 ;
2008-03-17 08:54:33 -05:00
if ( ! ParseOneArg ( " Cell.getInstancesUnderLocator " , args , BOX_ARG , ( PyObject * * ) & arg0 ) ) return ( NULL ) ;
2008-03-06 10:46:43 -06:00
2008-03-17 08:54:33 -05:00
Instances instances = cell - > getInstancesUnder ( * PYBOX_O ( arg0 ) ) ;
2008-03-06 10:46:43 -06:00
pyInstanceLocator = PyObject_NEW ( PyInstanceLocator , & PyTypeInstanceLocator ) ;
if ( pyInstanceLocator = = NULL ) { return NULL ; }
HTRY
2008-03-17 08:54:33 -05:00
pyInstanceLocator - > _object = instances . getLocator ( ) ;
2008-03-06 10:46:43 -06:00
HCATCH
return ( ( PyObject * ) pyInstanceLocator ) ;
}
// ---------------------------------------------------------------
2008-03-17 08:54:33 -05:00
// Attribute Method : "PyCell_getSlaveInstancesLocator ()"
2008-03-06 10:46:43 -06:00
2008-03-17 08:54:33 -05:00
static PyObject * PyCell_getSlaveInstancesLocator ( PyCell * self ) {
trace < < " PyCell_getSlaveInstancesLocator () " < < endl ;
2008-03-06 10:46:43 -06:00
2008-03-17 08:54:33 -05:00
METHOD_HEAD ( " Cell.getSlaveInstancesLocator() " )
2008-03-06 10:46:43 -06:00
2008-03-17 08:54:33 -05:00
Instances instances = cell - > getSlaveInstances ( ) ;
2008-03-06 10:46:43 -06:00
PyInstanceLocator * pyInstanceLocator = PyObject_NEW ( PyInstanceLocator , & PyTypeInstanceLocator ) ;
if ( pyInstanceLocator = = NULL ) { return NULL ; }
HTRY
2008-03-17 08:54:33 -05:00
pyInstanceLocator - > _object = instances . getLocator ( ) ;
2008-03-06 10:46:43 -06:00
HCATCH
return ( ( PyObject * ) pyInstanceLocator ) ;
}
// ---------------------------------------------------------------
2008-03-17 08:54:33 -05:00
// Attribute Method : "PyCell_getOccurrencesLocator ()"
2008-03-06 10:46:43 -06:00
2008-03-17 08:54:33 -05:00
static PyObject * PyCell_getOccurrencesLocator ( PyCell * self ) {
trace < < " PyCell_getOccurrencesLocator () " < < endl ;
2008-03-06 10:46:43 -06:00
2008-03-17 08:54:33 -05:00
METHOD_HEAD ( " Cell.getOccurrencesLocator() " )
2008-03-06 10:46:43 -06:00
2008-03-17 08:54:33 -05:00
Occurrences occurrences = cell - > getOccurrences ( ) ;
2008-03-06 10:46:43 -06:00
PyOccurrenceLocator * pyOccurrenceLocator = PyObject_NEW ( PyOccurrenceLocator , & PyTypeOccurrenceLocator ) ;
if ( pyOccurrenceLocator = = NULL ) { return NULL ; }
HTRY
2008-03-17 08:54:33 -05:00
pyOccurrenceLocator - > _object = occurrences . getLocator ( ) ;
2008-03-06 10:46:43 -06:00
HCATCH
return ( ( PyObject * ) pyOccurrenceLocator ) ;
}
// ---------------------------------------------------------------
2008-03-17 08:54:33 -05:00
// Attribute Method : "PyCell_getOccurrencesUnderLocator ()"
2008-03-06 10:46:43 -06:00
2008-03-17 08:54:33 -05:00
static PyObject * PyCell_getOccurrencesUnderLocator ( PyCell * self , PyObject * args ) {
trace < < " PyCell_getOccurrencesUnderLocator () " < < endl ;
2008-03-06 10:46:43 -06:00
2008-03-17 08:54:33 -05:00
METHOD_HEAD ( " Cell.getOccurrencesUnderLocator() " )
2008-03-06 10:46:43 -06:00
PyBox * arg0 ;
2008-03-17 08:54:33 -05:00
if ( ! ParseOneArg ( " Cell.getInstancesUnderLocator " , args , BOX_ARG , ( PyObject * * ) & arg0 ) ) return ( NULL ) ;
2008-03-06 10:46:43 -06:00
PyOccurrenceLocator * pyOccurrenceLocator = PyObject_NEW ( PyOccurrenceLocator , & PyTypeOccurrenceLocator ) ;
if ( pyOccurrenceLocator = = NULL ) { return NULL ; }
HTRY
2008-03-17 08:54:33 -05:00
Occurrences occurrences = cell - > getOccurrencesUnder ( * PYBOX_O ( arg0 ) ) ;
pyOccurrenceLocator - > _object = occurrences . getLocator ( ) ;
2008-03-06 10:46:43 -06:00
HCATCH
return ( ( PyObject * ) pyOccurrenceLocator ) ;
}
// ---------------------------------------------------------------
2008-03-17 08:54:33 -05:00
// Attribute Method : "PyCell_getLeafInstanceOccurrencesLocator ()"
2008-03-06 10:46:43 -06:00
2008-03-17 08:54:33 -05:00
static PyObject * PyCell_getLeafInstanceOccurrencesLocator ( PyCell * self ) {
trace < < " PyCell_getLeafInstanceOccurrencesLocator () " < < endl ;
2008-03-06 10:46:43 -06:00
2008-03-17 08:54:33 -05:00
METHOD_HEAD ( " Cell.getLeafInstanceOccurrencesLocator() " )
2008-03-06 10:46:43 -06:00
2008-03-17 08:54:33 -05:00
Occurrences occurrences = cell - > getLeafInstanceOccurrences ( ) ;
2008-03-06 10:46:43 -06:00
PyOccurrenceLocator * pyOccurrenceLocator = PyObject_NEW ( PyOccurrenceLocator , & PyTypeOccurrenceLocator ) ;
if ( pyOccurrenceLocator = = NULL ) { return NULL ; }
HTRY
2008-03-17 08:54:33 -05:00
pyOccurrenceLocator - > _object = occurrences . getLocator ( ) ;
2008-03-06 10:46:43 -06:00
HCATCH
return ( ( PyObject * ) pyOccurrenceLocator ) ;
}
// ---------------------------------------------------------------
2008-03-17 08:54:33 -05:00
// Attribute Method : "PyCell_getLeafInstanceOccurrencesUnderLocator ()"
2008-03-06 10:46:43 -06:00
2008-03-17 08:54:33 -05:00
static PyObject * PyCell_getLeafInstanceOccurrencesUnderLocator ( PyCell * self , PyObject * args ) {
trace < < " PyCell_getLeafInstanceOccurrencesUnderLocator () " < < endl ;
2008-03-06 10:46:43 -06:00
2008-03-17 08:54:33 -05:00
METHOD_HEAD ( " Cell.getLeafInstanceOccurrencesUnderLocator() " )
2008-03-06 10:46:43 -06:00
PyBox * arg0 ;
2008-03-17 08:54:33 -05:00
if ( ! ParseOneArg ( " Cell.getLeafInstanceOccurencesUnderLocator " , args , BOX_ARG , ( PyObject * * ) & arg0 ) ) return ( NULL ) ;
2008-03-06 10:46:43 -06:00
PyOccurrenceLocator * pyOccurrenceLocator = PyObject_NEW ( PyOccurrenceLocator , & PyTypeOccurrenceLocator ) ;
if ( pyOccurrenceLocator = = NULL ) { return NULL ; }
HTRY
2008-03-17 08:54:33 -05:00
Occurrences occurrences = cell - > getLeafInstanceOccurrencesUnder ( * PYBOX_O ( arg0 ) ) ;
//pyOccurrenceLocator->_object = new locator ( instances.getLocator () );
pyOccurrenceLocator - > _object = occurrences . getLocator ( ) ;
2008-03-06 10:46:43 -06:00
HCATCH
return ( ( PyObject * ) pyOccurrenceLocator ) ;
}
// ---------------------------------------------------------------
2008-03-17 08:54:33 -05:00
// Attribute Method : "PyCell_getReferencesLocator ()"
2008-03-06 10:46:43 -06:00
2008-03-17 08:54:33 -05:00
static PyObject * PyCell_getReferencesLocator ( PyCell * self ) {
trace < < " PyCell_getReferencesLocator () " < < endl ;
2008-03-06 10:46:43 -06:00
2008-03-17 08:54:33 -05:00
METHOD_HEAD ( " Cell.getReferencesLocator() " )
2008-03-06 10:46:43 -06:00
2008-03-17 08:54:33 -05:00
References references = cell - > getReferences ( ) ;
2008-03-06 10:46:43 -06:00
PyReferenceLocator * pyReferenceLocator = PyObject_NEW ( PyReferenceLocator , & PyTypeReferenceLocator ) ;
if ( pyReferenceLocator = = NULL ) { return NULL ; }
HTRY
2008-03-17 08:54:33 -05:00
pyReferenceLocator - > _object = references . getLocator ( ) ;
2008-03-06 10:46:43 -06:00
HCATCH
return ( ( PyObject * ) pyReferenceLocator ) ;
}
// ---------------------------------------------------------------
2008-03-17 08:54:33 -05:00
// Attribute Method : "PyCell_getHyperNetsLocator ()"
2008-03-06 10:46:43 -06:00
2008-03-17 08:54:33 -05:00
static PyObject * PyCell_getHyperNetsLocator ( PyCell * self ) {
trace < < " PyCell_getHyperNetsLocator () " < < endl ;
2008-03-06 10:46:43 -06:00
2008-03-17 08:54:33 -05:00
METHOD_HEAD ( " Cell.getHyperNetsLocator() " )
2008-03-06 10:46:43 -06:00
2008-03-17 08:54:33 -05:00
Occurrences occurrences = cell - > getHyperNetRootNetOccurrences ( ) ;
2008-03-06 10:46:43 -06:00
PyOccurrenceLocator * pyOccurrenceLocator = PyObject_NEW ( PyOccurrenceLocator , & PyTypeOccurrenceLocator ) ;
if ( pyOccurrenceLocator = = NULL ) { return NULL ; }
HTRY
2008-03-17 08:54:33 -05:00
pyOccurrenceLocator - > _object = occurrences . getLocator ( ) ;
2008-03-06 10:46:43 -06:00
HCATCH
return ( ( PyObject * ) pyOccurrenceLocator ) ;
}
// ---------------------------------------------------------------
2008-03-17 08:54:33 -05:00
// Attribute Method : "PyCell_getNet ()"
2008-03-06 10:46:43 -06:00
2008-03-17 08:54:33 -05:00
static PyObject * PyCell_getNet ( PyCell * self , PyObject * args ) {
trace < < " PyCell_getNet () " < < endl ;
2008-03-06 10:46:43 -06:00
Net * net = NULL ;
HTRY
2008-03-17 08:54:33 -05:00
METHOD_HEAD ( " Cell.getNet() " )
2008-03-06 10:46:43 -06:00
PyName * arg0 ;
2008-03-17 08:54:33 -05:00
if ( ! ParseOneArg ( " Cell.getNet " , args , NAME_ARG , ( PyObject * * ) & arg0 ) ) return ( NULL ) ;
2008-03-06 10:46:43 -06:00
2008-03-17 08:54:33 -05:00
net = cell - > getNet ( * PYNAME_O ( arg0 ) ) ;
2008-03-06 10:46:43 -06:00
HCATCH
return PyNet_Link ( net ) ;
}
// ---------------------------------------------------------------
2008-03-17 08:54:33 -05:00
// Attribute Method : "PyCell_getNetsLocator ()"
2008-03-06 10:46:43 -06:00
2008-03-17 08:54:33 -05:00
static PyObject * PyCell_getNetsLocator ( PyCell * self ) {
trace < < " PyCell_getNetsLocator () " < < endl ;
2008-03-06 10:46:43 -06:00
2008-03-17 08:54:33 -05:00
METHOD_HEAD ( " Cell.getNetsLocator() " )
2008-03-06 10:46:43 -06:00
PyNetLocator * pyNetLocator = NULL ;
HTRY
2008-03-17 08:54:33 -05:00
Nets nets = cell - > getNets ( ) ;
2008-03-06 10:46:43 -06:00
pyNetLocator = PyObject_NEW ( PyNetLocator , & PyTypeNetLocator ) ;
if ( pyNetLocator = = NULL ) { return NULL ; }
2008-03-17 08:54:33 -05:00
pyNetLocator - > _object = nets . getLocator ( ) ;
2008-03-06 10:46:43 -06:00
HCATCH
return ( ( PyObject * ) pyNetLocator ) ;
}
// ---------------------------------------------------------------
2008-03-17 08:54:33 -05:00
// Attribute Method : "PyCell_getExternalNetsLocator ()"
2008-03-06 10:46:43 -06:00
2008-03-17 08:54:33 -05:00
static PyObject * PyCell_getExternalNetsLocator ( PyCell * self ) {
trace < < " PyCell_getExternalNetsLocator () " < < endl ;
2008-03-06 10:46:43 -06:00
2008-03-17 08:54:33 -05:00
METHOD_HEAD ( " Cell.getExternalNetsLocator() " )
2008-03-06 10:46:43 -06:00
PyNetLocator * pyNetLocator = NULL ;
HTRY
2008-03-17 08:54:33 -05:00
Nets nets = cell - > getExternalNets ( ) ;
2008-03-06 10:46:43 -06:00
pyNetLocator = PyObject_NEW ( PyNetLocator , & PyTypeNetLocator ) ;
if ( pyNetLocator = = NULL ) { return NULL ; }
2008-03-17 08:54:33 -05:00
pyNetLocator - > _object = nets . getLocator ( ) ;
2008-03-06 10:46:43 -06:00
HCATCH
return ( ( PyObject * ) pyNetLocator ) ;
}
// ---------------------------------------------------------------
2008-03-17 08:54:33 -05:00
// Attribute Method : "PyCell_getClockNetsLocator ()"
2008-03-06 10:46:43 -06:00
2008-03-17 08:54:33 -05:00
static PyObject * PyCell_getClockNetsLocator ( PyCell * self ) {
trace < < " PyCell_getClockNetsLocator () " < < endl ;
2008-03-06 10:46:43 -06:00
2008-03-17 08:54:33 -05:00
METHOD_HEAD ( " Cell.getClockNetsLocator() " )
2008-03-06 10:46:43 -06:00
PyNetLocator * pyNetLocator = NULL ;
HTRY
2008-03-17 08:54:33 -05:00
Nets nets = cell - > getClockNets ( ) ;
2008-03-06 10:46:43 -06:00
pyNetLocator = PyObject_NEW ( PyNetLocator , & PyTypeNetLocator ) ;
if ( pyNetLocator = = NULL ) { return NULL ; }
2008-03-17 08:54:33 -05:00
pyNetLocator - > _object = nets . getLocator ( ) ;
2008-03-06 10:46:43 -06:00
HCATCH
return ( ( PyObject * ) pyNetLocator ) ;
}
// ---------------------------------------------------------------
2008-03-17 08:54:33 -05:00
// Attribute Method : "PyCell_getSupplyNetsLocator ()"
2008-03-06 10:46:43 -06:00
2008-03-17 08:54:33 -05:00
static PyObject * PyCell_getSupplyNetsLocator ( PyCell * self ) {
trace < < " PyCell_getSupplyNetsLocator () " < < endl ;
2008-03-06 10:46:43 -06:00
2008-03-17 08:54:33 -05:00
METHOD_HEAD ( " Cell.getSupplyNetsLocator() " )
2008-03-06 10:46:43 -06:00
PyNetLocator * pyNetLocator = NULL ;
HTRY
2008-03-17 08:54:33 -05:00
Nets nets = cell - > getSupplyNets ( ) ;
2008-03-06 10:46:43 -06:00
pyNetLocator = PyObject_NEW ( PyNetLocator , & PyTypeNetLocator ) ;
if ( pyNetLocator = = NULL ) { return NULL ; }
2008-03-17 08:54:33 -05:00
pyNetLocator - > _object = nets . getLocator ( ) ;
2008-03-06 10:46:43 -06:00
HCATCH
return ( ( PyObject * ) pyNetLocator ) ;
}
// ---------------------------------------------------------------
2008-03-17 08:54:33 -05:00
// Attribute Method : "PyCell_getPowerNetsLocator ()"
2008-03-06 10:46:43 -06:00
2008-03-17 08:54:33 -05:00
static PyObject * PyCell_getPowerNetsLocator ( PyCell * self )
2008-03-06 10:46:43 -06:00
{
2008-03-17 08:54:33 -05:00
trace < < " PyCell_getPowerNetsLocator () " < < endl ;
2008-03-06 10:46:43 -06:00
2008-03-17 08:54:33 -05:00
METHOD_HEAD ( " Cell.getPowerNetsLocator() " )
2008-03-06 10:46:43 -06:00
PyNetLocator * pyNetLocator = NULL ;
HTRY
2008-03-17 08:54:33 -05:00
Nets nets = cell - > getPowerNets ( ) ;
2008-03-06 10:46:43 -06:00
pyNetLocator = PyObject_NEW ( PyNetLocator , & PyTypeNetLocator ) ;
if ( pyNetLocator = = NULL ) { return NULL ; }
2008-03-17 08:54:33 -05:00
pyNetLocator - > _object = nets . getLocator ( ) ;
2008-03-06 10:46:43 -06:00
HCATCH
return ( ( PyObject * ) pyNetLocator ) ;
}
// ---------------------------------------------------------------
2008-03-17 08:54:33 -05:00
// Attribute Method : "PyCell_getGroundNetsLocator ()"
2008-03-06 10:46:43 -06:00
2008-03-17 08:54:33 -05:00
static PyObject * PyCell_getGroundNetsLocator ( PyCell * self ) {
trace < < " PyCell_getGroundNetsLocator () " < < endl ;
2008-03-06 10:46:43 -06:00
2008-03-17 08:54:33 -05:00
METHOD_HEAD ( " Cell.getGroundNetsLocator() " )
2008-03-06 10:46:43 -06:00
PyNetLocator * pyNetLocator = NULL ;
HTRY
2008-03-17 08:54:33 -05:00
Nets nets = cell - > getGroundNets ( ) ;
2008-03-06 10:46:43 -06:00
pyNetLocator = PyObject_NEW ( PyNetLocator , & PyTypeNetLocator ) ;
if ( pyNetLocator = = NULL ) { return NULL ; }
2008-03-17 08:54:33 -05:00
pyNetLocator - > _object = nets . getLocator ( ) ;
2008-03-06 10:46:43 -06:00
HCATCH
return ( ( PyObject * ) pyNetLocator ) ;
}
// ---------------------------------------------------------------
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-03-22 08:18:26 -05:00
static PyObject * PyCell_setName ( PyCell * self , PyObject * args )
2008-03-06 10:46:43 -06:00
{
2008-03-22 08:18:26 -05:00
trace < < " Cell.setName() " < < endl ;
2008-03-06 10:46:43 -06:00
HTRY
2008-03-22 08:18:26 -05:00
METHOD_HEAD ( " Cell.setName() " )
2008-03-06 10:46:43 -06:00
PyName * name ;
2008-03-22 08:18:26 -05:00
if ( ! ParseOneArg ( " Cell.setName " , args , NAME_ARG , ( PyObject * * ) & name ) ) return ( NULL ) ;
cell - > setName ( * PYNAME_O ( name ) ) ;
2008-03-06 10:46:43 -06:00
HCATCH
Py_RETURN_NONE ;
}
// ---------------------------------------------------------------
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
PyBox * abutmentBox ;
2008-03-22 08:18:26 -05:00
if ( ! ParseOneArg ( " Cell.setAbutmentBox " , args , BOX_ARG , ( PyObject * * ) & abutmentBox ) ) return ( NULL ) ;
cell - > setAbutmentBox ( * PYBOX_O ( abutmentBox ) ) ;
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-03-22 08:18:26 -05:00
if ( ! ParseOneArg ( " Cell.setTerminal " , args , INT_ARG , ( PyObject * * ) & arg0 ) ) return ( NULL ) ;
cell - > setTerminal ( PyInt_AsLong ( arg0 ) ! = 0 ) ;
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. " }
, { " getInstancesLocator " , ( PyCFunction ) PyCell_getInstancesLocator , METH_NOARGS , " Returns the locator of the collection of all instances called by the cell. " } // getInstances
, { " getInstancesUnderLocator " , ( PyCFunction ) PyCell_getInstancesUnderLocator , METH_VARARGS , " Returns the locator of the collection of all instances of the cell intersecting the given rectangular area. " } // getInstancesUnder
, { " getSlaveInstancesLocator " , ( PyCFunction ) PyCell_getSlaveInstancesLocator , METH_NOARGS , " Returns the locator of the collection of instances whose master is this cell. " } // getSlaveInstances
, { " getOccurrencesLocator " , ( PyCFunction ) PyCell_getOccurrencesLocator , METH_VARARGS , " Returns the collection of all occurrences belonging to the cell. " }
, { " getOccurrencesUnderLocator " , ( PyCFunction ) PyCell_getOccurrencesUnderLocator , METH_NOARGS , " Returns the collection of all occurrences belonging to this cell and intersecting the given rectangular area. " }
, { " getLeafInstanceOccurrencesLocator " , ( PyCFunction ) PyCell_getLeafInstanceOccurrencesLocator , METH_VARARGS , " Returns the collection of all occurrences belonging to the cell. " }
, { " getLeafInstanceOccurrencesUnderLocator " , ( PyCFunction ) PyCell_getLeafInstanceOccurrencesUnderLocator , METH_NOARGS , " Returns the collection of all occurrences belonging to this cell and intersecting the given rectangular area. " }
, { " getReferencesLocator " , ( PyCFunction ) PyCell_getReferencesLocator , METH_VARARGS , " Returns the collection of all references belonging to the cell. " }
, { " getHyperNetsLocator " , ( PyCFunction ) PyCell_getHyperNetsLocator , METH_VARARGS , " Returns the collection of all hyperNets belonging to the cell. " }
, { " getNet " , ( PyCFunction ) PyCell_getNet , METH_VARARGS , " Returns the net of name <name> if it exists, else NULL. " }
, { " getNetsLocator " , ( PyCFunction ) PyCell_getNetsLocator , METH_NOARGS , " Returns the collection of all nets of the cell. " }
, { " getExternalNetsLocator " , ( PyCFunction ) PyCell_getExternalNetsLocator , METH_NOARGS , " Returns the collection of all external nets of the cell. " }
, { " getClockNetsLocator " , ( PyCFunction ) PyCell_getClockNetsLocator , METH_NOARGS , " Returns the collection of all clock nets of the cell. " }
, { " getSupplyNetsLocator " , ( PyCFunction ) PyCell_getSupplyNetsLocator , METH_NOARGS , " Returns the collection of all supply nets of the cell. " }
, { " getPowerNetsLocator " , ( PyCFunction ) PyCell_getPowerNetsLocator , METH_NOARGS , " Returns the collection of all power nets of the cell. " }
, { " getGroundNetsLocator " , ( PyCFunction ) PyCell_getGroundNetsLocator , METH_NOARGS , " Returns the collection of all ground nets of the cell. " }
, { " 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
static PyObject * PyCell_new ( PyTypeObject * type , PyObject * args , PyObject * kwds ) {
trace < < " PyCell_new() " < < endl ;
PyObject * arg0 ;
PyObject * arg1 ;
string lib_name_arg = " :library:name " ;
if ( ! ParseTwoArg ( " Cell.init " , args , lib_name_arg , & arg0 , & arg1 ) ) {
cerr < < " argument error " < < endl ;
PyErr_SetString ( ConstructorError , " invalid number of parameters for Cell constructor. " ) ;
return ( NULL ) ;
}
Cell * cell = NULL ;
HTRY
2008-03-18 04:42:44 -05:00
cell = Cell : : create ( PYLIBRARY_O ( arg0 ) , getString ( * PYNAME_O ( arg1 ) ) ) ;
2008-03-06 10:46:43 -06:00
HCATCH
return PyCell_Link ( cell ) ;
}
2008-10-12 08:37:33 -05:00
DBoDeleteMethod ( Cell )
2008-03-06 10:46:43 -06:00
PyTypeObjectLinkPyType ( Cell )
PyTypeObjectConstructor ( Cell )
# else // End of Python Module Code Part.
// x=================================================================x
// | "PyCell" Shared Library Code Part |
// x=================================================================x
// Link/Creation Method.
2008-10-12 08:37:33 -05:00
DBoLinkCreateMethod ( Cell )
2008-03-06 10:46:43 -06:00
// ---------------------------------------------------------------
// PyCell Object Definitions.
2008-10-12 08:37:33 -05:00
PyTypeObjectDefinitions ( Cell )
2008-03-06 10:46:43 -06:00
# endif // End of Shared Library Code Part.
} // End of extern "C".
} // End of Isobar namespace.