* ./hurricane/sr/isobar:
- New: Added support for Hook Collections, PyHookCollection.
This commit is contained in:
parent
21215595a5
commit
ecf22a10c1
|
@ -41,6 +41,7 @@
|
||||||
PyOccurrence.cpp
|
PyOccurrence.cpp
|
||||||
PyOccurrenceCollection.cpp
|
PyOccurrenceCollection.cpp
|
||||||
PyHook.cpp
|
PyHook.cpp
|
||||||
|
PyHookCollection.cpp
|
||||||
PyPad.cpp
|
PyPad.cpp
|
||||||
PyPath.cpp
|
PyPath.cpp
|
||||||
PyPin.cpp
|
PyPin.cpp
|
||||||
|
@ -95,6 +96,8 @@
|
||||||
hurricane/isobar/PyNetExternalComponents.h
|
hurricane/isobar/PyNetExternalComponents.h
|
||||||
hurricane/isobar/PyOccurrence.h
|
hurricane/isobar/PyOccurrence.h
|
||||||
hurricane/isobar/PyOccurrenceCollection.h
|
hurricane/isobar/PyOccurrenceCollection.h
|
||||||
|
hurricane/isobar/PyHook.h
|
||||||
|
hurricane/isobar/PyHookCollection.h
|
||||||
hurricane/isobar/PyPad.h
|
hurricane/isobar/PyPad.h
|
||||||
hurricane/isobar/PyPath.h
|
hurricane/isobar/PyPath.h
|
||||||
hurricane/isobar/PyPin.h
|
hurricane/isobar/PyPin.h
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#include "hurricane/isobar/PyEntity.h"
|
#include "hurricane/isobar/PyEntity.h"
|
||||||
#include "hurricane/isobar/PyComponent.h"
|
#include "hurricane/isobar/PyComponent.h"
|
||||||
#include "hurricane/isobar/PyHook.h"
|
#include "hurricane/isobar/PyHook.h"
|
||||||
|
#include "hurricane/isobar/PyHookCollection.h"
|
||||||
|
|
||||||
|
|
||||||
namespace Isobar {
|
namespace Isobar {
|
||||||
|
@ -59,6 +60,48 @@ extern "C" {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static PyObject* PyHook_getHooks ( PyHook *self )
|
||||||
|
{
|
||||||
|
trace << "PyHook_getHooks()" << endl;
|
||||||
|
|
||||||
|
METHOD_HEAD( "Hook.getHooks()" )
|
||||||
|
|
||||||
|
PyHookCollection* pyHookCollection = NULL;
|
||||||
|
|
||||||
|
HTRY
|
||||||
|
Hooks* hooks = new Hooks( hook->getHooks() );
|
||||||
|
|
||||||
|
pyHookCollection = PyObject_NEW( PyHookCollection, &PyTypeHookCollection );
|
||||||
|
if (pyHookCollection == NULL) return NULL;
|
||||||
|
|
||||||
|
pyHookCollection->_object = hooks;
|
||||||
|
HCATCH
|
||||||
|
|
||||||
|
return (PyObject*)pyHookCollection;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static PyObject* PyHook_getSlaveHooks ( PyHook *self )
|
||||||
|
{
|
||||||
|
trace << "PyHook_getSlaveHooks()" << endl;
|
||||||
|
|
||||||
|
METHOD_HEAD( "Hook.getSlaveHooks()" )
|
||||||
|
|
||||||
|
PyHookCollection* pyHookCollection = NULL;
|
||||||
|
|
||||||
|
HTRY
|
||||||
|
Hooks* hooks = new Hooks( hook->getSlaveHooks() );
|
||||||
|
|
||||||
|
pyHookCollection = PyObject_NEW( PyHookCollection, &PyTypeHookCollection );
|
||||||
|
if (pyHookCollection == NULL) return NULL;
|
||||||
|
|
||||||
|
pyHookCollection->_object = hooks;
|
||||||
|
HCATCH
|
||||||
|
|
||||||
|
return (PyObject*)pyHookCollection;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static PyObject* PyHook_detach ( PyHook *self )
|
static PyObject* PyHook_detach ( PyHook *self )
|
||||||
{
|
{
|
||||||
trace << "PyHook_detach()" << endl;
|
trace << "PyHook_detach()" << endl;
|
||||||
|
@ -145,6 +188,10 @@ extern "C" {
|
||||||
, "Return the master hook next to the master of this Hook." }
|
, "Return the master hook next to the master of this Hook." }
|
||||||
, { "getPreviousMasterHook", (PyCFunction)PyHook_getPreviousMasterHook, METH_NOARGS
|
, { "getPreviousMasterHook", (PyCFunction)PyHook_getPreviousMasterHook, METH_NOARGS
|
||||||
, "Return the master hook previous to the master of this Hook (walk trough the whole ring)." }
|
, "Return the master hook previous to the master of this Hook (walk trough the whole ring)." }
|
||||||
|
, { "getHooks" , (PyCFunction)PyHook_getHooks , METH_NOARGS
|
||||||
|
, "Return the Collection of all hooks part of that ring." }
|
||||||
|
, { "getSlaveHooks" , (PyCFunction)PyHook_getSlaveHooks , METH_NOARGS
|
||||||
|
, "Return the Collection of all hooks slave to this one." }
|
||||||
, { "isMaster" , (PyCFunction)PyHook_isMaster , METH_NOARGS
|
, { "isMaster" , (PyCFunction)PyHook_isMaster , METH_NOARGS
|
||||||
, "Tells if this Hook is of master kind" }
|
, "Tells if this Hook is of master kind" }
|
||||||
, { "isAttached" , (PyCFunction)PyHook_isAttached , METH_NOARGS
|
, { "isAttached" , (PyCFunction)PyHook_isAttached , METH_NOARGS
|
||||||
|
|
|
@ -0,0 +1,58 @@
|
||||||
|
|
||||||
|
// -*- C++ -*-
|
||||||
|
//
|
||||||
|
// This file is part of the Coriolis Software.
|
||||||
|
// Copyright (c) UPMC 2013-2013, All Rights Reserved
|
||||||
|
//
|
||||||
|
// +-----------------------------------------------------------------+
|
||||||
|
// | C O R I O L I S |
|
||||||
|
// | I s o b a r - Hurricane / Python Interface |
|
||||||
|
// | |
|
||||||
|
// | Author : Jean-Paul Chaput |
|
||||||
|
// | E-mail : Jean-Paul.Chaput@lip6.fr |
|
||||||
|
// | =============================================================== |
|
||||||
|
// | C++ Module : "./PyHookCollection.cpp" |
|
||||||
|
// +-----------------------------------------------------------------+
|
||||||
|
|
||||||
|
|
||||||
|
#include "hurricane/isobar/PyHookCollection.h"
|
||||||
|
#include "hurricane/isobar/PyHook.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace Isobar {
|
||||||
|
|
||||||
|
using namespace Hurricane;
|
||||||
|
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
|
||||||
|
|
||||||
|
#if defined(__PYTHON_MODULE__)
|
||||||
|
|
||||||
|
// +=================================================================+
|
||||||
|
// | "PyHookCollection" Python Module Code Part |
|
||||||
|
// +=================================================================+
|
||||||
|
|
||||||
|
|
||||||
|
DirectDeleteMethod(PyHookCollection_DeAlloc, PyHookCollection)
|
||||||
|
|
||||||
|
NolinkLocatorNextMethod(Hook)
|
||||||
|
CollectionMethods(Hook)
|
||||||
|
|
||||||
|
|
||||||
|
#else // End of Python Module Code Part.
|
||||||
|
|
||||||
|
// +=================================================================+
|
||||||
|
// | "PyHookCollection" Shared Library Code Part |
|
||||||
|
// +=================================================================+
|
||||||
|
|
||||||
|
|
||||||
|
PyTypeCollectionObjectDefinitions(HookCollection)
|
||||||
|
PyTypeCollectionObjectDefinitions(HookCollectionLocator)
|
||||||
|
|
||||||
|
#endif // End of Shared Library Code Part.
|
||||||
|
|
||||||
|
|
||||||
|
} // End of extern "C".
|
||||||
|
|
||||||
|
} // End of Isobar namespace.
|
|
@ -51,6 +51,7 @@
|
||||||
#include "hurricane/isobar/PyNetExternalComponents.h"
|
#include "hurricane/isobar/PyNetExternalComponents.h"
|
||||||
#include "hurricane/isobar/PyHyperNet.h"
|
#include "hurricane/isobar/PyHyperNet.h"
|
||||||
#include "hurricane/isobar/PyHook.h"
|
#include "hurricane/isobar/PyHook.h"
|
||||||
|
#include "hurricane/isobar/PyHookCollection.h"
|
||||||
#include "hurricane/isobar/PyComponent.h"
|
#include "hurricane/isobar/PyComponent.h"
|
||||||
#include "hurricane/isobar/PyComponentCollection.h"
|
#include "hurricane/isobar/PyComponentCollection.h"
|
||||||
#include "hurricane/isobar/PyPlug.h"
|
#include "hurricane/isobar/PyPlug.h"
|
||||||
|
@ -550,6 +551,7 @@ extern "C" {
|
||||||
PyNet_LinkPyType ();
|
PyNet_LinkPyType ();
|
||||||
PyHyperNet_LinkPyType ();
|
PyHyperNet_LinkPyType ();
|
||||||
PyHook_LinkPyType ();
|
PyHook_LinkPyType ();
|
||||||
|
PyHookCollection_LinkPyType ();
|
||||||
PyComponent_LinkPyType ();
|
PyComponent_LinkPyType ();
|
||||||
PySegment_LinkPyType ();
|
PySegment_LinkPyType ();
|
||||||
PyPad_LinkPyType ();
|
PyPad_LinkPyType ();
|
||||||
|
@ -573,6 +575,7 @@ extern "C" {
|
||||||
PYTYPE_READY ( Library )
|
PYTYPE_READY ( Library )
|
||||||
PYTYPE_READY ( Entity )
|
PYTYPE_READY ( Entity )
|
||||||
PYTYPE_READY ( Hook )
|
PYTYPE_READY ( Hook )
|
||||||
|
PYTYPE_READY ( HookCollection )
|
||||||
PYTYPE_READY ( Material )
|
PYTYPE_READY ( Material )
|
||||||
PYTYPE_READY ( Layer )
|
PYTYPE_READY ( Layer )
|
||||||
PYTYPE_READY ( LayerMask )
|
PYTYPE_READY ( LayerMask )
|
||||||
|
@ -637,6 +640,7 @@ extern "C" {
|
||||||
__cs.addType ( "cell" , &PyTypeCell , "<Cell>" , false, "ent" );
|
__cs.addType ( "cell" , &PyTypeCell , "<Cell>" , false, "ent" );
|
||||||
__cs.addType ( "cellCol" , &PyTypeCellCollection , "<CellCollection>" , false );
|
__cs.addType ( "cellCol" , &PyTypeCellCollection , "<CellCollection>" , false );
|
||||||
__cs.addType ( "hook" , &PyTypeHook , "<Hook>" , false );
|
__cs.addType ( "hook" , &PyTypeHook , "<Hook>" , false );
|
||||||
|
__cs.addType ( "hookColl" , &PyTypeHookCollection , "<HookCollection>" , false );
|
||||||
__cs.addType ( "comp" , &PyTypeComponent , "<Component>" , false, "ent" );
|
__cs.addType ( "comp" , &PyTypeComponent , "<Component>" , false, "ent" );
|
||||||
__cs.addType ( "compCol" , &PyTypeComponentCollection , "<ComponentCollection>" , false );
|
__cs.addType ( "compCol" , &PyTypeComponentCollection , "<ComponentCollection>" , false );
|
||||||
__cs.addType ( "contact" , &PyTypeContact , "<Contact>" , false, "comp" );
|
__cs.addType ( "contact" , &PyTypeContact , "<Contact>" , false, "comp" );
|
||||||
|
@ -729,6 +733,8 @@ extern "C" {
|
||||||
|
|
||||||
Py_INCREF ( &PyTypeHook );
|
Py_INCREF ( &PyTypeHook );
|
||||||
PyModule_AddObject ( module, "Hook" , (PyObject*)&PyTypeHook );
|
PyModule_AddObject ( module, "Hook" , (PyObject*)&PyTypeHook );
|
||||||
|
Py_INCREF ( &PyTypeHookCollection );
|
||||||
|
PyModule_AddObject ( module, "HookCollection" , (PyObject*)&PyTypeHookCollection );
|
||||||
Py_INCREF ( &PyTypeRoutingPad );
|
Py_INCREF ( &PyTypeRoutingPad );
|
||||||
PyModule_AddObject ( module, "RoutingPad" , (PyObject*)&PyTypeRoutingPad );
|
PyModule_AddObject ( module, "RoutingPad" , (PyObject*)&PyTypeRoutingPad );
|
||||||
Py_INCREF ( &PyTypeVertical );
|
Py_INCREF ( &PyTypeVertical );
|
||||||
|
|
|
@ -0,0 +1,58 @@
|
||||||
|
|
||||||
|
// -*- C++ -*-
|
||||||
|
//
|
||||||
|
// This file is part of the Coriolis Software.
|
||||||
|
// Copyright (c) UPMC 2013-2013, All Rights Reserved
|
||||||
|
//
|
||||||
|
// +-----------------------------------------------------------------+
|
||||||
|
// | C O R I O L I S |
|
||||||
|
// | I s o b a r - Hurricane / Python Interface |
|
||||||
|
// | |
|
||||||
|
// | Author : Jean-Paul Chaput |
|
||||||
|
// | E-mail : Jean-Paul.Chaput@lip6.fr |
|
||||||
|
// | =============================================================== |
|
||||||
|
// | C++ Header : "./hurricane/isobar/PyHookCollection.h" |
|
||||||
|
// +-----------------------------------------------------------------+
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef ISOBAR_PYSEGMENT_COLLECTION_H
|
||||||
|
#define ISOBAR_PYSEGMENT_COLLECTION_H
|
||||||
|
|
||||||
|
#include "hurricane/isobar/PyHurricane.h"
|
||||||
|
#include "hurricane/Hook.h"
|
||||||
|
#include "hurricane/Hooks.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace Isobar {
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
|
||||||
|
// -------------------------------------------------------------------
|
||||||
|
// Python Object : "PyHookCollection".
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
PyObject_HEAD
|
||||||
|
Hurricane::Hooks* _object;
|
||||||
|
} PyHookCollection;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
PyObject_HEAD
|
||||||
|
Hurricane::Locator<Hurricane::Hook*>* _object;
|
||||||
|
PyHookCollection* _collection;
|
||||||
|
} PyHookCollectionLocator;
|
||||||
|
|
||||||
|
|
||||||
|
// -------------------------------------------------------------------
|
||||||
|
// Functions & Types exported to "PyHurricane.ccp".
|
||||||
|
|
||||||
|
extern PyTypeObject PyTypeHookCollection;
|
||||||
|
extern PyTypeObject PyTypeHookCollectionLocator;
|
||||||
|
|
||||||
|
extern void PyHookCollection_LinkPyType();
|
||||||
|
extern void PyHookCollectionLocator_LinkPyType();
|
||||||
|
|
||||||
|
} // extern "C".
|
||||||
|
|
||||||
|
} // Isobar namespace.
|
||||||
|
|
||||||
|
#endif
|
|
@ -719,8 +719,24 @@ extern "C" {
|
||||||
return NULL; \
|
return NULL; \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define NolinkLocatorNextMethod(TYPE) \
|
||||||
|
static PyObject* Py##TYPE##LocatorNext(Py##TYPE##CollectionLocator* pyLocator) \
|
||||||
|
{ \
|
||||||
|
Locator<TYPE*>* locator = pyLocator->_object; \
|
||||||
|
HTRY \
|
||||||
|
if (locator->isValid()) { \
|
||||||
|
Py##TYPE* pyObject = PyObject_NEW( Py##TYPE, &PyType##TYPE ); \
|
||||||
|
if (pyObject == NULL) return NULL; \
|
||||||
|
pyObject->_object = locator->getElement(); \
|
||||||
|
locator->progress(); \
|
||||||
|
return (PyObject*)pyObject; \
|
||||||
|
} \
|
||||||
|
HCATCH \
|
||||||
|
return NULL; \
|
||||||
|
}
|
||||||
|
|
||||||
#define EntityLocatorNextMethod(TYPE) \
|
|
||||||
|
#define EntityLocatorNextMethod(TYPE) \
|
||||||
static PyObject* Py##TYPE##LocatorNext(Py##TYPE##CollectionLocator* pyLocator) { \
|
static PyObject* Py##TYPE##LocatorNext(Py##TYPE##CollectionLocator* pyLocator) { \
|
||||||
Locator<TYPE*>* locator = pyLocator->_object; \
|
Locator<TYPE*>* locator = pyLocator->_object; \
|
||||||
HTRY \
|
HTRY \
|
||||||
|
|
Loading…
Reference in New Issue