coriolis/hurricane/src/isobar/PyNet.cpp

610 lines
20 KiB
C++
Raw Normal View History

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: PyNet.cpp,v 1.27 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 : Sophie BELLOEIL |
// | E-mail : Sophie.Belloeil@asim.lip6.fr |
// | =============================================================== |
// | C++ Module : "./PyNet.cpp" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#include "hurricane/isobar/PyNet.h"
#include "hurricane/isobar/PyName.h"
#include "hurricane/isobar/PyCell.h"
#include "hurricane/isobar/PyPoint.h"
#include "hurricane/isobar/PyPlugLocator.h"
#include "hurricane/isobar/PySegmentLocator.h"
#include "hurricane/isobar/PyComponentLocator.h"
#include "hurricane/isobar/PyPinLocator.h"
#include "hurricane/NetExternalComponents.h"
2008-03-28 04:48:47 -05:00
using namespace Hurricane;
2008-03-06 10:46:43 -06:00
2008-03-28 04:48:47 -05:00
namespace Isobar {
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(Net,net,function)
# define LOAD_CONSTANT(CONSTANT_VALUE,CONSTANT_NAME) \
constant = PyInt_FromLong ( (long)CONSTANT_VALUE ); \
PyDict_SetItemString ( dictionnary, CONSTANT_NAME, constant ); \
Py_DECREF ( constant );
// x=================================================================x
// | "PyNet" Python Module Code Part |
// x=================================================================x
# if defined(__PYTHON_MODULE__)
// x-------------------------------------------------------------x
// | "PyNet" Local Functions |
// x-------------------------------------------------------------x
// ---------------------------------------------------------------
// Local Function : "PyInt_AsType ()"
static Net::Type PyInt_AsType ( PyObject* object )
{
switch ( PyInt_AsLong(object) ) {
case Net::Type::UNDEFINED : return ( Net::Type(Net::Type::UNDEFINED) );
case Net::Type::LOGICAL : return ( Net::Type(Net::Type::LOGICAL) );
case Net::Type::CLOCK : return ( Net::Type(Net::Type::CLOCK) );
case Net::Type::POWER : return ( Net::Type(Net::Type::POWER) );
case Net::Type::GROUND : return ( Net::Type(Net::Type::GROUND) );
}
return ( Net::Type(Net::Type::UNDEFINED) );
}
// ---------------------------------------------------------------
// Local Function : "PyInt_AsDirection ()"
static Net::Direction PyInt_AsDirection ( PyObject* object )
{
switch ( PyInt_AsLong(object) ) {
case Net::Direction::UNDEFINED : return ( Net::Direction(Net::Direction::UNDEFINED) );
case Net::Direction::IN : return ( Net::Direction(Net::Direction::IN) );
case Net::Direction::OUT : return ( Net::Direction(Net::Direction::OUT) );
case Net::Direction::INOUT : return ( Net::Direction(Net::Direction::INOUT) );
case Net::Direction::TRISTATE : return ( Net::Direction(Net::Direction::TRISTATE) );
}
return ( Net::Direction(Net::Direction::UNDEFINED) );
}
// x-------------------------------------------------------------x
// | Global Constants Loading |
// x-------------------------------------------------------------x
extern void NetLoadConstants ( PyObject* dictionnary )
{
PyObject* constant;
LOAD_CONSTANT ( Net::Type::UNDEFINED , "TypeUNDEFINED" )
LOAD_CONSTANT ( Net::Type::LOGICAL , "TypeLOGICAL" )
LOAD_CONSTANT ( Net::Type::CLOCK , "TypeCLOCK" )
LOAD_CONSTANT ( Net::Type::POWER , "TypePOWER" )
LOAD_CONSTANT ( Net::Type::GROUND , "TypeGROUND" )
LOAD_CONSTANT ( Net::Direction::UNDEFINED , "DirectionUNDEFINED" )
LOAD_CONSTANT ( Net::Direction::IN , "DirectionIN" )
LOAD_CONSTANT ( Net::Direction::OUT , "DirectionOUT" )
LOAD_CONSTANT ( Net::Direction::INOUT , "DirectionINOUT" )
LOAD_CONSTANT ( Net::Direction::TRISTATE , "DirectionTRISTATE" )
}
// x-------------------------------------------------------------x
// | "PyNet" Attribute Methods |
// x-------------------------------------------------------------x
// Standart Accessors (Attributes).
2008-03-17 08:54:33 -05:00
DirectGetLongAttribute(PyNet_getX,getX,PyNet,Net)
DirectGetLongAttribute(PyNet_getY,getY,PyNet,Net)
2008-03-06 10:46:43 -06:00
// Standart Predicates (Attributes).
2008-04-02 07:11:31 -05:00
DirectGetBoolAttribute(PyNet_isGlobal ,isGlobal ,PyNet,Net)
DirectGetBoolAttribute(PyNet_isExternal,isExternal,PyNet,Net)
DirectGetBoolAttribute(PyNet_isLogical ,isLogical ,PyNet,Net)
DirectGetBoolAttribute(PyNet_isClock ,isClock ,PyNet,Net)
DirectGetBoolAttribute(PyNet_isGround ,isGround ,PyNet,Net)
DirectGetBoolAttribute(PyNet_isPower ,isPower ,PyNet,Net)
DirectGetBoolAttribute(PyNet_isSupply ,isSupply ,PyNet,Net)
2008-03-06 10:46:43 -06:00
GetBoundStateAttribute(PyNet_IsPyBound ,PyNet,Net)
2008-03-17 08:54:33 -05:00
// Standart destroy (Attribute).
DBoDestroyAttribute(PyNet_destroy, PyNet)
2008-03-06 10:46:43 -06:00
// ---------------------------------------------------------------
2008-03-17 08:54:33 -05:00
// Attribute Method : "PyNet_getName ()"
2008-03-06 10:46:43 -06:00
2008-03-17 08:54:33 -05:00
static PyObject* PyNet_getName ( PyNet *self ) {
trace << "PyNet_getName ()" << endl;
2008-03-06 10:46:43 -06:00
2008-03-17 08:54:33 -05:00
METHOD_HEAD ( "Net.getName()" )
2008-03-06 10:46:43 -06:00
PyName* pyName = PyObject_NEW ( PyName, &PyTypeName );
if ( pyName == NULL ) { return NULL; }
trace_in ();
trace << "new PyName [" << hex << pyName << "]" << endl;
trace_out ();
HTRY
2008-03-17 08:54:33 -05:00
pyName->_object = new Name ( net->getName() );
2008-03-06 10:46:43 -06:00
HCATCH
return ( (PyObject*)pyName );
}
// ---------------------------------------------------------------
2008-03-17 08:54:33 -05:00
// Attribute Method : "PyNet_getType ()"
2008-03-06 10:46:43 -06:00
2008-03-17 08:54:33 -05:00
static PyObject* PyNet_getType ( PyNet *self )
2008-03-06 10:46:43 -06:00
{
2008-03-17 08:54:33 -05:00
trace << "PyNet_getType ()" << endl;
2008-03-06 10:46:43 -06:00
2008-03-17 08:54:33 -05:00
METHOD_HEAD ( "Net.getType()" )
2008-03-06 10:46:43 -06:00
2008-03-17 08:54:33 -05:00
return ( (PyObject*)Py_BuildValue("i",(long)net->getType().getCode()) );
2008-03-06 10:46:43 -06:00
}
// ---------------------------------------------------------------
2008-03-17 08:54:33 -05:00
// Attribute Method : "PyNet_getDirection ()"
2008-03-06 10:46:43 -06:00
2008-03-17 08:54:33 -05:00
static PyObject* PyNet_getDirection ( PyNet *self )
2008-03-06 10:46:43 -06:00
{
2008-03-17 08:54:33 -05:00
trace << "PyNet_getDirection ()" << endl;
2008-03-06 10:46:43 -06:00
2008-03-17 08:54:33 -05:00
METHOD_HEAD ( "Net.getDirection()" )
2008-03-06 10:46:43 -06:00
2008-03-17 08:54:33 -05:00
return ( (PyObject*)Py_BuildValue("i",(long)net->getDirection().getCode()) );
2008-03-06 10:46:43 -06:00
}
// ---------------------------------------------------------------
2008-03-17 08:54:33 -05:00
// Attribute Method : "PyNet_getPlugsLocator ()"
2008-03-06 10:46:43 -06:00
2008-03-17 08:54:33 -05:00
static PyObject* PyNet_getPlugsLocator ( PyNet *self )
2008-03-06 10:46:43 -06:00
{
2008-03-17 08:54:33 -05:00
trace << "PyNet_getPlugsLocator ()" << endl;
2008-03-06 10:46:43 -06:00
2008-03-17 08:54:33 -05:00
METHOD_HEAD ( "Net.getPlugsLocator()" )
2008-03-06 10:46:43 -06:00
2008-03-17 08:54:33 -05:00
Plugs plugs = net->getPlugs ();
2008-03-06 10:46:43 -06:00
PyPlugLocator* pyPlugLocator = PyObject_NEW ( PyPlugLocator, &PyTypePlugLocator );
if (pyPlugLocator == NULL) { return NULL; }
trace_in ();
trace << "new PyPlugLocator [" << hex << pyPlugLocator << "]" << endl;
trace_out ();
HTRY
2008-03-17 08:54:33 -05:00
pyPlugLocator->_object = plugs.getLocator ();
2008-03-06 10:46:43 -06:00
HCATCH
return ( (PyObject*)pyPlugLocator );
}
// ---------------------------------------------------------------
2008-03-17 08:54:33 -05:00
// Attribute Method : "PyNet_getSegmentsLocator ()"
2008-03-06 10:46:43 -06:00
2008-03-17 08:54:33 -05:00
static PyObject* PyNet_getSegmentsLocator ( PyNet *self )
2008-03-06 10:46:43 -06:00
{
2008-03-17 08:54:33 -05:00
trace << "PyNet_getSegmentsLocator ()" << endl;
2008-03-06 10:46:43 -06:00
2008-03-17 08:54:33 -05:00
METHOD_HEAD ( "Net.getSegmentsLocator()" )
2008-03-06 10:46:43 -06:00
2008-03-17 08:54:33 -05:00
Segments segments = net->getSegments ();
2008-03-06 10:46:43 -06:00
PySegmentLocator* pySegmentLocator = PyObject_NEW ( PySegmentLocator, &PyTypeSegmentLocator );
if (pySegmentLocator == NULL) { return NULL; }
trace_in ();
trace << "new PySegmentLocator [" << hex << pySegmentLocator << "]" << endl;
trace_out ();
HTRY
2008-03-17 08:54:33 -05:00
pySegmentLocator->_object = segments.getLocator ();
2008-03-06 10:46:43 -06:00
HCATCH
return ( (PyObject*)pySegmentLocator );
}
// ---------------------------------------------------------------
2008-03-17 08:54:33 -05:00
// Attribute Method : "PyNet_getPinsLocator ()"
2008-03-06 10:46:43 -06:00
2008-03-17 08:54:33 -05:00
static PyObject* PyNet_getPinsLocator ( PyNet *self )
2008-03-06 10:46:43 -06:00
{
2008-03-17 08:54:33 -05:00
trace << "PyNet_getPinsLocator ()" << endl;
2008-03-06 10:46:43 -06:00
2008-03-17 08:54:33 -05:00
METHOD_HEAD ( "Net.getPinsLocator()" )
2008-03-06 10:46:43 -06:00
2008-03-17 08:54:33 -05:00
Pins pins = net->getPins ();
2008-03-06 10:46:43 -06:00
PyPinLocator* pyPinLocator = PyObject_NEW ( PyPinLocator, &PyTypePinLocator );
if (pyPinLocator == NULL) { return NULL; }
trace_in ();
trace << "new PyPinLocator [" << hex << pyPinLocator << "]" << endl;
trace_out ();
HTRY
2008-03-17 08:54:33 -05:00
pyPinLocator->_object = pins.getLocator ();
2008-03-06 10:46:43 -06:00
HCATCH
return ( (PyObject*)pyPinLocator );
}
// ---------------------------------------------------------------
2008-03-17 08:54:33 -05:00
// Attribute Method : "PyNet_getExternalComponentsLocator ()"
2008-03-06 10:46:43 -06:00
2008-03-17 08:54:33 -05:00
static PyObject* PyNet_getExternalComponentsLocator ( PyNet *self )
2008-03-06 10:46:43 -06:00
{
2008-03-17 08:54:33 -05:00
trace << "PyNet_getExternalComponentsLocator ()" << endl;
2008-03-06 10:46:43 -06:00
2008-03-17 08:54:33 -05:00
METHOD_HEAD ( "Net.getExternalcomponentsLocator()" )
2008-03-06 10:46:43 -06:00
Components externalComponents = NetExternalComponents::get(net);
2008-03-06 10:46:43 -06:00
PyComponentLocator* pyExternalComponentsLocator = PyObject_NEW ( PyComponentLocator, &PyTypeComponentLocator );
if (pyExternalComponentsLocator == NULL) { return NULL; }
trace_in ();
trace << "new PyExternalComponentsLocator [" << hex << pyExternalComponentsLocator << "]" << endl;
trace_out ();
HTRY
2008-03-17 08:54:33 -05:00
pyExternalComponentsLocator->_object = externalComponents.getLocator ();
2008-03-06 10:46:43 -06:00
HCATCH
return ( (PyObject*)pyExternalComponentsLocator );
}
// ---------------------------------------------------------------
2008-04-02 07:11:31 -05:00
// Attribute Method : "PyNet_setName ()"
2008-03-06 10:46:43 -06:00
2008-04-02 07:11:31 -05:00
static PyObject* PyNet_setName ( PyNet *self, PyObject* args )
2008-03-06 10:46:43 -06:00
{
2008-04-02 07:11:31 -05:00
trace << "PyNet_setName()" << endl;
2008-03-06 10:46:43 -06:00
HTRY
2008-04-02 07:11:31 -05:00
METHOD_HEAD ( "Net.setName()" )
2008-03-06 10:46:43 -06:00
PyObject* arg0;
2008-04-02 07:11:31 -05:00
if ( ! ParseOneArg ( "Net.setName", args, NET_ARG, (PyObject**)&arg0 ) ) return ( NULL );
2008-03-06 10:46:43 -06:00
2008-04-02 07:11:31 -05:00
net->setName ( *PYNAME_O(arg0) );
2008-03-06 10:46:43 -06:00
HCATCH
Py_RETURN_NONE;
}
// ---------------------------------------------------------------
2008-04-02 07:11:31 -05:00
// Attribute Method : "PyNet_setGlobal ()"
2008-03-06 10:46:43 -06:00
2008-04-02 07:11:31 -05:00
static PyObject* PyNet_setGlobal ( PyNet *self, PyObject* args )
2008-03-06 10:46:43 -06:00
{
2008-04-02 07:11:31 -05:00
trace << "PyNet_setGlobal()" << endl;
2008-03-06 10:46:43 -06:00
HTRY
2008-04-02 07:11:31 -05:00
METHOD_HEAD ( "Net.setGlobal()" )
2008-03-06 10:46:43 -06:00
PyObject* arg0;
2008-04-02 07:11:31 -05:00
if ( ! ParseOneArg ( "Net.setGlobal", args, INT_ARG, (PyObject**)&arg0 ) ) return ( NULL );
2008-03-06 10:46:43 -06:00
2008-04-02 07:11:31 -05:00
net->setGlobal ( PyInt_AsLong(arg0) != 0 );
2008-03-06 10:46:43 -06:00
HCATCH
Py_RETURN_NONE;
}
// ---------------------------------------------------------------
2008-04-02 07:11:31 -05:00
// Attribute Method : "PyNet_setExternal ()"
2008-03-06 10:46:43 -06:00
2008-04-02 07:11:31 -05:00
static PyObject* PyNet_setExternal ( PyNet *self, PyObject* args )
2008-03-06 10:46:43 -06:00
{
2008-04-02 07:11:31 -05:00
trace << "PyNet_setExternal()" << endl;
2008-03-06 10:46:43 -06:00
HTRY
2008-04-02 07:11:31 -05:00
METHOD_HEAD ( "Net.setExternal()" )
2008-03-06 10:46:43 -06:00
PyObject* arg0;
2008-04-02 07:11:31 -05:00
if ( ! ParseOneArg ( "Net.setExternal", args, INT_ARG, (PyObject**)&arg0 ) ) return ( NULL );
2008-03-06 10:46:43 -06:00
2008-04-02 07:11:31 -05:00
net->setExternal ( PyInt_AsLong(arg0) != 0 );
2008-03-06 10:46:43 -06:00
HCATCH
Py_RETURN_NONE;
}
// ---------------------------------------------------------------
2008-04-02 07:11:31 -05:00
// Attribute Method : "PyNet_setType ()"
2008-03-06 10:46:43 -06:00
2008-04-02 07:11:31 -05:00
static PyObject* PyNet_setType ( PyNet *self, PyObject* args )
2008-03-06 10:46:43 -06:00
{
2008-04-02 07:11:31 -05:00
trace << "PyNet_setType()" << endl;
2008-03-06 10:46:43 -06:00
HTRY
2008-04-02 07:11:31 -05:00
METHOD_HEAD ( "Net.setType()" )
2008-03-06 10:46:43 -06:00
PyObject* arg0;
2008-04-02 07:11:31 -05:00
if ( ! ParseOneArg ( "Net.setType", args, INT_ARG, (PyObject**)&arg0 ) ) return ( NULL );
2008-03-06 10:46:43 -06:00
2008-04-02 07:11:31 -05:00
net->setType ( PyInt_AsType(arg0) );
2008-03-06 10:46:43 -06:00
HCATCH
Py_RETURN_NONE;
}
// ---------------------------------------------------------------
2008-04-02 07:11:31 -05:00
// Attribute Method : "PyNet_setDirection ()"
2008-03-06 10:46:43 -06:00
2008-04-02 07:11:31 -05:00
static PyObject* PyNet_setDirection ( PyNet *self, PyObject* args )
2008-03-06 10:46:43 -06:00
{
2008-04-02 07:11:31 -05:00
trace << "PyNet_setDirection()" << endl;
2008-03-06 10:46:43 -06:00
HTRY
2008-04-02 07:11:31 -05:00
METHOD_HEAD ( "Net.setDirection()" )
2008-03-06 10:46:43 -06:00
PyObject* arg0;
2008-04-02 07:11:31 -05:00
if ( ! ParseOneArg ( "Net.setDirection", args, INT_ARG, (PyObject**)&arg0 ) ) return ( NULL );
2008-03-06 10:46:43 -06:00
2008-04-02 07:11:31 -05:00
net->setDirection ( PyInt_AsDirection(arg0) );
2008-03-06 10:46:43 -06:00
HCATCH
Py_RETURN_NONE;
}
// ---------------------------------------------------------------
2008-04-02 07:11:31 -05:00
// Attribute Method : "PyNet_setPosition ()"
2008-03-06 10:46:43 -06:00
2008-04-02 07:11:31 -05:00
static PyObject* PyNet_setPosition ( PyNet *self, PyObject* args )
2008-03-06 10:46:43 -06:00
{
2008-04-02 07:11:31 -05:00
trace << "PyNet_setPosition()" << endl;
2008-03-06 10:46:43 -06:00
HTRY
2008-04-02 07:11:31 -05:00
METHOD_HEAD ( "Net.setPosition()" )
2008-03-06 10:46:43 -06:00
PyObject* arg0;
2008-04-02 07:11:31 -05:00
if ( ! ParseOneArg ( "Net.setPosition", args, POINT_ARG, (PyObject**)&arg0 ) ) return ( NULL );
2008-03-06 10:46:43 -06:00
2008-04-02 07:11:31 -05:00
net->setPosition ( *PYPOINT_O(arg0) );
2008-03-06 10:46:43 -06:00
HCATCH
Py_RETURN_NONE;
}
// ---------------------------------------------------------------
2008-04-02 07:11:31 -05:00
// Attribute Method : "PyNet_merge ()"
2008-03-06 10:46:43 -06:00
2008-04-02 07:11:31 -05:00
static PyObject* PyNet_merge ( PyNet *self, PyObject* args ) {
trace << "PyNet_merge()" << endl;
2008-03-06 10:46:43 -06:00
HTRY
2008-04-02 07:11:31 -05:00
METHOD_HEAD ( "Net.merge()" )
2008-03-06 10:46:43 -06:00
PyObject* arg0;
2008-04-02 07:11:31 -05:00
if ( ! ParseOneArg ( "Net.merge", args, NET_ARG, (PyObject**)&arg0 ) ) return ( NULL );
2008-03-06 10:46:43 -06:00
2008-04-02 07:11:31 -05:00
net->merge ( PYNET_O(arg0) );
2008-03-06 10:46:43 -06:00
HCATCH
Py_RETURN_NONE;
}
// ---------------------------------------------------------------
// PyNet Attribute Method table.
PyMethodDef PyNet_Methods[] =
2008-03-17 08:54:33 -05:00
{ { "getName" , (PyCFunction)PyNet_getName , METH_NOARGS , "Returns the net name." }
, { "getType" , (PyCFunction)PyNet_getType , METH_NOARGS
2008-03-06 10:46:43 -06:00
, "Returns the signal type (by default set to UNDEFINED)." }
2008-03-17 08:54:33 -05:00
, { "getDirection" , (PyCFunction)PyNet_getDirection , METH_NOARGS
2008-03-06 10:46:43 -06:00
, "Returns the signal direction (by default set to UNDEFINED)." }
2008-03-17 08:54:33 -05:00
, { "getX" , (PyCFunction)PyNet_getX , METH_NOARGS , "Returns net abscissa." }
, { "getY" , (PyCFunction)PyNet_getY , METH_NOARGS , "Returns net ordinate." }
, { "getExternalComponents", (PyCFunction)PyNet_getExternalComponentsLocator , METH_NOARGS , "Returns the collection of net's external components. (only for an external net)" }
, { "getPlugsLocator" , (PyCFunction)PyNet_getPlugsLocator , METH_NOARGS , "Returns the collection of net's plugs." }
, { "getPinsLocator" , (PyCFunction)PyNet_getPinsLocator , METH_NOARGS , "Returns the collection of net's pins." }
, { "getSegmentsLocator" , (PyCFunction)PyNet_getSegmentsLocator , METH_NOARGS , "Returns the collection of net's segments." }
2008-04-02 07:11:31 -05:00
, { "isGlobal" , (PyCFunction)PyNet_isGlobal , METH_NOARGS, "return true if the net is global" }
, { "isExternal" , (PyCFunction)PyNet_isExternal , METH_NOARGS, "return true if the the net is external." }
, { "isLogical" , (PyCFunction)PyNet_isLogical , METH_NOARGS, "return true if the net is logical ." }
, { "isClock" , (PyCFunction)PyNet_isClock , METH_NOARGS, "return true if the net is a clock" }
, { "isPower" , (PyCFunction)PyNet_isPower , METH_NOARGS, "return true if the net is a power" }
, { "isGround" , (PyCFunction)PyNet_isGround , METH_NOARGS, "return true if the net is a ground" }
, { "isSupply" , (PyCFunction)PyNet_isSupply , METH_NOARGS, "return true if the net is a supply" }
, { "isBound" , (PyCFunction)PyNet_IsPyBound , METH_NOARGS, "return true if the net is bounded to the hurricane net" }
, { "setName" , (PyCFunction)PyNet_setName , METH_VARARGS, "Allows to change net name." }
, { "setGlobal" , (PyCFunction)PyNet_setGlobal , METH_VARARGS, "set the net global." }
, { "setExternal" , (PyCFunction)PyNet_setExternal , METH_VARARGS, "set the net external." }
, { "setType" , (PyCFunction)PyNet_setType , METH_VARARGS, "set the type of the net." }
, { "setDirection" , (PyCFunction)PyNet_setDirection , METH_VARARGS, "set the direction of the net." }
, { "setPosition" , (PyCFunction)PyNet_setPosition , METH_VARARGS, "set the X,Y location of the net." }
, { "merge" , (PyCFunction)PyNet_merge , METH_VARARGS
2008-03-06 10:46:43 -06:00
, "Merges the net <net> to the net <this> which keeps its characteristics (arity, global, external and direction)." }
2008-03-17 08:54:33 -05:00
, { "destroy" , (PyCFunction)PyNet_destroy , METH_NOARGS
, "Destroy associated hurricane object, the python object remains." }
2008-03-06 10:46:43 -06:00
, {NULL, NULL, 0, NULL} /* sentinel */
};
// x-------------------------------------------------------------x
// | "PyNet" Object Methods |
// x-------------------------------------------------------------x
// ---------------------------------------------------------------
// Attribute Method : "PyNet_new ()"
static PyObject* PyNet_new(PyTypeObject *type, PyObject *args, PyObject *kwds) {
trace << "PyNet_new()" << endl;
Net* net = NULL;
PyObject* arg0;
PyObject* arg1;
if ( ! ParseTwoArg ( "Net.new", args, CELL_NAME_ARG, &arg0, &arg1 ) ) return ( NULL );
HTRY
2008-03-18 04:42:44 -05:00
net = Net::create ( PYCELL_O(arg0), *PYNAME_O(arg1) );
2008-03-06 10:46:43 -06:00
HCATCH
return PyNet_Link ( net );
}
DBoDeleteMethod(Net)
PyTypeObjectLinkPyType(Net)
PyTypeObjectConstructor(Net)
#else // End of Python Module Code Part.
// x=================================================================x
// | "PyNet" Shared Library Code Part |
// x=================================================================x
// Link/Creation Method.
DBoLinkCreateMethod(PyNet_Link,PyNet,PyTypeNet,Net)
// ---------------------------------------------------------------
// PyNet Object Definitions.
PyTypeInheritedObjectDefinitions(Net, Entity)
# endif // End of Shared Library Code Part.
} // End of extern "C".
} // End of Isobar namespace.