* ./hurricane/sr/isobar:

- New: In PyCell, added methods for getComponents() and getComponentsUnder().
This commit is contained in:
Jean-Paul Chaput 2013-04-15 09:51:51 +00:00
parent 79eb9bde69
commit b64a8d1ca2
1 changed files with 84 additions and 21 deletions

View File

@ -1,5 +1,10 @@
// x-----------------------------------------------------------------x
// | |
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2013, All Rights Reserved
//
// +-----------------------------------------------------------------+
// | C O R I O L I S |
// | I s o b a r - Hurricane / Python Interface |
// | |
@ -7,10 +12,8 @@
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
// | =============================================================== |
// | C++ Module : "./PyCell.cpp" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
// +-----------------------------------------------------------------+
#include "hurricane/isobar/PyCell.h"
#include "hurricane/isobar/PyBox.h"
@ -22,6 +25,7 @@
#include "hurricane/isobar/PyNetCollection.h"
#include "hurricane/isobar/PyReferenceCollection.h"
#include "hurricane/isobar/PyInstanceCollection.h"
#include "hurricane/isobar/PyComponentCollection.h"
#include "hurricane/isobar/PyOccurrenceCollection.h"
namespace Isobar {
@ -185,6 +189,61 @@ extern "C" {
}
// ---------------------------------------------------------------
// Attribute Method : "PyCell_getComponents()"
static PyObject* PyCell_getComponents(PyCell *self) {
trace << "PyCell_getComponents()" << endl;
METHOD_HEAD("Cell.getComponents()")
PyComponentCollection* pyComponentCollection = NULL;
HTRY
Components* components = new Components(cell->getComponents());
pyComponentCollection = PyObject_NEW(PyComponentCollection, &PyTypeComponentCollection);
if (pyComponentCollection == NULL) {
return NULL;
}
pyComponentCollection->_object = components;
HCATCH
return (PyObject*)pyComponentCollection;
}
// ---------------------------------------------------------------
// Attribute Method : "PyCell_getComponentsUnder()"
static PyObject* PyCell_getComponentsUnder(PyCell *self, PyObject* args) {
trace << "PyCell_getComponentsUnder()" << endl;
METHOD_HEAD("Cell.getComponentsUnder()")
PyBox* pyBox;
if (!PyArg_ParseTuple(args,"O!:Cell.getInstancesUnder", &PyTypeBox, &pyBox)) {
return NULL;
}
PyComponentCollection* pyComponentCollection = NULL;
HTRY
Components* components = new Components(cell->getComponentsUnder(*PYBOX_O(pyBox)));
pyComponentCollection = PyObject_NEW(PyComponentCollection, &PyTypeComponentCollection);
if (pyComponentCollection == NULL) {
return NULL;
}
pyComponentCollection->_object = components;
HCATCH
return (PyObject*)pyComponentCollection;
}
// ---------------------------------------------------------------
// Attribute Method : "PyCell_getOccurrences()"
@ -591,10 +650,14 @@ extern "C" {
, { "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
, { "getComponents" , (PyCFunction)PyCell_getComponents , METH_VARARGS, "Returns the collection of all components belonging to the cell." }
, { "getComponentsUnder" , (PyCFunction)PyCell_getComponentsUnder , METH_NOARGS , "Returns the collection of all components belonging to this cell and intersecting the given rectangular area." }
, { "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." }
, { "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." }
, { "getNet" , (PyCFunction)PyCell_getNet , METH_VARARGS, "Returns the net of name <name> if it exists, else NULL." }