* ./hurricane/sr/isobar:
- New: In PyDataBase, added method for getDB (the correct name, as alias) and getRootLibrary(). - New: In PyComponent, added support for the optional BasicLayer argument of getBoundingBox(). - New: In PyEntity, added support for conversion to/from RoutingPad. - New: In PyHyperNet, added support for getNetOccurrences(). - New: In PyLibrary, added support for getLibrary(). - New: In NetExternalComponents, added support for setExternal().
This commit is contained in:
parent
fe4c87fe10
commit
fc805bf500
|
@ -61,8 +61,6 @@ extern "C" {
|
|||
// Standart Delete (Attribute).
|
||||
DBoDestroyAttribute(PyCell_destroy,PyCell)
|
||||
|
||||
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Attribute Method : "PyCell_getLibrary ()"
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "hurricane/isobar/PyLayer.h"
|
||||
#include "hurricane/isobar/PyPoint.h"
|
||||
#include "hurricane/isobar/PyBox.h"
|
||||
#include "hurricane/isobar/PyBasicLayer.h"
|
||||
#include "hurricane/isobar/PyComponent.h"
|
||||
#include "hurricane/isobar/PyPlug.h"
|
||||
#include "hurricane/isobar/PyHorizontal.h"
|
||||
|
@ -132,19 +133,33 @@ extern "C" {
|
|||
// ---------------------------------------------------------------
|
||||
// Attribute Method : "PyComponent_getBoundingBox ()"
|
||||
|
||||
static PyObject* PyComponent_getBoundingBox ( PyComponent *self ) {
|
||||
static PyObject* PyComponent_getBoundingBox ( PyComponent *self, PyObject* args )
|
||||
{
|
||||
trace << "PyComponent_getBoundingBox ()" << endl;
|
||||
METHOD_HEAD ( "Component.getBoundingBox()" )
|
||||
|
||||
PyBox* pyBox = PyObject_NEW ( PyBox, &PyTypeBox );
|
||||
if (pyBox == NULL) { return NULL; }
|
||||
trace_out ();
|
||||
if (pyBox == NULL) return NULL;
|
||||
|
||||
HTRY
|
||||
pyBox->_object = new Box ( component->getBoundingBox() );
|
||||
PyObject* pyLayer = NULL;
|
||||
if (PyArg_ParseTuple( args, "|O:Component.getBoundingBox", &pyLayer )) {
|
||||
if (pyLayer) {
|
||||
if (not IsPyBasicLayer(pyLayer)) {
|
||||
PyErr_SetString( ConstructorError, "Component.getBoundingBox(): First argument is not of type BasicLayer." );
|
||||
return NULL;
|
||||
}
|
||||
pyBox->_object = new Box ( component->getBoundingBox(PYBASICLAYER_O(pyLayer)) );
|
||||
} else {
|
||||
pyBox->_object = new Box ( component->getBoundingBox() );
|
||||
}
|
||||
} else {
|
||||
PyErr_SetString( ConstructorError, "Bad parameters given to Component.getBoundingBox()." );
|
||||
return NULL;
|
||||
}
|
||||
HCATCH
|
||||
|
||||
return ( (PyObject*)pyBox );
|
||||
return (PyObject*)pyBox;
|
||||
}
|
||||
|
||||
|
||||
|
@ -159,7 +174,7 @@ extern "C" {
|
|||
, { "getCenter" , (PyCFunction)PyComponent_getCenter , METH_NOARGS , "Return the Component center position." }
|
||||
, { "getNet" , (PyCFunction)PyComponent_getNet , METH_NOARGS , "Returns the net owning the component." }
|
||||
, { "getLayer" , (PyCFunction)PyComponent_getLayer , METH_NOARGS , "Return the component layer." }
|
||||
, { "getBoundingBox" , (PyCFunction)PyComponent_getBoundingBox, METH_NOARGS , "Return the component boundingBox." }
|
||||
, { "getBoundingBox" , (PyCFunction)PyComponent_getBoundingBox, METH_VARARGS, "Return the component boundingBox (optionally on a BasicLayer)." }
|
||||
, { "destroy" , (PyCFunction)PyComponent_destroy , METH_NOARGS
|
||||
, "destroy associated hurricane object, the python object remains." }
|
||||
, {NULL, NULL, 0, NULL} /* sentinel */
|
||||
|
|
|
@ -1,42 +1,10 @@
|
|||
|
||||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Project.
|
||||
// Copyright (C) Laboratoire LIP6 - Departement ASIM
|
||||
// Universite Pierre et Marie Curie
|
||||
// This file is part of the Coriolis Software.
|
||||
// Copyright (c) UPMC/LIP6 2008-2013, All Rights Reserved
|
||||
//
|
||||
// Main contributors :
|
||||
// Christophe Alexandre <Christophe.Alexandre@lip6.fr>
|
||||
// Sophie Belloeil <Sophie.Belloeil@lip6.fr>
|
||||
// Hugo Clé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: PyDataBase.cpp,v 1.1 2008/02/07 19:09:57 xtof Exp $
|
||||
//
|
||||
// x-----------------------------------------------------------------x
|
||||
// | |
|
||||
// +-----------------------------------------------------------------+
|
||||
// | C O R I O L I S |
|
||||
// | I s o b a r - Hurricane / Python Interface |
|
||||
// | |
|
||||
|
@ -44,16 +12,12 @@
|
|||
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
|
||||
// | =============================================================== |
|
||||
// | C++ Module : "./PyDataBase.cpp" |
|
||||
// | *************************************************************** |
|
||||
// | U p d a t e s |
|
||||
// | |
|
||||
// x-----------------------------------------------------------------x
|
||||
|
||||
|
||||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
#include "hurricane/isobar/PyDataBase.h"
|
||||
#include "hurricane/isobar/PyTechnology.h"
|
||||
#include "hurricane/isobar/PyLibrary.h"
|
||||
|
||||
|
||||
namespace Isobar {
|
||||
|
@ -66,25 +30,16 @@ extern "C" {
|
|||
#define METHOD_HEAD(function) GENERIC_METHOD_HEAD(DataBase,db,function)
|
||||
|
||||
|
||||
// x=================================================================x
|
||||
// | "PyDataBase" Python Module Code Part |
|
||||
// x=================================================================x
|
||||
// +=================================================================+
|
||||
// | "PyDataBase" Python Module Code Part |
|
||||
// +=================================================================+
|
||||
|
||||
|
||||
#if defined(__PYTHON_MODULE__)
|
||||
|
||||
|
||||
// x-------------------------------------------------------------x
|
||||
// | "PyDataBase" Attribute Methods |
|
||||
// x-------------------------------------------------------------x
|
||||
|
||||
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Attribute Method : "PyDataBase_getDataBase ()"
|
||||
|
||||
PyObject* PyDataBase_getDataBase ( PyObject* module ) {
|
||||
trace << "PyDataBase_getDataBase()" << endl;
|
||||
PyObject* PyDataBase_getDB ( PyObject* module ) {
|
||||
trace << "PyDataBase_getDB()" << endl;
|
||||
|
||||
DataBase* db = NULL;
|
||||
|
||||
|
@ -97,8 +52,6 @@ extern "C" {
|
|||
return PyDataBase_Link ( db );
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Attribute Method : "PyDataBase_getTechnology ()"
|
||||
|
||||
PyObject* PyDataBase_getTechnology ( PyDataBase* self ) {
|
||||
trace << "PyDataBase_getTechnology()" << endl;
|
||||
|
@ -117,45 +70,48 @@ extern "C" {
|
|||
return PyTechnology_Link ( techno );
|
||||
}
|
||||
|
||||
|
||||
static PyObject* PyDataBase_getRootLibrary ( PyDataBase *self ) {
|
||||
trace << "PyDataBase_getRootLibrary ()" << endl;
|
||||
|
||||
Library* library = NULL;
|
||||
|
||||
HTRY
|
||||
METHOD_HEAD ( "DataBase.getRootLibrary()" )
|
||||
library = db->getRootLibrary ();
|
||||
HCATCH
|
||||
|
||||
return PyLibrary_Link(library);
|
||||
}
|
||||
|
||||
|
||||
// Standart Accessors (Attributes).
|
||||
|
||||
|
||||
// Standart Destroy (Attribute).
|
||||
DBoDestroyAttribute(PyDataBase_destroy,PyDataBase)
|
||||
|
||||
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// PyDataBase Attribute Method table.
|
||||
|
||||
PyMethodDef PyDataBase_Methods[] =
|
||||
{ { "getTechnology", (PyCFunction)PyDataBase_getTechnology, METH_NOARGS, "Return the Technology" }
|
||||
, { "destroy" , (PyCFunction)PyDataBase_destroy , METH_NOARGS
|
||||
, "Destroy associated hurricane object The python object remains." }
|
||||
{ { "getTechnology" , (PyCFunction)PyDataBase_getTechnology , METH_NOARGS, "Return the Technology" }
|
||||
, { "getRootLibrary", (PyCFunction)PyDataBase_getRootLibrary, METH_NOARGS, "Return the root library" }
|
||||
, { "destroy" , (PyCFunction)PyDataBase_destroy , METH_NOARGS
|
||||
, "Destroy associated hurricane object The python object remains." }
|
||||
, {NULL, NULL, 0, NULL} /* sentinel */
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
// x-------------------------------------------------------------x
|
||||
// | "PyDataBase" Object Methods |
|
||||
// x-------------------------------------------------------------x
|
||||
|
||||
DBoDeleteMethod(DataBase)
|
||||
PyTypeObjectLinkPyType(DataBase)
|
||||
|
||||
#else // End of Python Module Code Part.
|
||||
|
||||
|
||||
// x=================================================================x
|
||||
// +=================================================================+
|
||||
// | "PyDataBase" Shared Library Code Part |
|
||||
// x=================================================================x
|
||||
// +=================================================================+
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Attribute Method : "PyDataBase_create ()"
|
||||
|
||||
PyObject* PyDataBase_create ( PyObject *module ) {
|
||||
trace << "PyDataBase_create()" << endl;
|
||||
|
@ -170,23 +126,17 @@ extern "C" {
|
|||
}
|
||||
|
||||
|
||||
|
||||
// Link/Creation Method.
|
||||
|
||||
DBoLinkCreateMethod(DataBase)
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// PyDataBase Object Definitions.
|
||||
|
||||
PyTypeObjectDefinitions(DataBase)
|
||||
|
||||
#endif // End of Shared Library Code Part.
|
||||
|
||||
|
||||
} // End of extern "C".
|
||||
} // extern "C".
|
||||
|
||||
|
||||
|
||||
|
||||
} // End of Isobar namespace.
|
||||
} // Isobar namespace.
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "hurricane/isobar/PyContact.h"
|
||||
#include "hurricane/isobar/PyPad.h"
|
||||
#include "hurricane/isobar/PyPin.h"
|
||||
#include "hurricane/isobar/PyRoutingPad.h"
|
||||
#include "hurricane/Cell.h"
|
||||
|
||||
namespace Isobar {
|
||||
|
@ -125,6 +126,9 @@ extern "C" {
|
|||
Reference* reference = dynamic_cast<Reference*>(entity);
|
||||
if ( reference ) return PyReference_Link ( reference );
|
||||
|
||||
RoutingPad* rp = dynamic_cast<RoutingPad*>(entity);
|
||||
if ( rp ) return PyRoutingPad_Link ( rp );
|
||||
|
||||
Horizontal* horizontal = dynamic_cast<Horizontal*>(entity);
|
||||
if ( horizontal ) return PyHorizontal_Link ( horizontal );
|
||||
|
||||
|
@ -173,6 +177,7 @@ Hurricane::Entity* EntityCast ( PyObject* derivedObject ) {
|
|||
if ( IsPyPlug (derivedObject) ) return PYPLUG_O(derivedObject);
|
||||
if ( IsPyHorizontal(derivedObject) ) return PYHORIZONTAL_O(derivedObject);
|
||||
if ( IsPyVertical (derivedObject) ) return PYVERTICAL_O(derivedObject);
|
||||
if ( IsPyRoutingPad(derivedObject) ) return PYROUTINGPAD_O(derivedObject);
|
||||
if ( IsPyContact (derivedObject) ) return PYCONTACT_O(derivedObject);
|
||||
if ( IsPyPin (derivedObject) ) return PYPIN_O(derivedObject);
|
||||
if ( IsPyNet (derivedObject) ) return PYNET_O(derivedObject);
|
||||
|
|
|
@ -513,7 +513,8 @@ extern "C" {
|
|||
, { "Box" , PyBox_create , METH_VARARGS, "Creates a new Box." }
|
||||
, { "Transformation" , PyTransformation_create , METH_VARARGS, "Creates a new Transformation." }
|
||||
, { "DataBase" , (PyCFunction)PyDataBase_create , METH_NOARGS , "Creates the DataBase." }
|
||||
, { "getDataBase" , (PyCFunction)PyDataBase_getDataBase , METH_NOARGS , "Gets the current DataBase." }
|
||||
, { "getDB" , (PyCFunction)PyDataBase_getDB , METH_NOARGS , "Gets the current DataBase." }
|
||||
, { "getDataBase" , (PyCFunction)PyDataBase_getDB , METH_NOARGS , "Gets the current DataBase." }
|
||||
, { "Library" , (PyCFunction)PyLibrary_create , METH_VARARGS, "Creates a new Library." }
|
||||
// , { "getLibrary" , (PyCFunction)PyLibrary_getLibrary , METH_NOARGS , "Gets the current Library." }
|
||||
, { "Reference" , (PyCFunction)PyReference_create , METH_VARARGS, "Creates a new Reference." }
|
||||
|
|
|
@ -1,55 +1,18 @@
|
|||
|
||||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Project.
|
||||
// Copyright (C) Laboratoire LIP6 - Departement ASIM
|
||||
// Universite Pierre et Marie Curie
|
||||
// This file is part of the Coriolis Software.
|
||||
// Copyright (c) UPMC/LIP6 2007-2013, All Rights Reserved
|
||||
//
|
||||
// Main contributors :
|
||||
// Christophe Alexandre <Christophe.Alexandre@lip6.fr>
|
||||
// Sophie Belloeil <Sophie.Belloeil@lip6.fr>
|
||||
// Hugo Clé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: PyHyperNet.cpp,v 1.2 2007/05/10 11:15:56 d2 Exp $
|
||||
//
|
||||
// x-----------------------------------------------------------------x
|
||||
// | |
|
||||
// +-----------------------------------------------------------------+
|
||||
// | C O R I O L I S |
|
||||
// | I s o b a r - Hurricane / Python Interface |
|
||||
// | |
|
||||
// | Author : Damien DUPUIS |
|
||||
// | E-mail : Damien.Dupuis@lip6.fr |
|
||||
// | Author : Jean-Paul CHAPUT |
|
||||
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
|
||||
// | =============================================================== |
|
||||
// | C++ Module : "./PyHyperNet.cpp" |
|
||||
// | *************************************************************** |
|
||||
// | U p d a t e s |
|
||||
// | |
|
||||
// x-----------------------------------------------------------------x
|
||||
|
||||
|
||||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
#include "hurricane/isobar/PyHyperNet.h"
|
||||
|
@ -62,41 +25,47 @@ using namespace Hurricane;
|
|||
|
||||
namespace Isobar {
|
||||
|
||||
|
||||
|
||||
|
||||
extern "C" {
|
||||
|
||||
|
||||
# define METHOD_HEAD(function) GENERIC_METHOD_HEAD(HyperNet,hyperNet,function)
|
||||
#define METHOD_HEAD(function) GENERIC_METHOD_HEAD(HyperNet,hyperNet,function)
|
||||
|
||||
|
||||
// x=================================================================x
|
||||
// | "PyHyperNet" Python Module Code Part |
|
||||
// x=================================================================x
|
||||
|
||||
# if defined(__PYTHON_MODULE__)
|
||||
|
||||
|
||||
// x-------------------------------------------------------------x
|
||||
// | "PyHyperNet" Attribute Methods |
|
||||
// x-------------------------------------------------------------x
|
||||
|
||||
// +=================================================================+
|
||||
// | "PyHyperNet" Python Module Code Part |
|
||||
// +=================================================================+
|
||||
|
||||
#if defined(__PYTHON_MODULE__)
|
||||
|
||||
|
||||
// Standart Predicates (Attributes).
|
||||
DirectGetBoolAttribute(PyHyperNet_isValid ,isValid ,PyHyperNet,HyperNet)
|
||||
|
||||
|
||||
// Standart Delete (Attribute).
|
||||
DirectDestroyAttribute(PyHyperNet_destroy, PyHyperNet)
|
||||
|
||||
|
||||
static PyObject* PyHyperNet_getNetOccurrences(PyHyperNet *self)
|
||||
{
|
||||
trace << "PyHyperNet_getNetOccurrences()" << endl;
|
||||
|
||||
METHOD_HEAD ( "HyperNet.getNetOccurrences()" )
|
||||
|
||||
PyOccurrenceCollection* pyOccurrenceCollection = NULL;
|
||||
|
||||
HTRY
|
||||
Occurrences* occurrences = new Occurrences(hyperNet->getNetOccurrences());
|
||||
|
||||
pyOccurrenceCollection = PyObject_NEW(PyOccurrenceCollection, &PyTypeOccurrenceCollection);
|
||||
if (pyOccurrenceCollection == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pyOccurrenceCollection->_object = occurrences;
|
||||
HCATCH
|
||||
|
||||
return (PyObject*)pyOccurrenceCollection;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Attribute Method : "PyHyperNet_getLeafPlugOccurrences()"
|
||||
|
||||
static PyObject* PyHyperNet_getLeafPlugOccurrences(PyHyperNet *self)
|
||||
{
|
||||
|
@ -121,9 +90,6 @@ extern "C" {
|
|||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Attribute Method : "PyHyperNet_getCell ()"
|
||||
|
||||
static PyObject* PyHyperNet_getCell ( PyHyperNet *self )
|
||||
{
|
||||
trace << "PyHyperNet_getCell ()" << endl;
|
||||
|
@ -139,41 +105,30 @@ extern "C" {
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// PyHyperNet Attribute Method table.
|
||||
|
||||
PyMethodDef PyHyperNet_Methods[] =
|
||||
{ { "getCell" , (PyCFunction)PyHyperNet_getCell , METH_NOARGS , "Returns the hyperNet cell." }
|
||||
, { "isValid" , (PyCFunction)PyHyperNet_isValid , METH_NOARGS , "Returns trus if the HyperNet isValid." }
|
||||
{ { "getCell" , (PyCFunction)PyHyperNet_getCell , METH_NOARGS , "Returns the hyperNet cell." }
|
||||
, { "isValid" , (PyCFunction)PyHyperNet_isValid , METH_NOARGS , "Returns trus if the HyperNet isValid." }
|
||||
, { "getNetOccurrences" , (PyCFunction)PyHyperNet_getNetOccurrences , METH_NOARGS
|
||||
, "Returns the collection of Net occurrences" }
|
||||
, { "getLeafPlugOccurrences", (PyCFunction)PyHyperNet_getLeafPlugOccurrences, METH_NOARGS
|
||||
, "Returns the collection of leaf occurrences" }
|
||||
, { "destroy" , (PyCFunction)PyHyperNet_destroy , METH_NOARGS
|
||||
, "Destroy associated hurricane object, the python object remains." }
|
||||
, {NULL, NULL, 0, NULL} /* sentinel */
|
||||
, "Returns the collection of leaf occurrences" }
|
||||
, { "destroy" , (PyCFunction)PyHyperNet_destroy , METH_NOARGS
|
||||
, "Destroy associated hurricane object, the python object remains." }
|
||||
, {NULL, NULL, 0, NULL} /* sentinel */
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
// x-------------------------------------------------------------x
|
||||
// | "PyHyperNet" Object Methods |
|
||||
// x-------------------------------------------------------------x
|
||||
DirectDeleteMethod(PyHyperNet_DeAlloc,PyHyperNet)
|
||||
PyTypeObjectLinkPyType(HyperNet)
|
||||
|
||||
|
||||
# else // End of Python Module Code Part.
|
||||
#else // End of Python Module Code Part.
|
||||
|
||||
|
||||
// x=================================================================x
|
||||
// | "PyHyperNet" Shared Library Code Part |
|
||||
// x=================================================================x
|
||||
// +=================================================================+
|
||||
// | "PyHyperNet" Shared Library Code Part |
|
||||
// +=================================================================+
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Attribute Method : "PyHyperNet_create ()"
|
||||
|
||||
PyObject* PyHyperNet_create ( PyObject *module, PyObject *args ) {
|
||||
trace << "PyHyperNet_create()" << endl;
|
||||
|
@ -200,19 +155,12 @@ extern "C" {
|
|||
}
|
||||
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// PyHyperNet Object Definitions.
|
||||
|
||||
PyTypeObjectDefinitions(HyperNet)
|
||||
|
||||
|
||||
# endif // End of Shared Library Code Part.
|
||||
#endif // End of Shared Library Code Part.
|
||||
|
||||
|
||||
} // End of extern "C".
|
||||
} // extern "C".
|
||||
|
||||
|
||||
|
||||
|
||||
} // End of Isobar namespace.
|
||||
} // Isobar namespace.
|
||||
|
|
|
@ -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,12 +12,7 @@
|
|||
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
|
||||
// | =============================================================== |
|
||||
// | C++ Module : "./PyLibrary.cpp" |
|
||||
// | *************************************************************** |
|
||||
// | U p d a t e s |
|
||||
// | |
|
||||
// x-----------------------------------------------------------------x
|
||||
|
||||
|
||||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
#include "hurricane/isobar/PyDataBase.h"
|
||||
|
@ -31,28 +31,36 @@ extern "C" {
|
|||
#define METHOD_HEAD(function) GENERIC_METHOD_HEAD(Library,lib,function)
|
||||
|
||||
|
||||
// x=================================================================x
|
||||
// +=================================================================+
|
||||
// | "PyLibrary" Python Module Code Part |
|
||||
// x=================================================================x
|
||||
// +=================================================================+
|
||||
|
||||
#if defined(__PYTHON_MODULE__)
|
||||
|
||||
|
||||
// x-------------------------------------------------------------x
|
||||
// | "PyLibrary" Attribute Methods |
|
||||
// x-------------------------------------------------------------x
|
||||
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Attribute Method : "PyLibrary_getName ()"
|
||||
GetNameMethod(Library, lib)
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Attribute Method : "PyLibrary_getCell ()"
|
||||
static PyObject* PyLibrary_getSubLibrary ( PyLibrary *self, PyObject* args ) {
|
||||
trace << "PyLibrary_getLibrary ()" << endl;
|
||||
|
||||
PyObject* PyLibrary_getCell ( PyLibrary* self, PyObject* args ) {
|
||||
Library* subLibrary = NULL;
|
||||
|
||||
HTRY
|
||||
METHOD_HEAD ( "Library.getLibrary()" )
|
||||
char* name = NULL;
|
||||
if (PyArg_ParseTuple(args,"s:Library.getLibrary", &name)) {
|
||||
subLibrary = lib->getLibrary( Name(name) );
|
||||
} else {
|
||||
PyErr_SetString( ConstructorError, "Library.getLibrary(Name): Invalid number of parameters." );
|
||||
return NULL;
|
||||
}
|
||||
HCATCH
|
||||
|
||||
return PyLibrary_Link( subLibrary );
|
||||
}
|
||||
|
||||
|
||||
static PyObject* PyLibrary_getCell ( PyLibrary* self, PyObject* args ) {
|
||||
trace << "PyLibrary_getCell ()" << endl;
|
||||
|
||||
Cell* cell = NULL;
|
||||
|
@ -72,10 +80,6 @@ extern "C" {
|
|||
}
|
||||
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Attribute Method : "PyLibrary_getCells()"
|
||||
|
||||
static PyObject* PyLibrary_getCells(PyLibrary *self) {
|
||||
trace << "PyLibrary_getCells()" << endl;
|
||||
|
||||
|
@ -97,32 +101,23 @@ extern "C" {
|
|||
return (PyObject*)pyCellCollection;
|
||||
}
|
||||
|
||||
// Standart Accessors (Attributes).
|
||||
|
||||
|
||||
// Standart Destroy (Attribute).
|
||||
DBoDestroyAttribute(PyLibrary_destroy, PyLibrary)
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// PyLibrary Attribute Method table.
|
||||
|
||||
PyMethodDef PyLibrary_Methods[] =
|
||||
{
|
||||
{ "getName" , (PyCFunction)PyLibrary_getName , METH_NOARGS , "Returns the name of the library." }
|
||||
, { "getCell" , (PyCFunction)PyLibrary_getCell , METH_VARARGS, "Get the cell of name <name>" }
|
||||
, { "getCells", (PyCFunction)PyLibrary_getCells, METH_NOARGS , "Returns the collection of all cells of the library." }
|
||||
, { "destroy" , (PyCFunction)PyLibrary_destroy , METH_NOARGS
|
||||
, "Destroy associated hurricane object The python object remains." }
|
||||
{ "getName" , (PyCFunction)PyLibrary_getName , METH_NOARGS , "Returns the name of the library." }
|
||||
, { "getLibrary", (PyCFunction)PyLibrary_getSubLibrary, METH_VARARGS, "Get the sub-library named <name>" }
|
||||
, { "getCell" , (PyCFunction)PyLibrary_getCell , METH_VARARGS, "Get the cell of name <name>" }
|
||||
, { "getCells" , (PyCFunction)PyLibrary_getCells , METH_NOARGS , "Returns the collection of all cells of the library." }
|
||||
, { "destroy" , (PyCFunction)PyLibrary_destroy , METH_NOARGS
|
||||
, "Destroy associated hurricane object The python object remains." }
|
||||
, {NULL, NULL, 0, NULL} /* sentinel */
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
// x-------------------------------------------------------------x
|
||||
// | "PyLibrary" Object Methods |
|
||||
// x-------------------------------------------------------------x
|
||||
|
||||
DBoDeleteMethod(Library)
|
||||
PyTypeObjectLinkPyType(Library)
|
||||
|
||||
|
@ -130,12 +125,10 @@ extern "C" {
|
|||
#else // End of Python Module Code Part.
|
||||
|
||||
|
||||
// x=================================================================x
|
||||
// +=================================================================+
|
||||
// | "PyLibrary" Shared Library Code Part |
|
||||
// x=================================================================x
|
||||
// +=================================================================+
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Attribute Method : "PyLibrary_create()"
|
||||
|
||||
PyObject* PyLibrary_create ( PyObject *module, PyObject *args ) {
|
||||
trace << "PyLibrary_create()" << endl;
|
||||
|
@ -165,43 +158,17 @@ extern "C" {
|
|||
return PyLibrary_Link ( library );
|
||||
}
|
||||
|
||||
#if 0
|
||||
// ---------------------------------------------------------------
|
||||
// Attribute Method : "PyLibrary_getLibrary ()"
|
||||
|
||||
//needs args, have to check hurricane object code
|
||||
|
||||
PyObject* PyLibrary_getLibrary ( PyObject* module )
|
||||
{
|
||||
trace << "PyLibrary_getLibrary()" << endl;
|
||||
Library* lib = NULL;
|
||||
|
||||
HTRY
|
||||
lib = Library::getLibrary ();
|
||||
if ( lib == NULL )
|
||||
PyErr_SetString ( HurricaneError, "Library has not been created yet" );
|
||||
HCATCH
|
||||
|
||||
return PyLibrary_Link ( lib );
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
// Link/Creation Method.
|
||||
DBoLinkCreateMethod(Library)
|
||||
|
||||
|
||||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// PyLibrary Object Definitions.
|
||||
|
||||
PyTypeObjectDefinitions(Library)
|
||||
|
||||
|
||||
#endif // End of Shared Library Code Part.
|
||||
|
||||
|
||||
} // End of extern "C".
|
||||
} // extern "C".
|
||||
|
||||
} // End of Isobar namespace.
|
||||
} // Isobar namespace.
|
||||
|
|
|
@ -64,6 +64,30 @@ extern "C" {
|
|||
if ( isExternal ) Py_RETURN_TRUE;
|
||||
Py_RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
static PyObject* PyNetExternalComponents_setExternal ( PyObject*, PyObject *args )
|
||||
{
|
||||
trace << "PyNetExternalComponents_setExternal()" << endl;
|
||||
|
||||
bool isExternal = false;
|
||||
|
||||
HTRY
|
||||
PyObject* pyComponent;
|
||||
if (PyArg_ParseTuple( args, "O", &pyComponent )) {
|
||||
if (not PyObject_IsInstance(pyComponent,(PyObject*)&PyTypeComponent)) {
|
||||
PyErr_SetString( ConstructorError, "NetExternalComponents.setExternal(): First argument is not of type Component." );
|
||||
return NULL;
|
||||
}
|
||||
NetExternalComponents::setExternal( PYCOMPONENT_O(pyComponent) );
|
||||
} else {
|
||||
PyErr_SetString( ConstructorError, "Bad parameters given to NetExternalComponents.setExternal()." );
|
||||
return NULL;
|
||||
}
|
||||
HCATCH
|
||||
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
|
||||
static PyObject* PyNetExternalComponents_get ( PyObject*, PyObject* args )
|
||||
|
@ -91,10 +115,12 @@ extern "C" {
|
|||
|
||||
|
||||
PyMethodDef PyNetExternalComponents_Methods[] =
|
||||
{ { "isExternal", (PyCFunction)PyNetExternalComponents_isExternal, METH_VARARGS|METH_CLASS
|
||||
, "Tells if Component belong to the externals of the Net." }
|
||||
, { "get" , (PyCFunction)PyNetExternalComponents_get , METH_VARARGS|METH_CLASS
|
||||
, "Returns the Collection of external components of the Net." }
|
||||
{ { "isExternal" , (PyCFunction)PyNetExternalComponents_isExternal , METH_VARARGS|METH_CLASS
|
||||
, "Tells if Component belong to the externals of the Net." }
|
||||
, { "setExternal", (PyCFunction)PyNetExternalComponents_setExternal, METH_VARARGS|METH_CLASS
|
||||
, "Flag the Component as belonging to to the external part of it's Net." }
|
||||
, { "get" , (PyCFunction)PyNetExternalComponents_get , METH_VARARGS|METH_CLASS
|
||||
, "Returns the Collection of external components of the Net." }
|
||||
, {NULL, NULL, 0, NULL} /* sentinel */
|
||||
};
|
||||
|
||||
|
|
|
@ -15,8 +15,6 @@
|
|||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
|
||||
|
||||
#include "hurricane/isobar/PyPoint.h"
|
||||
#include "hurricane/isobar/PyNet.h"
|
||||
#include "hurricane/isobar/PyLayer.h"
|
||||
|
|
|
@ -86,6 +86,7 @@ extern "C" {
|
|||
extern PyMethodDef PyDataBase_Methods[];
|
||||
|
||||
extern PyObject* PyDataBase_create ( PyObject* module );
|
||||
extern PyObject* PyDataBase_getDB ( PyObject* module );
|
||||
extern PyObject* PyDataBase_getDataBase ( PyObject* module );
|
||||
extern PyObject* PyDataBase_Link ( Hurricane::DataBase* db );
|
||||
extern void PyDataBase_LinkPyType ();
|
||||
|
|
Loading…
Reference in New Issue