2008-10-14 05:48:53 -05:00
|
|
|
#include "hurricane/isobar/PyNetCollection.h"
|
|
|
|
#include "hurricane/isobar/PyNet.h"
|
|
|
|
|
|
|
|
namespace Isobar {
|
|
|
|
|
|
|
|
using namespace Hurricane;
|
|
|
|
|
|
|
|
|
|
|
|
extern "C" {
|
|
|
|
|
|
|
|
|
|
|
|
// x=================================================================x
|
|
|
|
// | "PyNetCollection" Python Module Code Part |
|
|
|
|
// x=================================================================x
|
|
|
|
|
|
|
|
#if defined(__PYTHON_MODULE__)
|
|
|
|
|
|
|
|
|
|
|
|
// x-------------------------------------------------------------x
|
|
|
|
// | "PyNetCollection" Attribute Methods |
|
|
|
|
// x-------------------------------------------------------------x
|
|
|
|
|
|
|
|
|
2008-10-14 13:44:20 -05:00
|
|
|
DirectDeleteMethod(PyNetCollection_DeAlloc, PyNetCollection)
|
2008-10-14 05:48:53 -05:00
|
|
|
|
2008-10-17 12:27:20 -05:00
|
|
|
static void PyNetCollectionLocator_DeAlloc(PyNetCollectionLocator* pyLocator) {
|
|
|
|
Py_XDECREF(pyLocator->_collection);
|
|
|
|
if (pyLocator->_object) {
|
|
|
|
delete pyLocator->_object;
|
2008-10-14 05:48:53 -05:00
|
|
|
}
|
2008-10-17 12:27:20 -05:00
|
|
|
PyObject_Del(pyLocator);
|
2008-10-14 05:48:53 -05:00
|
|
|
}
|
|
|
|
|
2008-10-17 12:27:20 -05:00
|
|
|
GetLocatorMethod(Net)
|
|
|
|
|
2008-10-14 05:48:53 -05:00
|
|
|
static PyObject* NetLocatorNext(PyNetCollectionLocator* pyLocator) {
|
|
|
|
Locator<Net*>* locator = pyLocator->_object;
|
|
|
|
|
|
|
|
if (locator->isValid()) {
|
|
|
|
Net* net = locator->getElement();
|
|
|
|
locator->progress();
|
|
|
|
return PyNet_Link(net);
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
extern void PyNetCollection_LinkPyType () {
|
|
|
|
trace << "PyNetCollection_LinkType()" << endl;
|
2008-10-17 12:27:20 -05:00
|
|
|
PyTypeNetCollection.tp_iter = (getiterfunc)GetLocator; /* tp_iter */
|
2008-10-14 13:44:20 -05:00
|
|
|
PyTypeNetCollection.tp_dealloc = (destructor)PyNetCollection_DeAlloc;
|
|
|
|
PyTypeNetCollectionLocator.tp_dealloc = (destructor)PyNetCollectionLocator_DeAlloc;
|
2008-10-14 05:48:53 -05:00
|
|
|
PyTypeNetCollectionLocator.tp_iter = PyObject_SelfIter;
|
|
|
|
PyTypeNetCollectionLocator.tp_iternext = (iternextfunc)NetLocatorNext;
|
2008-10-14 13:44:20 -05:00
|
|
|
PyTypeNetCollection.tp_dealloc = (destructor)PyNetCollection_DeAlloc;
|
2008-10-14 05:48:53 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#else // End of Python Module Code Part.
|
|
|
|
|
|
|
|
|
|
|
|
// x=================================================================x
|
|
|
|
// | "PyNetCollection" Shared Library Code Part |
|
|
|
|
// x=================================================================x
|
|
|
|
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------
|
|
|
|
// PyNetCollection Object Definitions.
|
|
|
|
|
2008-10-17 12:27:20 -05:00
|
|
|
PyTypeCollectionObjectDefinitions(NetCollection)
|
|
|
|
PyTypeCollectionObjectDefinitions(NetCollectionLocator)
|
2008-10-14 05:48:53 -05:00
|
|
|
|
|
|
|
#endif // End of Shared Library Code Part.
|
|
|
|
|
|
|
|
|
|
|
|
} // End of extern "C".
|
|
|
|
|
|
|
|
} // End of Isobar namespace.
|