PyCollections implementation

This commit is contained in:
Christophe Alexandre 2008-10-19 22:07:32 +00:00
parent 07a1213ad8
commit 8397e7dccd
12 changed files with 458 additions and 15 deletions

View File

@ -6,9 +6,9 @@
set ( sources ProxyProperty.cpp
PyBox.cpp
PyCell.cpp
#PyCellCollection.cpp
PyCellCollection.cpp
PyComponent.cpp
# PyComponentLocator.cpp
PyComponentCollection.cpp
PyContact.cpp
PyDataBase.cpp
PyEntity.cpp
@ -16,24 +16,24 @@
PyHurricane.cpp
PyHyperNet.cpp
PyInstance.cpp
#PyInstanceLocator.cpp
PyInstanceCollection.cpp
PyLayer.cpp
PyLibrary.cpp
PyName.cpp
PyNet.cpp
PyNetCollection.cpp
PyOccurrence.cpp
#PyOccurrenceLocator.cpp
PyOccurrenceCollection.cpp
PyPath.cpp
PyPin.cpp
#PyPinLocator.cpp
PyPinCollection.cpp
PyPlug.cpp
#PyPlugLocator.cpp
PyPlugCollection.cpp
PyPoint.cpp
PyReference.cpp
#PyReferenceLocator.cpp
PyReferenceCollection.cpp
PySegment.cpp
#PySegmentLocator.cpp
PySegmentCollection.cpp
PyTechnology.cpp
PyTransformation.cpp
PyDbU.cpp

View File

@ -0,0 +1,52 @@
#include "hurricane/isobar/PyInstanceCollection.h"
#include "hurricane/isobar/PyInstance.h"
namespace Isobar {
using namespace Hurricane;
extern "C" {
// x=================================================================x
// | "PyInstanceCollection" Python Module Code Part |
// x=================================================================x
#if defined(__PYTHON_MODULE__)
// x-------------------------------------------------------------x
// | "PyInstanceCollection" Attribute Methods |
// x-------------------------------------------------------------x
DirectDeleteMethod(PyInstanceCollection_DeAlloc, PyInstanceCollection)
LocatorNextMethod(Instance)
CollectionMethods(Instance)
#else // End of Python Module Code Part.
// x=================================================================x
// | "PyInstanceCollection" Shared Library Code Part |
// x=================================================================x
// ---------------------------------------------------------------
// PyInstanceCollection Object Definitions.
PyTypeCollectionObjectDefinitions(InstanceCollection)
PyTypeCollectionObjectDefinitions(InstanceCollectionLocator)
#endif // End of Shared Library Code Part.
} // End of extern "C".
} // End of Isobar namespace.

View File

@ -0,0 +1,52 @@
#include "hurricane/isobar/PyComponentCollection.h"
#include "hurricane/isobar/PyComponent.h"
namespace Isobar {
using namespace Hurricane;
extern "C" {
// x=================================================================x
// | "PyComponentCollection" Python Module Code Part |
// x=================================================================x
#if defined(__PYTHON_MODULE__)
// x-------------------------------------------------------------x
// | "PyComponentCollection" Attribute Methods |
// x-------------------------------------------------------------x
DirectDeleteMethod(PyComponentCollection_DeAlloc, PyComponentCollection)
EntityLocatorNextMethod(Component)
CollectionMethods(Component)
#else // End of Python Module Code Part.
// x=================================================================x
// | "PyComponentCollection" Shared Library Code Part |
// x=================================================================x
// ---------------------------------------------------------------
// PyComponentCollection Object Definitions.
PyTypeCollectionObjectDefinitions(ComponentCollection)
PyTypeCollectionObjectDefinitions(ComponentCollectionLocator)
#endif // End of Shared Library Code Part.
} // End of extern "C".
} // End of Isobar namespace.

View File

@ -702,8 +702,6 @@ extern "C" {
NetLoadConstants ( dictionnary );
InstanceLoadConstants ( dictionnary );
PinLoadConstants ( dictionnary );
trace_on();
}

View File

@ -481,7 +481,7 @@ extern "C" {
PyTypeObjectConstructor(Instance)
# else // End of Python Module Code Part.
#else // End of Python Module Code Part.
// x=================================================================x
@ -489,9 +489,6 @@ extern "C" {
// x=================================================================x
// Link/Creation Method.
DBoLinkCreateMethod(Instance)

View File

@ -0,0 +1,52 @@
#include "hurricane/isobar/PyCellCollection.h"
#include "hurricane/isobar/PyCell.h"
namespace Isobar {
using namespace Hurricane;
extern "C" {
// x=================================================================x
// | "PyCellCollection" Python Module Code Part |
// x=================================================================x
#if defined(__PYTHON_MODULE__)
// x-------------------------------------------------------------x
// | "PyCellCollection" Attribute Methods |
// x-------------------------------------------------------------x
DirectDeleteMethod(PyCellCollection_DeAlloc, PyCellCollection)
LocatorNextMethod(Cell)
CollectionMethods(Cell)
#else // End of Python Module Code Part.
// x=================================================================x
// | "PyCellCollection" Shared Library Code Part |
// x=================================================================x
// ---------------------------------------------------------------
// PyCellCollection Object Definitions.
PyTypeCollectionObjectDefinitions(CellCollection)
PyTypeCollectionObjectDefinitions(CellCollectionLocator)
#endif // End of Shared Library Code Part.
} // End of extern "C".
} // End of Isobar namespace.

View File

@ -0,0 +1,69 @@
#include "hurricane/isobar/PyOccurrenceCollection.h"
#include "hurricane/isobar/PyOccurrence.h"
namespace Isobar {
using namespace Hurricane;
extern "C" {
// x=================================================================x
// | "PyOccurrenceCollection" Python Module Code Part |
// x=================================================================x
#if defined(__PYTHON_MODULE__)
// x-------------------------------------------------------------x
// | "PyOccurrenceCollection" Attribute Methods |
// x-------------------------------------------------------------x
DirectDeleteMethod(PyOccurrenceCollection_DeAlloc, PyOccurrenceCollection)
static PyObject* PyOccurrenceLocatorNext(PyOccurrenceCollectionLocator* pyLocator) {
Locator<Occurrence>* locator = pyLocator->_object;
HTRY
if (locator->isValid()) {
Occurrence occurrence = locator->getElement();
PyOccurrence* pyOccurrence = PyObject_NEW(PyOccurrence, &PyTypeOccurrence);
if (pyOccurrence == NULL) {
return NULL;
}
pyOccurrence->_object = new Occurrence(occurrence);
locator->progress();
return (PyObject*)pyOccurrence;
}
HCATCH
return NULL;
}
CollectionMethods(Occurrence)
#else // End of Python Module Code Part.
// x=================================================================x
// | "PyOccurrenceCollection" Shared Library Code Part |
// x=================================================================x
// ---------------------------------------------------------------
// PyOccurrenceCollection Object Definitions.
PyTypeCollectionObjectDefinitions(OccurrenceCollection)
PyTypeCollectionObjectDefinitions(OccurrenceCollectionLocator)
#endif // End of Shared Library Code Part.
} // End of extern "C".
} // End of Isobar namespace.

View File

@ -0,0 +1,52 @@
#include "hurricane/isobar/PyPinCollection.h"
#include "hurricane/isobar/PyPin.h"
namespace Isobar {
using namespace Hurricane;
extern "C" {
// x=================================================================x
// | "PyPinCollection" Python Module Code Part |
// x=================================================================x
#if defined(__PYTHON_MODULE__)
// x-------------------------------------------------------------x
// | "PyPinCollection" Attribute Methods |
// x-------------------------------------------------------------x
DirectDeleteMethod(PyPinCollection_DeAlloc, PyPinCollection)
LocatorNextMethod(Pin)
CollectionMethods(Pin)
#else // End of Python Module Code Part.
// x=================================================================x
// | "PyPinCollection" Shared Library Code Part |
// x=================================================================x
// ---------------------------------------------------------------
// PyPinCollection Object Definitions.
PyTypeCollectionObjectDefinitions(PinCollection)
PyTypeCollectionObjectDefinitions(PinCollectionLocator)
#endif // End of Shared Library Code Part.
} // End of extern "C".
} // End of Isobar namespace.

View File

@ -0,0 +1,52 @@
#include "hurricane/isobar/PyPlugCollection.h"
#include "hurricane/isobar/PyPlug.h"
namespace Isobar {
using namespace Hurricane;
extern "C" {
// x=================================================================x
// | "PyPlugCollection" Python Module Code Part |
// x=================================================================x
#if defined(__PYTHON_MODULE__)
// x-------------------------------------------------------------x
// | "PyPlugCollection" Attribute Methods |
// x-------------------------------------------------------------x
DirectDeleteMethod(PyPlugCollection_DeAlloc, PyPlugCollection)
LocatorNextMethod(Plug)
CollectionMethods(Plug)
#else // End of Python Module Code Part.
// x=================================================================x
// | "PyPlugCollection" Shared Library Code Part |
// x=================================================================x
// ---------------------------------------------------------------
// PyPlugCollection Object Definitions.
PyTypeCollectionObjectDefinitions(PlugCollection)
PyTypeCollectionObjectDefinitions(PlugCollectionLocator)
#endif // End of Shared Library Code Part.
} // End of extern "C".
} // End of Isobar namespace.

View File

@ -0,0 +1,52 @@
#include "hurricane/isobar/PyReferenceCollection.h"
#include "hurricane/isobar/PyReference.h"
namespace Isobar {
using namespace Hurricane;
extern "C" {
// x=================================================================x
// | "PyReferenceCollection" Python Module Code Part |
// x=================================================================x
#if defined(__PYTHON_MODULE__)
// x-------------------------------------------------------------x
// | "PyReferenceCollection" Attribute Methods |
// x-------------------------------------------------------------x
DirectDeleteMethod(PyReferenceCollection_DeAlloc, PyReferenceCollection)
LocatorNextMethod(Reference)
CollectionMethods(Reference)
#else // End of Python Module Code Part.
// x=================================================================x
// | "PyReferenceCollection" Shared Library Code Part |
// x=================================================================x
// ---------------------------------------------------------------
// PyReferenceCollection Object Definitions.
PyTypeCollectionObjectDefinitions(ReferenceCollection)
PyTypeCollectionObjectDefinitions(ReferenceCollectionLocator)
#endif // End of Shared Library Code Part.
} // End of extern "C".
} // End of Isobar namespace.

View File

@ -0,0 +1,52 @@
#include "hurricane/isobar/PySegmentCollection.h"
#include "hurricane/isobar/PySegment.h"
namespace Isobar {
using namespace Hurricane;
extern "C" {
// x=================================================================x
// | "PySegmentCollection" Python Module Code Part |
// x=================================================================x
#if defined(__PYTHON_MODULE__)
// x-------------------------------------------------------------x
// | "PySegmentCollection" Attribute Methods |
// x-------------------------------------------------------------x
DirectDeleteMethod(PySegmentCollection_DeAlloc, PySegmentCollection)
EntityLocatorNextMethod(Segment)
CollectionMethods(Segment)
#else // End of Python Module Code Part.
// x=================================================================x
// | "PySegmentCollection" Shared Library Code Part |
// x=================================================================x
// ---------------------------------------------------------------
// PySegmentCollection Object Definitions.
PyTypeCollectionObjectDefinitions(SegmentCollection)
PyTypeCollectionObjectDefinitions(SegmentCollectionLocator)
#endif // End of Shared Library Code Part.
} // End of extern "C".
} // End of Isobar namespace.

View File

@ -415,12 +415,27 @@ extern "C" {
#define LocatorNextMethod(TYPE) \
static PyObject* Py##TYPE##LocatorNext(Py##TYPE##CollectionLocator* pyLocator) { \
Locator<TYPE*>* locator = pyLocator->_object; \
\
HTRY \
if (locator->isValid()) { \
TYPE* object = locator->getElement(); \
locator->progress(); \
return Py##TYPE##_Link(object); \
} \
HCATCH \
return NULL; \
}
#define EntityLocatorNextMethod(TYPE) \
static PyObject* Py##TYPE##LocatorNext(Py##TYPE##CollectionLocator* pyLocator) { \
Locator<TYPE*>* locator = pyLocator->_object; \
HTRY \
if (locator->isValid()) { \
TYPE* object = locator->getElement(); \
locator->progress(); \
return PyEntity_NEW(object); \
} \
HCATCH \
return NULL; \
}