first version of the Python extension

This commit is contained in:
The Coriolis Project 2008-03-06 16:46:43 +00:00
parent 898f7dfb81
commit 1f0f9de3ad
80 changed files with 14659 additions and 23 deletions

View File

@ -1,16 +1,18 @@
project(HURRICANE)
PROJECT(HURRICANE)
cmake_minimum_required(VERSION 2.4.0)
CMAKE_MINIMUM_REQUIRED(VERSION 2.4.0)
set(CMAKE_MODULE_PATH "${HURRICANE_SOURCE_DIR}/cmake_modules/")
SET(CMAKE_MODULE_PATH "${HURRICANE_SOURCE_DIR}/cmake_modules/")
find_package(Qt4 REQUIRED) # find and setup Qt4 for this project
find_package(BISON REQUIRED)
find_package(FLEX REQUIRED)
find_package(Doxygen)
FIND_PACKAGE(Qt4 REQUIRED) # find and setup Qt4 for this project
FIND_PACKAGE(BISON REQUIRED)
FIND_PACKAGE(FLEX REQUIRED)
FIND_PACKAGE(PythonLibs REQUIRED)
FIND_PACKAGE(PythonInterp REQUIRED)
#FIND_PACKAGE(Doxygen)
add_subdirectory(src)
add_subdirectory(cmake_modules)
if(DOXYGEN_FOUND)
add_subdirectory(doc)
endif(DOXYGEN_FOUND)
ADD_SUBDIRECTORY(src)
ADD_SUBDIRECTORY(cmake_modules)
#IF(DOXYGEN_FOUND)
# ADD_SUBDIRECTORY(doc)
#ENDIF(DOXYGEN_FOUND)

View File

@ -1,4 +1,5 @@
add_subdirectory(hurricane)
add_subdirectory(analogic)
add_subdirectory(viewer)
add_subdirectory(editor)
ADD_SUBDIRECTORY(hurricane)
ADD_SUBDIRECTORY(analogic)
ADD_SUBDIRECTORY(viewer)
ADD_SUBDIRECTORY(editor)
ADD_SUBDIRECTORY(pyext)

View File

@ -8,10 +8,10 @@
using namespace H;
inline void boxToRectangle(const Box& box, QRectF& rec) {
double xmin = GetValue(box.getXMin() * 10.0);
double xmax = GetValue(box.getXMax()) * 10.0;
double ymin = GetValue(box.getYMin()) * 10.0;
double ymax = GetValue(box.getYMax()) * 10.0;
double xmin = GetValue(box.getXMin());
double xmax = GetValue(box.getXMax());
double ymin = GetValue(box.getYMin());
double ymax = GetValue(box.getYMax());
rec.setCoords(xmin, ymin, xmax, ymax);
}
@ -22,7 +22,7 @@ inline void hurricanePositionToQtPosition(const Transformation& transformation,
position.setX((int)tx);
position.setY((int)ty);
switch (transformation.GetOrientation()) {
switch (transformation.getOrientation()) {
case Transformation::Orientation::ID:
transform.setMatrix(1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0);
break;

View File

@ -330,7 +330,7 @@ void Instance::Translate(const Unit& dx, const Unit& dy)
Point translation = _transformation.getTranslation();
Unit x = translation.getX() + dx;
Unit y = translation.getY() + dy;
Transformation::Orientation orientation = _transformation.GetOrientation();
Transformation::Orientation orientation = _transformation.getOrientation();
SetTransformation(Transformation(x, y, orientation));
}
}

View File

@ -75,7 +75,7 @@ class Transformation {
public: const Unit& getTx() const {return _tx;};
public: const Unit& getTy() const {return _ty;};
public: Point getTranslation() const {return Point(_tx, _ty);};
public: const Orientation& GetOrientation() const {return _orientation;};
public: const Orientation& getOrientation() const {return _orientation;};
public: Unit getX(const Unit& x, const Unit& y) const;
public: Unit getY(const Unit& x, const Unit& y) const;

View File

@ -0,0 +1,43 @@
INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH} ${HURRICANE_SOURCE_DIR}/src/hurricane)
SET(sources ProxyProperty.cpp PyBox.cpp PyCell.cpp PyCellLocator.cpp
PyComponent.cpp PyComponentLocator.cpp PyContact.cpp
PyDataBase.cpp PyEntity.cpp PyHorizontal.cpp
PyHurricane.cpp PyHyperNet.cpp PyInstance.cpp PyInstanceLocator.cpp
PyLayer.cpp PyLibrary.cpp PyName.cpp PyNet.cpp PyNetLocator.cpp
PyOccurrence.cpp PyOccurrenceLocator.cpp PyPath.cpp PyPin.cpp PyPinLocator.cpp
PyPlug.cpp PyPlugLocator.cpp PyPoint.cpp PyReference.cpp PyReferenceLocator.cpp
PySegment.cpp PySegmentLocator.cpp PyTechnology.cpp PyTransformation.cpp
PyUnit.cpp PyUpdateSession.cpp PyVertical.cpp
)
SET(includes ProxyProperty.h PyBox.h PyCell.h PyCellLocator.h
PyComponent.h PyComponentLocator.h PyContact.h
PyDataBase.h PyEntity.h PyHorizontal.h
PyHurricane.h PyHyperNet.h PyInstance.h PyInstanceLocator.h
PyLayer.h PyLibrary.h PyName.h PyNet.h PyNetLocator.h
PyOccurrence.h PyOccurrenceLocator.h PyPath.h PyPin.h PyPinLocator.h
PyPlug.h PyPlugLocator.h PyPoint.h PyReference.h PyReferenceLocator.h
PySegment.h PySegmentLocator.h PyTechnology.h PyTransformation.h
PyUnit.h PyUpdateSession.h PyVertical.h
)
ADD_LIBRARY(isobar SHARED ${sources})
TARGET_LINK_LIBRARIES(isobar hurricane)
SET(source_dir ${HURRICANE_SOURCE_DIR}/src/pyext)
SET(binary_dir ${HURRICANE_BINARY_DIR}/src/pyext)
SET(include_dirs ${HURRICANE_SOURCE_DIR}/src/hurricane)
SET(library_dirs ${HURRICANE_BINARY_DIR}/src/hurricane:${binary_dir})
CONFIGURE_FILE(PyExtensionBuild.conf.in ${binary_dir}/PyExtensionBuild.conf)
ADD_CUSTOM_COMMAND(TARGET isobar POST_BUILD
COMMAND cp ${source_dir}/setup.py ${binary_dir}/setup.py
COMMAND ${PYTHON_EXECUTABLE} ${binary_dir}/setup.py build
--build-base=${binary_dir}
DEPENDS ${binary_dir}/PyExtensionBuild.conf)
INSTALL(TARGETS isobar DESTINATION /lib)

View File

@ -0,0 +1,150 @@
all-local: python_EXTENSION
lib_LTLIBRARIES = libIsobar.la
libIsobar_la_SOURCES = ProxyProperty.cpp \
PyHurricane.cpp \
PyUpdateSession.cpp \
PyDataBase.cpp \
PyCDataBase.cpp \
PyTechnology.cpp \
PyLibrary.cpp \
PyLayer.cpp \
PyUnit.cpp \
PyPoint.cpp \
PyBox.cpp \
PyTransformation.cpp \
PyName.cpp \
PyPath.cpp \
PyOccurrence.cpp \
PyHook.cpp \
PyOccurrenceLocator.cpp \
PyEntity.cpp \
PyCell.cpp \
PyCellLocator.cpp \
PyInstance.cpp \
PyInstanceLocator.cpp \
PyNet.cpp \
PyNetLocator.cpp \
PyReference.cpp \
PyReferenceLocator.cpp \
PyComponent.cpp \
PyComponentLocator.cpp \
PyContact.cpp \
PyPin.cpp \
PyPinLocator.cpp \
PyPlug.cpp \
PyPlugLocator.cpp \
PySegment.cpp \
PySegmentLocator.cpp \
PyHorizontal.cpp \
PyVertical.cpp \
PyWidget.cpp \
PyCEditor.cpp \
PyCProps.cpp \
PyCToolBox.cpp \
PyCIOC.cpp \
PyCEngine.cpp \
PyHyperNet.cpp \
PyHierarchy.cpp \
PyCLiberty.cpp
libIsobar_la_LDFLAGS = -version-info @ISOBAR_DLL_VERSION@
bin_SCRIPTS = hurricaneconsole.py
pythonincludedir = $(includedir)/coriolis/isobar
python_EXTENSION_lib = Hurricane.so
# Headers are installed by "distutils".
noinst_HEADERS = ProxyProperty.h \
PyHurricane.h \
PyUnit.h \
PyPoint.h \
PyHook.h \
PyBox.h \
PyTransformation.h \
PyInstanceLocator.h \
PyPlugLocator.h \
PyNetLocator.h \
PyName.h \
PyPath.h \
PyEntity.h \
PyOccurrence.h \
PyDataBase.h \
PyCDataBase.h \
PyTechnology.h \
PyLibrary.h \
PyLayer.h \
PyComponent.h \
PySegment.h \
PyHorizontal.h \
PyVertical.h \
PyContact.h \
PyPin.h \
PyNet.h \
PyPlug.h \
PyReference.h \
PyReferenceLocator.h \
PyCell.h \
PyCellLocator.h \
PyInstance.h \
PyCEditor.h \
PyWidget.h \
PyUpdateSession.h \
PyCProps.h \
PyCToolBox.h \
PyCIOC.h \
PyHierarchy.h \
PyCEngine.h \
PyPinLocator.h \
PySegmentLocator.h \
PyComponentLocator.h \
PyHyperNet.h \
PyOccurrenceLocator.h \
PyCLiberty.h
EXTRA_DIST = hurricaneconsole.py setup.py
CLEANFILES =
# ====================================================================
# NOTHING SHOULD CHANGES BELOW THIS POINT.
site_packages = $(shell python -c "from distutils import sysconfig; print sysconfig.get_python_lib(1,0,\"$(PYTHON_EXEC_PREFIX)\")")
python_EXTENSION: $(lib_LTLIBRARIES)
(test ! -e ./setup.py 2>/dev/null && ln -s $(srcdir)/setup.py ./setup.py) || echo
PYTHONPATH=$${PYTHONPATH}:$(site_packages); export PYTHONPATH; \
if [ "`uname`" = "SunOS" ]; then LDSHARED="$(CC) -Wl,-G"; export LDSHARED; fi; \
LDFLAGS="${LDFLAGS} @DEVEL_LIBS@"; export LDFLAGS; \
python setup.py build;
# LDFLAGS="`echo \"@DEVEL_LIBS@\" | sed 's+-L\([^ ]*\)+-L\1 -Wl,-R\1+g'`"; \
# if [ ! -z "@DEVEL_LIBS@" ]; then \
# LDFLAGS="`echo \"@DEVEL_LIBS@\" | sed 's+-L\([^ ]*\)+-L\1+g'`"; \
# export LDFLAGS; \
# fi; \
#
install-exec-hook:
PYTHONPATH=$${PYTHONPATH}:$(site_packages); export PYTHONPATH; \
if [ "`uname`" = "SunOS" ]; then LDSHARED="$(CC) -Wl,-G"; export LDSHARED; fi; \
python setup.py install --prefix $(DESTDIR)$(prefix) \
install_headers --install-dir $(DESTDIR)$(pythonincludedir)
clean-local:
PYTHONPATH=$${PYTHONPATH}:$(site_packages); export PYTHONPATH; \
python setup.py clean; \
rm -rf build
uninstall-local:
for header in $(python_EXTENSION_headers); do \
rm -f $(pythonincludedir)/$$header; \
done; \
rm -f "$(site_packages)/$(python_EXTENSION_lib)"

View File

@ -0,0 +1,246 @@
// -*- 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é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: ProxyProperty.cpp,v 1.13 2007/07/30 16:02:51 jpc Exp $
//
// x-----------------------------------------------------------------x
// | |
// | 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@asim.lip6.fr |
// | =============================================================== |
// | C++ Module : "./ProxyProperty.cpp" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#include <iostream>
#include <sstream>
#include "ProxyProperty.h"
#include "Error.h"
#include "Warning.h"
USING_NAMESPACE_HURRICANE
namespace Isobar {
namespace {
using namespace std;
// ---------------------------------------------------------------
// Miscellaneous.
// ---------------------------------------------------------------
// Local Variables.
const char* twiceSetOffset =
"FragmentProperty::SetOffest () :\n\n"
" Attempt to sets the _shadow member offset twice.\n";
}
// x-----------------------------------------------------------------x
// | "::ProxyProperty" Global Variables |
// x-----------------------------------------------------------------x
Name ProxyProperty::_name = "::ProxyProperty";
int ProxyProperty::_offset = -1;
// x-----------------------------------------------------------------x
// | "::ProxyProperty" Class Definitions |
// x-----------------------------------------------------------------x
// -------------------------------------------------------------------
// Constructor : "ProxyProperty::ProxyProperty ()".
ProxyProperty::ProxyProperty ( void* shadow )
: Property()
, _owner(NULL)
, _shadow(shadow)
{ }
// -------------------------------------------------------------------
// Constructor : "ProxyProperty::Create ()".
ProxyProperty* ProxyProperty::Create ( void* shadow )
{
ProxyProperty* property = new ProxyProperty ( shadow );
if ( property == NULL )
throw Error ( "ProxyProperty::Create()" );
return ( property );
}
// -------------------------------------------------------------------
// Destructor : "ProxyProperty::_PreDelete ()".
void ProxyProperty::_PreDelete ()
{
if ( _owner ) _owner->_OnDeleted ( this );
trace << "ProxyProperty::_owner := " << hex << (void*)_owner << endl;
if ( _offset > 0 ) {
void** shadowMember = ( (void**)( (unsigned long)_shadow + _offset ) );
trace << "ProxyProperty::_shadowMember := " << hex << *shadowMember << endl;
*shadowMember = NULL;
}
}
// -------------------------------------------------------------------
// Method : "ProxyProperty::OnCapturedBy ()".
void ProxyProperty::OnCapturedBy ( DBo* owner )
{
if ( ( _owner != NULL ) && ( _owner != owner ) )
throw Error ( GetString(this).c_str() );
_owner = owner;
}
// -------------------------------------------------------------------
// Method : "ProxyProperty::OnReleasedBy ()".
void ProxyProperty::OnReleasedBy ( DBo* owner )
{
if ( _owner == owner ) OnNotOwned ();
}
// -------------------------------------------------------------------
// Method : "ProxyProperty::OnNotOwned ()".
void ProxyProperty::OnNotOwned ()
{
Delete ();
}
// -------------------------------------------------------------------
// Method : "ProxyProperty::SetOffset ()".
void ProxyProperty::SetOffset ( int offset )
{
if ( _offset >= 0 ) throw Error ( twiceSetOffset );
_offset = offset;
}
// -------------------------------------------------------------------
// Method : "ProxyProperty::_GetString()".
string ProxyProperty::_GetString () const
{
ostringstream os;
os << "<" << _GetTypeName() << " ";
if ( _owner ) os << hex << (void*)_owner << " ";
else os << "[not owned] ";
os << _shadow << ">";
return ( os.str() );
}
// -------------------------------------------------------------------
// Method : "ProxyProperty::_GetRecord()".
Record* ProxyProperty::_GetRecord () const
{
Record* record = Property::_GetRecord ();
if ( record != NULL ) {
record->Add ( GetSlot ( "_owner" , _owner ) );
record->Add ( GetSlot ( "_shadow", _shadow ) );
}
return ( record );
}
} // End of Isobar namespace.

View File

@ -0,0 +1,139 @@
// -*- 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é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: ProxyProperty.h,v 1.9 2007/07/29 15:27:27 jpc Exp $
//
// x-----------------------------------------------------------------x
// | |
// | 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@asim.lip6.fr |
// | =============================================================== |
// | C++ Header : "./ProxyProperty.h" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
# ifndef __PROXYPROPERTY__
# define __PROXYPROPERTY__
# include "DBo.h"
# include "Property.h"
namespace Isobar {
using namespace Hurricane;
// -------------------------------------------------------------------
// Miscellaneous.
# define F_PY_OWNED ( 1 << 0 )
# define CHECK_OFFSET(PY_STRUCT) \
if ( ProxyProperty::GetOffset() < 0 ) \
ProxyProperty::SetOffset ( (unsigned long)(&(PY_STRUCT->ACCESS_OBJECT)) \
- (unsigned long)PY_STRUCT );
// -------------------------------------------------------------------
// Class : "::ProxyProperty"
class ProxyProperty : public Property {
// Shared Attributes.
protected: static Name _name;
protected: static int _offset;
// Attributes.
protected: DBo* _owner;
protected: void* _shadow;
// Constructors.
protected: ProxyProperty ( void* _shadow );
private: ProxyProperty ( const ProxyProperty& );
private: ProxyProperty& operator= ( const ProxyProperty& );
public: static ProxyProperty* Create ( void* _shadow=NULL );
// Accessors.
public: DBo* GetOwner () const { return ( _owner ); };
public: void* GetShadow () const { return ( _shadow ); };
public: void* GetShadowMember () const { return ( (void*)((unsigned long)_shadow+_offset) ); };
public: template<typename DBoType>
DBoType* GetAsType () { return ( dynamic_cast<DBoType*>(_owner) ); };
// Static methods.
public: static int GetOffset () { return ( _offset ); };
public: static void SetOffset ( int offset );
// Property Managment.
public: static const Name &GetPropertyName () { return ( _name ); }
public: virtual Name GetName () const { return (GetPropertyName()); }
public: virtual void OnCapturedBy ( DBo* owner );
public: virtual void OnReleasedBy ( DBo* owner );
public: virtual void OnNotOwned ();
protected: virtual void _PreDelete ();
// Hurricane Managment.
public: virtual string _GetString () const;
public: virtual Record* _GetRecord () const;
public: virtual string _GetTypeName () const { return _TName("ProxyProperty"); };
};
} // End of Isobar namespace.
SetNestedSlotAdapter(Isobar::ProxyProperty)
# endif

View File

@ -0,0 +1,513 @@
// -*- 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é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: PyBox.cpp,v 1.18 2006/09/22 11:27:30 tsunami Exp $
//
// x-----------------------------------------------------------------x
// | |
// | 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@asim.lip6.fr |
// | =============================================================== |
// | C++ Module : "./PyBox.cpp" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
# include "PyPoint.h"
# include "PyBox.h"
namespace Isobar {
USING_NAMESPACE_HURRICANE
extern "C" {
#define METHOD_HEAD(function) GENERIC_METHOD_HEAD(Box,box,function)
// x=================================================================x
// | "PyBox" Python Module Code Part |
// x=================================================================x
#if defined(__PYTHON_MODULE__)
// x-------------------------------------------------------------x
// | "PyBox" Attribute Methods |
// x-------------------------------------------------------------x
// Standart Accessors (Attributes).
DirectGetLongAttribute(PyBox_GetXMin ,getXMin ,PyBox,Box)
DirectGetLongAttribute(PyBox_GetYMin ,getYMin ,PyBox,Box)
DirectGetLongAttribute(PyBox_GetXMax ,getXMax ,PyBox,Box)
DirectGetLongAttribute(PyBox_GetYMax ,getYMax ,PyBox,Box)
DirectGetLongAttribute(PyBox_GetXCenter ,getXCenter ,PyBox,Box)
DirectGetLongAttribute(PyBox_GetYCenter ,getYCenter ,PyBox,Box)
DirectGetLongAttribute(PyBox_GetWidth ,getWidth ,PyBox,Box)
DirectGetLongAttribute(PyBox_GetHalfWidth ,getHalfWidth ,PyBox,Box)
DirectGetLongAttribute(PyBox_GetHeight ,getHeight ,PyBox,Box)
DirectGetLongAttribute(PyBox_GetHalfHeight,getHalfHeight,PyBox,Box)
// Standart Predicates (Attributes).
DirectGetBoolAttribute(PyBox_IsEmpty ,isEmpty ,PyBox,Box)
DirectGetBoolAttribute(PyBox_IsFlat ,isFlat ,PyBox,Box)
DirectGetBoolAttribute(PyBox_IsPonctual,isPonctual,PyBox,Box)
// Standart Delete (Attribute).
DirectDeleteAttribute(PyBox_Delete,PyBox)
// ---------------------------------------------------------------
// Attribute Method : "PyBox_GetCenter ()"
static PyObject* PyBox_GetCenter ( PyBox *self )
{
trace << "PyBox_GetCenter()" << endl;
METHOD_HEAD ( "Box.Center()" )
PyPoint* pyPoint = PyObject_NEW ( PyPoint, &PyTypePoint );
if (pyPoint == NULL) { return NULL; }
HTRY
pyPoint->_object = new Point ( box->getCenter() );
HCATCH
return ( (PyObject*)pyPoint );
}
// ---------------------------------------------------------------
// Attribute Method : "PyBox_GetUnion ()"
static PyObject* PyBox_GetUnion ( PyBox *self, PyObject* args )
{
trace << "PyBox_GetUnion()" << endl;
METHOD_HEAD ( "Box.GetUnion()" )
PyBox* otherPyBox;
if ( ! ParseOneArg( "Box.GetUnion", args, BOX_ARG, (PyObject**)&otherPyBox ) ) return ( NULL );
PyBox* unionPyBox = PyObject_NEW ( PyBox, &PyTypeBox );
if (unionPyBox == NULL) { return NULL; }
HTRY
unionPyBox->_object = new Box ( box->getUnion(*(otherPyBox->_object)) );
HCATCH
return ( (PyObject*)unionPyBox );
}
// ---------------------------------------------------------------
// Attribute Method : "PyBox_GetIntersection ()"
static PyObject* PyBox_GetIntersection ( PyBox *self, PyObject* args )
{
trace << "PyBox_GetIntersection()" << endl;
METHOD_HEAD ( "Box.GetIntersection()" )
PyBox* otherPyBox;
if ( ! ParseOneArg ( "Box.GetIntersection", args, BOX_ARG, (PyObject**)&otherPyBox ) ) return ( NULL );
PyBox* intersectionPyBox = PyObject_NEW ( PyBox, &PyTypeBox );
if (intersectionPyBox == NULL) { return NULL; }
HTRY
intersectionPyBox->_object = new Box ( box->getIntersection(*(otherPyBox->_object)) );
HCATCH
return ( (PyObject*)intersectionPyBox );
}
// ---------------------------------------------------------------
// Attribute Method : "PyBox_Contains ()"
static PyObject* PyBox_Contains ( PyBox *self, PyObject* args )
{
trace << "PyBox_Contains ()" << endl;
METHOD_HEAD ( "Box.Contains()" )
PyObject* arg0;
PyObject* arg1;
long result = 0;
HTRY
__cs.Init ("Box.Contains");
if ( ! PyArg_ParseTuple(args,"|O&O&:Box.Contains",Converter,&arg0,Converter,&arg1) )
return ( NULL );
if ( __cs.GetObjectIds() == BOX_ARG ) { result = box->contains ( *PYBOX_O(arg0) ); }
else if ( __cs.GetObjectIds() == POINT_ARG ) { result = box->contains ( *PYPOINT_O(arg0) ); }
else if ( __cs.GetObjectIds() == INTS2_ARG ) { result = box->contains ( PyInt_AsLong(arg0)
, PyInt_AsLong(arg1) ); }
else {
PyErr_SetString ( ConstructorError, "invalid number of parameters for Box.Contains constructor." );
return ( NULL );
}
HCATCH
return ( Py_BuildValue("i",result) );
}
// ---------------------------------------------------------------
// Attribute Method : "PyBox_Intersect ()"
static PyObject* PyBox_Intersect ( PyBox *self, PyObject* args )
{
trace << "PyBox_Intersect ()" << endl;
METHOD_HEAD ( "Box.Intersect()" )
PyBox* otherPyBox;
HTRY
if ( ! ParseOneArg ( "Box.Intersect", args, BOX_ARG, (PyObject**)&otherPyBox ) ) return ( NULL );
HCATCH
return ( Py_BuildValue("i",(long)box->intersect(*PYBOX_O(otherPyBox))) );
}
// ---------------------------------------------------------------
// Attribute Method : "PyBox_IsConstrainedBy ()"
static PyObject* PyBox_IsConstrainedBy ( PyBox *self, PyObject* args )
{
trace << "PyBox_IsConstrainedBy ()" << endl;
METHOD_HEAD ( "Box.IsConstrainedBy()" )
PyBox* otherPyBox;
HTRY
if ( ! ParseOneArg ( "Box.GetIsConstrainedBy", args, BOX_ARG, (PyObject**)&otherPyBox ) ) return ( NULL );
HCATCH
return ( Py_BuildValue("i",(long)box->isConstrainedBy(*PYBOX_O(otherPyBox))) );
}
// ---------------------------------------------------------------
// Attribute Method : "PyBox_MakeEmpty ()"
static PyObject* PyBox_MakeEmpty ( PyBox *self, PyObject* args )
{
trace << "PyBox_MakeEmpty ()" << endl;
HTRY
METHOD_HEAD ( "Box.MakeEmpty()" )
if ( ! PyArg_ParseTuple ( args,":Box" ) ) return ( NULL );
box->makeEmpty ();
HCATCH
Py_INCREF ( self );
return ( (PyObject*)self );
}
// ---------------------------------------------------------------
// Attribute Method : "PyBox_Inflate ()"
static PyObject* PyBox_Inflate ( PyBox *self, PyObject* args )
{
trace << "PyBox_Inflate ()" << endl;
METHOD_HEAD ( "Box.Inflate()" )
PyObject* arg0;
PyObject* arg1;
PyObject* arg2 = NULL;
PyObject* arg3 = NULL;
HTRY
__cs.Init ("Box.Inflate");
if ( ! PyArg_ParseTuple(args,"|O&O&O&O&:Box.Inflate",Converter,&arg0,Converter,&arg1) )
return ( NULL );
if ( __cs.GetObjectIds() == INT_ARG ) { box->inflate ( PyInt_AsLong(arg0) ); }
else if ( __cs.GetObjectIds() == INTS2_ARG ) { box->inflate ( PyInt_AsLong(arg0)
, PyInt_AsLong(arg1) ); }
else if ( __cs.GetObjectIds() == INTS4_ARG ) { box->inflate ( PyInt_AsLong(arg0)
, PyInt_AsLong(arg1)
, PyInt_AsLong(arg2)
, PyInt_AsLong(arg3) ); }
else {
PyErr_SetString ( ConstructorError, "invalid number of parameters for Box.Inflate()" );
return ( NULL );
}
HCATCH
Py_INCREF ( self );
return ( (PyObject*)self );
}
// ---------------------------------------------------------------
// Attribute Method : "PyBox_Merge ()"
static PyObject* PyBox_Merge ( PyBox *self, PyObject* args )
{
trace << "Box_Merge()" << endl;
METHOD_HEAD ( "Box.Merge()" )
PyObject* arg0;
PyObject* arg1;
PyObject* arg2;
PyObject* arg3;
HTRY
__cs.Init ("Box.Merge");
if ( ! PyArg_ParseTuple(args,"|O&O&O&O&:Box.Merge",Converter,&arg0,Converter,&arg1,Converter,&arg2,Converter,&arg3) )
return ( NULL );
if ( __cs.GetObjectIds() == POINT_ARG ) { box->merge ( *PYPOINT_O(arg0) ); }
else if ( __cs.GetObjectIds() == BOX_ARG ) { box->merge ( *PYBOX_O(arg0) ); }
else if ( __cs.GetObjectIds() == INTS2_ARG ) { box->merge ( PyInt_AsLong(arg0)
, PyInt_AsLong(arg1) ); }
else if ( __cs.GetObjectIds() == INTS4_ARG ) { box->merge ( PyInt_AsLong(arg0)
, PyInt_AsLong(arg1)
, PyInt_AsLong(arg2)
, PyInt_AsLong(arg3) ); }
else {
PyErr_SetString ( ConstructorError, "invalid number of parameters for Box.Merge()" );
return ( NULL );
}
HCATCH
Py_INCREF ( self );
return ( (PyObject*)self );
}
// ---------------------------------------------------------------
// Attribute Method : "PyBox_Translate ()"
static PyObject* PyBox_Translate ( PyBox *self, PyObject* args )
{
trace << "PyBox_Translate ()" << endl;
METHOD_HEAD ( "Box.Translate()" )
PyObject* arg0;
PyObject* arg1;
HTRY
if ( ! ParseTwoArg ( "Box.Translate", args, INTS2_ARG, &arg0, &arg1 ) ) return ( NULL );
box->translate ( PyInt_AsLong(arg0), PyInt_AsLong(arg1) );
HCATCH
Py_RETURN_NONE;
}
// ---------------------------------------------------------------
// PyBox Attribute Method table.
PyMethodDef PyBox_Methods[] =
{ { "GetXMin" , (PyCFunction)PyBox_GetXMin , METH_NOARGS , "Return the XMin value." }
, { "GetYMin" , (PyCFunction)PyBox_GetYMin , METH_NOARGS , "Return the YMin value." }
, { "GetXMax" , (PyCFunction)PyBox_GetXMax , METH_NOARGS , "Return the XMax value." }
, { "GetYMax" , (PyCFunction)PyBox_GetYMax , METH_NOARGS , "Return the YMax value." }
, { "GetXCenter" , (PyCFunction)PyBox_GetXCenter , METH_NOARGS , "Return the X box center value." }
, { "GetYCenter" , (PyCFunction)PyBox_GetYCenter , METH_NOARGS , "Return the Y box center value." }
, { "GetCenter" , (PyCFunction)PyBox_GetCenter , METH_NOARGS , "Return the box center Point." }
, { "GetWidth" , (PyCFunction)PyBox_GetWidth , METH_NOARGS , "Return the box width." }
, { "GetHalfWidth" , (PyCFunction)PyBox_GetHalfWidth , METH_NOARGS , "Return the box half width." }
, { "GetHeight" , (PyCFunction)PyBox_GetHeight , METH_NOARGS , "Return the box height." }
, { "GetHalfHeight" , (PyCFunction)PyBox_GetHalfHeight , METH_NOARGS , "Return the box half height." }
, { "GetUnion" , (PyCFunction)PyBox_GetUnion , METH_VARARGS, "Return the smallest enclosing box." }
, { "GetIntersection", (PyCFunction)PyBox_GetIntersection, METH_VARARGS, "Return the overlapping area." }
, { "IsEmpty" , (PyCFunction)PyBox_IsEmpty , METH_NOARGS , "Return true if the box is empty." }
, { "IsFlat" , (PyCFunction)PyBox_IsFlat , METH_NOARGS , "Return true if the box is flat." }
, { "IsPonctual" , (PyCFunction)PyBox_IsPonctual , METH_NOARGS , "Return true if the box reduced to a point." }
, { "Contains" , (PyCFunction)PyBox_Contains , METH_VARARGS, "Return true if the box contains the argument." }
, { "Intersect" , (PyCFunction)PyBox_Intersect , METH_VARARGS, "Return true if two boxes overlap." }
, { "IsConstrainedBy", (PyCFunction)PyBox_IsConstrainedBy, METH_VARARGS, "Return true if the argment box is included and share at least a side." }
, { "MakeEmpty" , (PyCFunction)PyBox_MakeEmpty , METH_NOARGS , "Transform the box in an empty one." }
, { "Inflate" , (PyCFunction)PyBox_Inflate , METH_VARARGS, "Expand the box to contains the arguments." }
, { "Merge" , (PyCFunction)PyBox_Merge , METH_VARARGS, "Expand or contract the box to contains the arguments." }
, { "Translate" , (PyCFunction)PyBox_Translate , METH_VARARGS, "Translate the box od dx ans dy." }
, { "Delete" , (PyCFunction)PyBox_Delete , METH_NOARGS
, "Delete associated hurricane object, the python object remains." }
, {NULL, NULL, 0, NULL} /* sentinel */
};
// ---------------------------------------------------------------
// Attribute Method : "PyBox_new ()"
PyObject* PyBox_new (PyTypeObject *type, PyObject *args, PyObject *kwds) {
trace << "PyBox_new()" << endl;
Box* box;
PyObject* arg0;
PyObject* arg1;
PyObject* arg2;
PyObject* arg3;
__cs.Init ("Box.new");
if ( ! PyArg_ParseTuple(args,"|O&O&O&O&:Box.new"
,Converter,&arg0
,Converter,&arg1
,Converter,&arg2
,Converter,&arg3
) ) return ( NULL );
if ( __cs.GetObjectIds() == NO_ARG ) { box = new Box (); }
else if ( __cs.GetObjectIds() == POINT_ARG ) { box = new Box ( *PYPOINT_O(arg0) ); }
else if ( __cs.GetObjectIds() == BOX_ARG ) { box = new Box ( *PYBOX_O(arg0) ); }
else if ( __cs.GetObjectIds() == POINTS2_ARG ) { box = new Box ( *PYPOINT_O(arg0)
, *PYPOINT_O(arg1) ); }
else if ( __cs.GetObjectIds() == INTS2_ARG ) { box = new Box ( PyInt_AsLong(arg0)
, PyInt_AsLong(arg1) ); }
else if ( __cs.GetObjectIds() == INTS4_ARG ) { box = new Box ( PyInt_AsLong(arg0)
, PyInt_AsLong(arg1)
, PyInt_AsLong(arg2)
, PyInt_AsLong(arg3) ); }
else {
PyErr_SetString ( ConstructorError, "invalid number of parameters for Box constructor." );
return ( NULL );
}
PyBox* pyBox = PyObject_NEW(PyBox, &PyTypeBox);
if (pyBox == NULL) return NULL;
trace_in ();
trace << "new PyBox [" << hex << pyBox << "]" << endl;
trace_out ();
HTRY
pyBox->_object = box;
//box->SetProxy ( (void**)&(pyBox->_object) );
HCATCH
return ( (PyObject*)pyBox );
}
// x-------------------------------------------------------------x
// | "PyBox" Object Methods |
// x-------------------------------------------------------------x
DirectDeleteMethod(PyBox_DeAlloc,PyBox)
PyTypeObjectLinkPyType(Box)
PyTypeObjectConstructor(Box)
#else // End of Python Module Code Part.
// x=================================================================x
// | "PyBox" Shared Library Code Part |
// x=================================================================x
// ---------------------------------------------------------------
// PyBox Object Definitions.
PyTypeRootObjectDefinitions(Box)
# endif // End of Shared Library Code Part.
} // End of extern "C".
} // End of Isobar namespace.

105
hurricane/src/pyext/PyBox.h Normal file
View File

@ -0,0 +1,105 @@
// -*- 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é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: PyBox.h,v 1.7 2006/05/03 14:00:01 jpc Exp $
//
// x-----------------------------------------------------------------x
// | |
// | 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@asim.lip6.fr |
// | =============================================================== |
// | C++ Header : "./PyBox.h" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
# ifndef __PYBOX__
# define __PYBOX__
# include "PyHurricane.h"
# include "Box.h"
namespace Isobar {
extern "C" {
// -------------------------------------------------------------------
// Python Object : "PyBox".
typedef struct {
PyObject_HEAD
Hurricane::Box* _object;
} PyBox;
// -------------------------------------------------------------------
// Functions & Types exported to "PyHurricane.cpp".
extern PyTypeObject PyTypeBox;
extern PyMethodDef PyBox_Methods[];
extern void PyBox_LinkPyType();
extern void PyBox_Constructor();
#define IsPyBox(v) ( (v)->ob_type == &PyTypeBox )
#define PYBOX(v) ( (PyBox*)(v) )
#define PYBOX_O(v) ( PYBOX(v)->_object )
} // End of extern "C".
} // End of Isobar namespace.
# endif

View File

@ -0,0 +1,718 @@
// -*- 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é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: PyCell.cpp,v 1.34 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 : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
// | =============================================================== |
// | C++ Module : "./PyCell.cpp" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#include "PyCell.h"
#include "PyBox.h"
#include "PyName.h"
#include "PyLibrary.h"
#include "PyInstance.h"
#include "PyOccurrence.h"
#include "ProxyProperty.h"
#include "PyNet.h"
#include "PyNetLocator.h"
#include "PyReferenceLocator.h"
#include "PyInstanceLocator.h"
#include "PyOccurrenceLocator.h"
namespace Isobar {
USING_NAMESPACE_HURRICANE
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(Cell,cell,function)
// x=================================================================x
// | "PyCell" Python Module Code Part |
// x=================================================================x
#if defined(__PYTHON_MODULE__)
// x-------------------------------------------------------------x
// | "PyCell" Attribute Methods |
// x-------------------------------------------------------------x
// Standart Accessors (Attributes).
// Standart Delete (Attribute).
DBoDeleteAttribute(PyCell_Delete,PyCell)
// ---------------------------------------------------------------
// Attribute Method : "PyCell_GetLibrary ()"
static PyObject* PyCell_GetLibrary ( PyCell *self ) {
trace << "PyCell_GetLibrary ()" << endl;
Library* library = NULL;
HTRY
METHOD_HEAD ( "Cell.GetLibrary()" )
library = cell->GetLibrary ();
HCATCH
return PyLibrary_Link ( library );
}
// ---------------------------------------------------------------
// Attribute Method : "PyCell_GetName ()"
static PyObject* PyCell_GetName(PyCell *self) {
trace << "PyCell_GetName ()" << endl;
METHOD_HEAD ( "Cell.GetName()" )
PyName* pyName = PyObject_NEW ( PyName, &PyTypeName );
if ( pyName == NULL ) { return NULL; }
HTRY
pyName->_object = new Name ( cell->GetName() );
HCATCH
return ( (PyObject*)pyName );
}
// ---------------------------------------------------------------
// Attribute Method : "PyCell_GetInstance ()"
static PyObject* PyCell_GetInstance ( PyCell *self, PyObject* args ) {
trace << "PyCell_GetInstance ()" << endl;
Instance* instance = NULL;
HTRY
METHOD_HEAD ( "Cell.GetInstance()" )
PyName* arg0;
if ( ! ParseOneArg ( "Cell.GetInstance", args, NAME_ARG, (PyObject**)&arg0 ) ) return ( NULL );
instance = cell->GetInstance ( *PYNAME_O(arg0) );
HCATCH
return PyInstance_Link ( instance );
}
// ---------------------------------------------------------------
// Attribute Method : "PyCell_GetInstancesLocator ()"
static PyObject* PyCell_GetInstancesLocator ( PyCell *self ) {
trace << "PyCell_GetInstancesLocator ()" << endl;
METHOD_HEAD ( "Cell.GetInstancesLocator()" )
Instances instances = cell->GetInstances ();
PyInstanceLocator* pyInstanceLocator = PyObject_NEW ( PyInstanceLocator, &PyTypeInstanceLocator );
if (pyInstanceLocator == NULL) { return NULL; }
HTRY
pyInstanceLocator->_object = instances.GetLocator ();
HCATCH
return ( (PyObject*)pyInstanceLocator );
}
// ---------------------------------------------------------------
// Attribute Method : "PyCell_GetInstancesUnderLocator ()"
static PyObject* PyCell_GetInstancesUnderLocator ( PyCell *self, PyObject* args ) {
PyInstanceLocator* pyInstanceLocator;
trace << "PyCell_GetInstancesUnderLocator ()" << endl;
METHOD_HEAD ( "Cell.GetInstancesUnderLocator()" )
PyBox* arg0;
if ( ! ParseOneArg ( "Cell.GetInstancesUnderLocator", args, BOX_ARG, (PyObject**)&arg0 ) ) return ( NULL );
Instances instances = cell->GetInstancesUnder ( *PYBOX_O(arg0) );
pyInstanceLocator = PyObject_NEW ( PyInstanceLocator, &PyTypeInstanceLocator );
if (pyInstanceLocator == NULL) { return NULL; }
HTRY
pyInstanceLocator->_object = instances.GetLocator ();
HCATCH
return ( (PyObject*)pyInstanceLocator );
}
// ---------------------------------------------------------------
// Attribute Method : "PyCell_GetSlaveInstancesLocator ()"
static PyObject* PyCell_GetSlaveInstancesLocator ( PyCell *self ) {
trace << "PyCell_GetSlaveInstancesLocator ()" << endl;
METHOD_HEAD ( "Cell.GetSlaveInstancesLocator()" )
Instances instances = cell->GetSlaveInstances ();
PyInstanceLocator* pyInstanceLocator = PyObject_NEW ( PyInstanceLocator, &PyTypeInstanceLocator );
if (pyInstanceLocator == NULL) { return NULL; }
HTRY
pyInstanceLocator->_object = instances.GetLocator ();
HCATCH
return ( (PyObject*)pyInstanceLocator );
}
// ---------------------------------------------------------------
// Attribute Method : "PyCell_GetOccurrencesLocator ()"
static PyObject* PyCell_GetOccurrencesLocator ( PyCell *self ) {
trace << "PyCell_GetOccurrencesLocator ()" << endl;
METHOD_HEAD ( "Cell.GetOccurrencesLocator()" )
Occurrences occurrences = cell->GetOccurrences ();
PyOccurrenceLocator* pyOccurrenceLocator = PyObject_NEW ( PyOccurrenceLocator, &PyTypeOccurrenceLocator );
if (pyOccurrenceLocator == NULL) { return NULL; }
HTRY
pyOccurrenceLocator->_object = occurrences.GetLocator ();
HCATCH
return ( (PyObject*)pyOccurrenceLocator );
}
// ---------------------------------------------------------------
// Attribute Method : "PyCell_GetOccurrencesUnderLocator ()"
static PyObject* PyCell_GetOccurrencesUnderLocator ( PyCell *self, PyObject* args ) {
trace << "PyCell_GetOccurrencesUnderLocator ()" << endl;
METHOD_HEAD ( "Cell.GetOccurrencesUnderLocator()" )
PyBox* arg0;
if ( ! ParseOneArg ( "Cell.GetInstancesUnderLocator", args, BOX_ARG, (PyObject**)&arg0 ) ) return ( NULL );
PyOccurrenceLocator* pyOccurrenceLocator = PyObject_NEW ( PyOccurrenceLocator, &PyTypeOccurrenceLocator );
if (pyOccurrenceLocator == NULL) { return NULL; }
HTRY
Occurrences occurrences = cell->GetOccurrencesUnder ( *PYBOX_O(arg0) );
pyOccurrenceLocator->_object = occurrences.GetLocator ();
HCATCH
return ( (PyObject*)pyOccurrenceLocator );
}
// ---------------------------------------------------------------
// Attribute Method : "PyCell_GetLeafInstanceOccurrencesLocator ()"
static PyObject* PyCell_GetLeafInstanceOccurrencesLocator ( PyCell *self ) {
trace << "PyCell_GetLeafInstanceOccurrencesLocator ()" << endl;
METHOD_HEAD ( "Cell.GetLeafInstanceOccurrencesLocator()" )
Occurrences occurrences = cell->GetLeafInstanceOccurrences ();
PyOccurrenceLocator* pyOccurrenceLocator = PyObject_NEW ( PyOccurrenceLocator, &PyTypeOccurrenceLocator );
if (pyOccurrenceLocator == NULL) { return NULL; }
HTRY
pyOccurrenceLocator->_object = occurrences.GetLocator ();
HCATCH
return ( (PyObject*)pyOccurrenceLocator );
}
// ---------------------------------------------------------------
// Attribute Method : "PyCell_GetLeafInstanceOccurrencesUnderLocator ()"
static PyObject* PyCell_GetLeafInstanceOccurrencesUnderLocator ( PyCell *self, PyObject* args ) {
trace << "PyCell_GetLeafInstanceOccurrencesUnderLocator ()" << endl;
METHOD_HEAD ( "Cell.GetLeafInstanceOccurrencesUnderLocator()" )
PyBox* arg0;
if ( ! ParseOneArg ( "Cell.GetLeafInstanceOccurencesUnderLocator", args, BOX_ARG, (PyObject**)&arg0 ) ) return ( NULL );
PyOccurrenceLocator* pyOccurrenceLocator = PyObject_NEW ( PyOccurrenceLocator, &PyTypeOccurrenceLocator );
if (pyOccurrenceLocator == NULL) { return NULL; }
HTRY
Occurrences occurrences = cell->GetLeafInstanceOccurrencesUnder ( *PYBOX_O(arg0) );
//pyOccurrenceLocator->_object = new locator ( instances.GetLocator () );
pyOccurrenceLocator->_object = occurrences.GetLocator ();
HCATCH
return ( (PyObject*)pyOccurrenceLocator );
}
// ---------------------------------------------------------------
// Attribute Method : "PyCell_GetReferencesLocator ()"
static PyObject* PyCell_GetReferencesLocator ( PyCell *self ) {
trace << "PyCell_GetReferencesLocator ()" << endl;
METHOD_HEAD ( "Cell.GetReferencesLocator()" )
References references = cell->GetReferences ();
PyReferenceLocator* pyReferenceLocator = PyObject_NEW ( PyReferenceLocator, &PyTypeReferenceLocator );
if (pyReferenceLocator == NULL) { return NULL; }
HTRY
pyReferenceLocator->_object = references.GetLocator ();
HCATCH
return ( (PyObject*)pyReferenceLocator );
}
// ---------------------------------------------------------------
// Attribute Method : "PyCell_GetHyperNetsLocator ()"
static PyObject* PyCell_GetHyperNetsLocator ( PyCell *self ) {
trace << "PyCell_GetHyperNetsLocator ()" << endl;
METHOD_HEAD ( "Cell.GetHyperNetsLocator()" )
Occurrences occurrences = cell->GetHyperNetRootNetOccurrences();
PyOccurrenceLocator* pyOccurrenceLocator = PyObject_NEW ( PyOccurrenceLocator, &PyTypeOccurrenceLocator );
if (pyOccurrenceLocator == NULL) { return NULL; }
HTRY
pyOccurrenceLocator->_object = occurrences.GetLocator ();
HCATCH
return ( (PyObject*)pyOccurrenceLocator );
}
// ---------------------------------------------------------------
// Attribute Method : "PyCell_GetNet ()"
static PyObject* PyCell_GetNet ( PyCell *self, PyObject* args ) {
trace << "PyCell_GetNet ()" << endl;
Net* net = NULL;
HTRY
METHOD_HEAD ( "Cell.GetNet()" )
PyName* arg0;
if ( ! ParseOneArg ( "Cell.GetNet", args, NAME_ARG, (PyObject**)&arg0 ) ) return ( NULL );
net = cell->GetNet ( *PYNAME_O(arg0) );
HCATCH
return PyNet_Link ( net );
}
// ---------------------------------------------------------------
// Attribute Method : "PyCell_GetNetsLocator ()"
static PyObject* PyCell_GetNetsLocator ( PyCell *self ) {
trace << "PyCell_GetNetsLocator ()" << endl;
METHOD_HEAD ( "Cell.GetNetsLocator()" )
PyNetLocator* pyNetLocator = NULL;
HTRY
Nets nets = cell->GetNets ();
pyNetLocator = PyObject_NEW ( PyNetLocator, &PyTypeNetLocator );
if (pyNetLocator == NULL) { return NULL; }
pyNetLocator->_object = nets.GetLocator ();
HCATCH
return ( (PyObject*)pyNetLocator );
}
// ---------------------------------------------------------------
// Attribute Method : "PyCell_GetExternalNetsLocator ()"
static PyObject* PyCell_GetExternalNetsLocator ( PyCell *self ) {
trace << "PyCell_GetExternalNetsLocator ()" << endl;
METHOD_HEAD ( "Cell.GetExternalNetsLocator()" )
PyNetLocator* pyNetLocator = NULL;
HTRY
Nets nets = cell->GetExternalNets ();
pyNetLocator = PyObject_NEW ( PyNetLocator, &PyTypeNetLocator );
if (pyNetLocator == NULL) { return NULL; }
pyNetLocator->_object = nets.GetLocator ();
HCATCH
return ( (PyObject*)pyNetLocator );
}
// ---------------------------------------------------------------
// Attribute Method : "PyCell_GetClockNetsLocator ()"
static PyObject* PyCell_GetClockNetsLocator ( PyCell *self ) {
trace << "PyCell_GetClockNetsLocator ()" << endl;
METHOD_HEAD ( "Cell.GetClockNetsLocator()" )
PyNetLocator* pyNetLocator = NULL;
HTRY
Nets nets = cell->GetClockNets ();
pyNetLocator = PyObject_NEW ( PyNetLocator, &PyTypeNetLocator );
if (pyNetLocator == NULL) { return NULL; }
pyNetLocator->_object = nets.GetLocator ();
HCATCH
return ( (PyObject*)pyNetLocator );
}
// ---------------------------------------------------------------
// Attribute Method : "PyCell_GetSupplyNetsLocator ()"
static PyObject* PyCell_GetSupplyNetsLocator ( PyCell *self ) {
trace << "PyCell_GetSupplyNetsLocator ()" << endl;
METHOD_HEAD ( "Cell.GetSupplyNetsLocator()" )
PyNetLocator* pyNetLocator = NULL;
HTRY
Nets nets = cell->GetSupplyNets ();
pyNetLocator = PyObject_NEW ( PyNetLocator, &PyTypeNetLocator );
if (pyNetLocator == NULL) { return NULL; }
pyNetLocator->_object = nets.GetLocator ();
HCATCH
return ( (PyObject*)pyNetLocator );
}
// ---------------------------------------------------------------
// Attribute Method : "PyCell_GetPowerNetsLocator ()"
static PyObject* PyCell_GetPowerNetsLocator ( PyCell *self )
{
trace << "PyCell_GetPowerNetsLocator ()" << endl;
METHOD_HEAD ( "Cell.GetPowerNetsLocator()" )
PyNetLocator* pyNetLocator = NULL;
HTRY
Nets nets = cell->GetPowerNets ();
pyNetLocator = PyObject_NEW ( PyNetLocator, &PyTypeNetLocator );
if (pyNetLocator == NULL) { return NULL; }
pyNetLocator->_object = nets.GetLocator ();
HCATCH
return ( (PyObject*)pyNetLocator );
}
// ---------------------------------------------------------------
// Attribute Method : "PyCell_GetGroundNetsLocator ()"
static PyObject* PyCell_GetGroundNetsLocator ( PyCell *self ) {
trace << "PyCell_GetGroundNetsLocator ()" << endl;
METHOD_HEAD ( "Cell.GetGroundNetsLocator()" )
PyNetLocator* pyNetLocator = NULL;
HTRY
Nets nets = cell->GetGroundNets ();
pyNetLocator = PyObject_NEW ( PyNetLocator, &PyTypeNetLocator );
if (pyNetLocator == NULL) { return NULL; }
pyNetLocator->_object = nets.GetLocator ();
HCATCH
return ( (PyObject*)pyNetLocator );
}
// ---------------------------------------------------------------
// Attribute Method : "PyCell_GetAbutmentBox ()"
static PyObject* PyCell_GetAbutmentBox ( PyCell *self ) {
trace << "PyCell_GetAbutmentBox()" << endl;
METHOD_HEAD ( "Cell.GetAbutmentBox()" )
PyBox* abutmentBox = PyObject_NEW ( PyBox, &PyTypeBox );
if (abutmentBox == NULL) { return NULL; }
HTRY
abutmentBox->_object = new Box ( cell->GetAbutmentBox() );
HCATCH
return ( (PyObject*)abutmentBox );
}
// ---------------------------------------------------------------
// Attribute Method : "PyCell_SetName ()"
static PyObject* PyCell_SetName ( PyCell *self, PyObject* args )
{
trace << "Cell.SetName()" << endl;
HTRY
METHOD_HEAD ( "Cell.SetName()" )
PyName* name;
if ( ! ParseOneArg ( "Cell.SetName", args, NAME_ARG, (PyObject**)&name ) ) return ( NULL );
cell->SetName ( *PYNAME_O(name) );
HCATCH
Py_RETURN_NONE;
}
// ---------------------------------------------------------------
// Attribute Method : "PyCell_SetAbutmentBox ()"
static PyObject* PyCell_SetAbutmentBox ( PyCell *self, PyObject* args ) {
trace << "Cell.SetAbutmentBox()" << endl;
HTRY
METHOD_HEAD ( "Cell.SetAbutmentBox()" )
PyBox* abutmentBox;
if ( ! ParseOneArg ( "Cell.SetAbutmentBox", args, BOX_ARG, (PyObject**)&abutmentBox ) ) return ( NULL );
cell->SetAbutmentBox ( *PYBOX_O(abutmentBox) );
HCATCH
Py_RETURN_NONE;
}
// ---------------------------------------------------------------
// Attribute Method : "PyCell_SetTerminal ()"
static PyObject* PyCell_SetTerminal ( PyCell *self, PyObject* args ) {
trace << "PyCell_SetTerminal ()" << endl;
HTRY
METHOD_HEAD ( "Cell.SetTerminal()" )
PyObject* arg0;
if ( ! ParseOneArg ( "Cell.SetTerminal", args, INT_ARG, (PyObject**)&arg0 ) ) return ( NULL );
cell->SetTerminal ( PyInt_AsLong(arg0) != 0 );
HCATCH
Py_RETURN_NONE;
}
// Standart Predicates (Attributes).
DirectGetBoolAttribute(PyCell_IsTerminal, IsTerminal ,PyCell,Cell)
DirectGetBoolAttribute(PyCell_IsLeaf, IsLeaf ,PyCell,Cell)
GetBoundStateAttribute(PyCell_IsPyBound ,PyCell,Cell)
// ---------------------------------------------------------------
// PyCell Attribute Method table.
PyMethodDef PyCell_Methods[] =
{ { "GetLibrary" , (PyCFunction)PyCell_GetLibrary , METH_NOARGS , "Returns the library owning the cell." }
, { "GetName" , (PyCFunction)PyCell_GetName , METH_NOARGS , "Returns the name of the cell." }
, { "GetInstance" , (PyCFunction)PyCell_GetInstance , METH_VARARGS, "Returns the instance of name <name> if it exists, else NULL." }
, { "GetInstancesLocator" , (PyCFunction)PyCell_GetInstancesLocator , METH_NOARGS , "Returns the locator of the collection of all instances called by the cell." } // GetInstances
, { "GetInstancesUnderLocator" , (PyCFunction)PyCell_GetInstancesUnderLocator , METH_VARARGS, "Returns the locator of the collection of all instances of the cell intersecting the given rectangular area." } // GetInstancesUnder
, { "GetSlaveInstancesLocator" , (PyCFunction)PyCell_GetSlaveInstancesLocator , METH_NOARGS , "Returns the locator of the collection of instances whose master is this cell." } // GetSlaveInstances
, { "GetOccurrencesLocator" , (PyCFunction)PyCell_GetOccurrencesLocator , METH_VARARGS, "Returns the collection of all occurrences belonging to the cell." }
, { "GetOccurrencesUnderLocator", (PyCFunction)PyCell_GetOccurrencesUnderLocator, METH_NOARGS , "Returns the collection of all occurrences belonging to this cell and intersecting the given rectangular area." }
, { "GetLeafInstanceOccurrencesLocator", (PyCFunction)PyCell_GetLeafInstanceOccurrencesLocator, METH_VARARGS, "Returns the collection of all occurrences belonging to the cell." }
, { "GetLeafInstanceOccurrencesUnderLocator", (PyCFunction)PyCell_GetLeafInstanceOccurrencesUnderLocator, METH_NOARGS , "Returns the collection of all occurrences belonging to this cell and intersecting the given rectangular area." }
, { "GetReferencesLocator" , (PyCFunction)PyCell_GetReferencesLocator , METH_VARARGS, "Returns the collection of all references belonging to the cell." }
, { "GetHyperNetsLocator" , (PyCFunction)PyCell_GetHyperNetsLocator , METH_VARARGS, "Returns the collection of all hyperNets belonging to the cell." }
, { "GetNet" , (PyCFunction)PyCell_GetNet , METH_VARARGS, "Returns the net of name <name> if it exists, else NULL." }
, { "GetNetsLocator" , (PyCFunction)PyCell_GetNetsLocator , METH_NOARGS , "Returns the collection of all nets of the cell." }
//, { "GetGlobalNets" , (PyCFunction)PyCell_GetGlobalNets , METH_NOARGS , "Returns the collection of all global nets of the cell." }
, { "GetExternalNetsLocator", (PyCFunction)PyCell_GetExternalNetsLocator, METH_NOARGS , "Returns the collection of all external nets of the cell." }
//, { "GetInternalNets" , (PyCFunction)PyCell_GetInternalNets , METH_NOARGS , "Returns the collection of all internal nets of the cell." }
, { "GetClockNetsLocator" , (PyCFunction)PyCell_GetClockNetsLocator , METH_NOARGS , "Returns the collection of all clock nets of the cell." }
, { "GetSupplyNetsLocator", (PyCFunction)PyCell_GetSupplyNetsLocator, METH_NOARGS , "Returns the collection of all supply nets of the cell." }
, { "GetPowerNetsLocator" , (PyCFunction)PyCell_GetPowerNetsLocator , METH_NOARGS , "Returns the collection of all power nets of the cell." }
, { "GetGroundNetsLocator", (PyCFunction)PyCell_GetGroundNetsLocator, METH_NOARGS , "Returns the collection of all ground nets of the cell." }
//, { "GetComponents" , (PyCFunction)PyCell_GetComponents , METH_NOARGS , "Returns the collection of all components of the cell." }
//, { "GetComponentsUnder" , (PyCFunction)PyCell_GetComponentsUnder , METH_VARARGS, "Returns the collection of cell components which intersect the given rectangular area." }
, { "GetAbutmentBox" , (PyCFunction)PyCell_GetAbutmentBox , METH_NOARGS , "Returns the abutment box of the cell(which is defined by the designer unlike the bounding box which is managed dynamically)" }
//, { "GetSymbol" , (PyCFunction)PyCell_GetSymbol , METH_NOARGS , "Returns the symbol associated to the cell." }
//, { "IsCalledBy" , (PyCFunction)PyCell_IsCalledBy , METH_VARARGS, "Returns true if the cell <this> is directly or indirectly called by the cell <cell>." }
, { "IsTerminal" , (PyCFunction)PyCell_IsTerminal , METH_NOARGS , "Returns true if the cell is marked as terminal, else false." }
, { "IsLeaf" , (PyCFunction)PyCell_IsLeaf , METH_NOARGS , "Returns true if the cell is a leaf of the hierarchy, else false." }
, { "IsBound" , (PyCFunction)PyCell_IsPyBound , METH_NOARGS, "Returns true if the cell is bounded to the hurricane cell" }
, { "SetName" , (PyCFunction)PyCell_SetName , METH_VARARGS, "Allows to change the cell name." }
, { "SetAbutmentBox" , (PyCFunction)PyCell_SetAbutmentBox , METH_VARARGS, "Sets the cell abutment box." }
, { "SetTerminal" , (PyCFunction)PyCell_SetTerminal , METH_VARARGS, "Sets the cell terminal status." }
//, { "SetSymbol" , (PyCFunction)PyCell_SetSymbol , METH_VARARGS, "Associates the symbol <symbol> to the cell." }
//, { "Materialize" , (PyCFunction)PyCell_Materialize , METH_NOARGS , "Materializes all components of all the nets of the cell." }
//, { "Unmaterialize" , (PyCFunction)PyCell_Unmaterialize , METH_NOARGS , "De-materializes all components of all the nets of the cell." }
, { "Delete" , (PyCFunction)PyCell_Delete , METH_NOARGS
, "Delete associated hurricane object The python object remains." }
, {NULL, NULL, 0, NULL} /* sentinel */
};
// x-------------------------------------------------------------x
// | "PyCell" Object Methods |
// x-------------------------------------------------------------x
static PyObject* PyCell_new(PyTypeObject *type, PyObject *args, PyObject *kwds) {
trace << "PyCell_new()" << endl;
PyObject* arg0;
PyObject* arg1;
string lib_name_arg = ":library:name";
if (!ParseTwoArg("Cell.init", args, lib_name_arg, &arg0, &arg1)) {
cerr << "argument error" << endl;
PyErr_SetString ( ConstructorError, "invalid number of parameters for Cell constructor." );
return(NULL);
}
Cell* cell = NULL;
HTRY
cell = Cell::Create(PYLIBRARY_O(arg0), GetString(*PYNAME_O(arg1)));
HCATCH
return PyCell_Link(cell);
}
static void PyCell_DeAlloc ( PyCell *self ) {
trace << "PyDbObject_DeAlloc(" << hex << self << ") "
<< self->ACCESS_OBJECT << endl;
if ( self->ACCESS_OBJECT != NULL ) {
ProxyProperty* proxy = dynamic_cast<ProxyProperty*>
( self->ACCESS_OBJECT->GetProperty ( ProxyProperty::GetPropertyName() ) ); \
if (proxy == NULL) {
ostringstream message;
message << "deleting a Python object with no Proxy attached ";
cerr << "yes man" << endl;
PyErr_SetString ( ProxyError, message.str().c_str() );
}
self->ACCESS_OBJECT->Remove ( proxy );
} else {
cerr << "ACCESS_OBJECT is NULL" << endl;
}
PyObject_DEL ( self );
}
PyTypeObjectLinkPyType(Cell)
PyTypeObjectConstructor(Cell)
#else // End of Python Module Code Part.
// x=================================================================x
// | "PyCell" Shared Library Code Part |
// x=================================================================x
// Link/Creation Method.
DBoLinkCreateMethod(PyCell_Link,PyCell,PyTypeCell,Cell)
// ---------------------------------------------------------------
// PyCell Object Definitions.
PyTypeInheritedObjectDefinitions(Cell, Entity)
#endif // End of Shared Library Code Part.
} // End of extern "C".
} // End of Isobar namespace.

View File

@ -0,0 +1,108 @@
// -*- 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é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: PyCell.h,v 1.9 2006/05/03 14:00:01 jpc Exp $
//
// x-----------------------------------------------------------------x
// | |
// | 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@asim.lip6.fr |
// | =============================================================== |
// | C++ Header : "./PyCell.h" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#ifndef __PYCELL__
#define __PYCELL__
#include "PyEntity.h"
#include "Cell.h"
namespace Isobar {
USING_NAMESPACE_HURRICANE
extern "C" {
// -------------------------------------------------------------------
// Python Object : "PyCell".
typedef struct {
PyEntity _baseObject;
} PyCell;
// -------------------------------------------------------------------
// Functions & Types exported to "PyHurricane.ccp".
extern PyTypeObject PyTypeCell;
extern PyMethodDef PyCell_Methods[];
extern PyObject* PyCell_Link ( Hurricane::Cell* object );
extern void PyCell_LinkPyType ();
extern void PyCell_Constructor ();
#define IsPyCell(v) ((v)->ob_type == &PyTypeCell)
#define PYCELL(v) ((PyCell*)(v))
#define PYCELL_O(v) (static_cast<Cell*>(PYCELL(v)->_baseObject._object))
} // End of extern "C".
} // End of Isobar namespace.
# endif

View File

@ -0,0 +1,148 @@
// -*- 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é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
// ===================================================================
//
//
// 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 : "./PyCellLocator.cpp" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
# include "PyCellLocator.h"
# include "PyCell.h"
namespace Isobar {
USING_NAMESPACE_HURRICANE
extern "C" {
# define METHOD_HEAD(function) GENERIC_METHOD_HEAD(Locator<Cell*>,locator,function)
// x=================================================================x
// | "PyCellLocator" Python Module Code Part |
// x=================================================================x
# if defined(__PYTHON_MODULE__)
// x-------------------------------------------------------------x
// | "PyCellLocator" Attribute Methods |
// x-------------------------------------------------------------x
// Standart Accessors (Attributes).
// Standart Predicates (Attributes).
DirectGetBoolAttribute(PyCellLocator_IsValid,IsValid,PyCellLocator,Locator<Cell*>)
// Standart Locator Accessors (Attributes).
LocatorProgressAttribute(Cell)
LocatorGetElementAttribute(Cell)
LocatorGetCloneAttribute(Cell)
// Standart Delete (Attribute).
DirectDeleteAttribute(PyCellLocator_Delete,PyCellLocator)
// ---------------------------------------------------------------
// PyCellLocator Attribute Method table.
PyMethodDef PyCellLocator_Methods[] =
{ { "IsValid" , (PyCFunction)PyCellLocator_IsValid , METH_NOARGS , "Returns true while the walk has not exhausted the set of elements, else false." }
, { "Progress" , (PyCFunction)PyCellLocator_Progress , METH_NOARGS , "Moves forward the locator to the following element." }
, { "GetElement" , (PyCFunction)PyCellLocator_GetElement , METH_NOARGS , "Returns the current element (or the value Type() when the locator is not or no longer valid)." }
, { "GetClone" , (PyCFunction)PyCellLocator_GetClone , METH_NOARGS , "This function allocates and returns a new locator that will have the same visiting course than the remaining one of the locator being cloned." }
, { "Delete" , (PyCFunction)PyCellLocator_Delete , METH_NOARGS
, "Delete associated hurricane object, the python object remains." }
, {NULL, NULL, 0, NULL} /* sentinel */
};
// x-------------------------------------------------------------x
// | "PyCellLocator" Object Methods |
// x-------------------------------------------------------------x
DirectDeleteMethod(PyCellLocator_DeAlloc,PyCellLocator)
LocatorPyTypeObjectLinkPyType(Cell, Cell*)
# else // End of Python Module Code Part.
// x=================================================================x
// | "PyCellLocator" Shared Library Code Part |
// x=================================================================x
// ---------------------------------------------------------------
// PyCellLocator Object Definitions.
PyTypeRootObjectDefinitions(CellLocator)
# endif // End of Shared Library Code Part.
} // End of extern "C".
} // End of Isobar namespace.

View File

@ -0,0 +1,106 @@
// -*- 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é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
// ===================================================================
//
//
// 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++ Header : "./PyCellLocator.h" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#ifndef __PYCELLLOCATOR__
#define __PYCELLLOCATOR__
#include "PyHurricane.h"
#include "Locator.h"
#include "Cell.h"
namespace Isobar {
extern "C" {
// -------------------------------------------------------------------
// Python Object : "PyCellLocator".
typedef struct {
PyObject_HEAD
Hurricane::Locator<Hurricane::Cell*>* _object;
} PyCellLocator;
// -------------------------------------------------------------------
// Functions & Types exported to "PyHurricane.ccp".
extern PyTypeObject PyTypeCellLocator;
extern PyMethodDef PyCellLocator_Methods[];
extern void PyCellLocator_LinkPyType ();
#define IsPyCellLocator(v) ( (v)->ob_type == &PyTypeCellLocator )
#define PYCELLLOCATOR(v) ( (PyCellLocator*)(v) )
#define PYCELLLOCATOR_O(v) ( PYCELLLOCATOR(v)->_object )
} // End of extern "C".
} // End of Isobar namespace.
#endif

View File

@ -0,0 +1,221 @@
// -*- 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é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: PyComponent.cpp,v 1.17 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 : Jean-Paul Chaput |
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
// | =============================================================== |
// | C++ Module : "./PyComponent.cpp" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#include "PyNet.h"
#include "PyLayer.h"
#include "PyPoint.h"
#include "PyBox.h"
#include "PyComponent.h"
#include "PyPlug.h"
#include "PyHorizontal.h"
#include "PyVertical.h"
#include "PyContact.h"
#include "PyPin.h"
namespace Isobar {
USING_NAMESPACE_HURRICANE
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(Component,component,function)
// x=================================================================x
// | "PyComponent" Python Module Code Part |
// x=================================================================x
# if defined(__PYTHON_MODULE__)
// x-------------------------------------------------------------x
// | "PyComponent" Attribute Methods |
// x-------------------------------------------------------------x
// Standart Accessors (Attributes).
DirectGetLongAttribute(PyComponent_GetX,GetX,PyComponent,Component)
DirectGetLongAttribute(PyComponent_GetY,GetY,PyComponent,Component)
// Standart Delete (Attribute).
DBoDeleteAttribute(PyComponent_Delete,PyComponent)
// ---------------------------------------------------------------
// Attribute Method : "PyComponent_GetPosition ()"
static PyObject* PyComponent_GetPosition ( PyComponent *self )
{
trace << "PyComponent_GetPosition ()" << endl;
METHOD_HEAD ( "Component.GetPosition()" )
PyPoint* pyPoint = PyObject_NEW ( PyPoint, &PyTypePoint );
if (pyPoint == NULL) { return NULL; }
HTRY
pyPoint->_object = new Point ( component->GetPosition() );
HCATCH
return ( (PyObject*)pyPoint );
}
// ---------------------------------------------------------------
// Attribute Method : "PyComponent_GetNet ()"
static PyObject* PyComponent_GetNet ( PyComponent *self )
{
trace << "PyComponent_GetNet ()" << endl;
Net* net = NULL;
HTRY
METHOD_HEAD ( "Component.GetNet()" )
net = component->GetNet ( );
HCATCH
return PyNet_Link ( net );
}
// ---------------------------------------------------------------
// Attribute Method : "PyComponent_GetLayer ()"
static PyObject* PyComponent_GetLayer ( PyComponent *self )
{
trace << "PyComponent_GetLayer ()" << endl;
METHOD_HEAD ( "Component.GetLayer()" )
Layer* layer = NULL;
HTRY
layer = component->GetLayer ();
HCATCH
return PyLayer_Link ( layer );
}
// ---------------------------------------------------------------
// Attribute Method : "PyComponent_GetBoundingBox ()"
static PyObject* PyComponent_GetBoundingBox ( PyComponent *self )
{
trace << "PyComponent_GetBoundingBox ()" << endl;
METHOD_HEAD ( "Component.GetBoundingBox()" )
PyBox* pyBox = PyObject_NEW ( PyBox, &PyTypeBox );
if (pyBox == NULL) { return NULL; }
trace_out ();
HTRY
pyBox->_object = new Box ( component->GetBoundingBox() );
HCATCH
return ( (PyObject*)pyBox );
}
// ---------------------------------------------------------------
// PyComponent Attribute Method table.
PyMethodDef PyComponent_Methods[] =
{ { "GetX" , (PyCFunction)PyComponent_GetX , METH_NOARGS , "Return the Component X value." }
, { "GetY" , (PyCFunction)PyComponent_GetY , METH_NOARGS , "Return the Component Y value." }
, { "GetPosition" , (PyCFunction)PyComponent_GetPosition , METH_NOARGS , "Return the Component 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." }
, { "Delete" , (PyCFunction)PyComponent_Delete , METH_NOARGS
, "Delete associated hurricane object, the python object remains." }
, {NULL, NULL, 0, NULL} /* sentinel */
};
// x-------------------------------------------------------------x
// | "PyComponent" Object Methods |
// x-------------------------------------------------------------x
DBoDeleteMethod(Component)
PyTypeObjectLinkPyType(Component)
# else // End of Python Module Code Part.
// x=================================================================x
// | "PyComponent" Shared Library Code Part |
// x=================================================================x
// ---------------------------------------------------------------
// PyComponent Object Definitions.
PyTypeInheritedObjectDefinitions(Component, Entity)
# endif // End of Shared Library Code Part.
} // End of extern "C".
} // End of Isobar namespace.

View File

@ -0,0 +1,109 @@
// -*- 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é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: PyComponent.h,v 1.6 2006/05/03 14:00:02 jpc 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++ Header : "./PyComponent.h" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#ifndef __PYCOMPONENT__
#define __PYCOMPONENT__
#include "PyEntity.h"
#include "Component.h"
namespace Isobar {
extern "C" {
// -------------------------------------------------------------------
// Python Object : "PyComponent".
typedef struct {
PyEntity _baseObject;
} PyComponent;
// -------------------------------------------------------------------
// Functions & Types exported to "PyHurricane.ccp".
extern PyTypeObject PyTypeComponent;
extern PyMethodDef PyComponent_Methods[];
extern void PyComponent_LinkPyType ();
#define IsPyComponent(v) ((v)->ob_type == &PyTypeComponent)
#define PYCOMPONENT(v) ((PyComponent*)(v))
#define PYCOMPONENT_O(v) (static_cast<Component*>(PYCOMPONENT(v)->_baseObject._object))
} // End of extern "C".
inline Hurricane::Component* ComponentCast ( PyObject* derivedObject )
{ return dynamic_cast<Hurricane::Component*>(EntityCast(derivedObject)); };
} // End of Isobar namespace.
#endif

View File

@ -0,0 +1,140 @@
// -*- 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é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
// ===================================================================
//
// x-----------------------------------------------------------------x
// | |
// | C O R I O L I S |
// | I s o b a r - Hurricane / Python Interface |
// | |
// | Author : Sophie BELLOEIL |
// | E-mail : Damien.Dupuis@lip6.fr |
// | =============================================================== |
// | C++ Module : "./PyNetLocator.cpp" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
# include "PyComponentLocator.h"
# include "PyComponent.h"
namespace Isobar {
USING_NAMESPACE_HURRICANE
extern "C" {
# define METHOD_HEAD(function) GENERIC_METHOD_HEAD(Locator<Component*>,locator,function)
// x=================================================================x
// | "PyComponentLocator" Python Module Code Part |
// x=================================================================x
# if defined(__PYTHON_MODULE__)
// x-------------------------------------------------------------x
// | "PyComponentLocator" Attribute Methods |
// x-------------------------------------------------------------x
// Standart Accessors (Attributes).
// Standart Predicates (Attributes).
DirectGetBoolAttribute(PyComponentLocator_IsValid,IsValid,PyComponentLocator,Locator<Component*>)
// Standart Locator Accessors (Attributes).
LocatorProgressAttribute(Component)
LocatorGetElementEntityAttribute(Component)
LocatorGetCloneAttribute(Component)
// Standart Delete (Attribute).
DirectDeleteAttribute(PyComponentLocator_Delete,PyComponentLocator)
// ---------------------------------------------------------------
// PyComponent Attribute Method table.
PyMethodDef PyComponentLocator_Methods[] =
{ { "IsValid" , (PyCFunction)PyComponentLocator_IsValid , METH_NOARGS , "Returns true while the walk has not exhausted the set of elements, else false." }
, { "Progress" , (PyCFunction)PyComponentLocator_Progress , METH_NOARGS , "Moves forward the locator to the following element." }
, { "GetElement" , (PyCFunction)PyComponentLocator_GetElement , METH_NOARGS , "Returns the current element (or the value Type() when the locator is not or no longer valid)." }
, { "GetClone" , (PyCFunction)PyComponentLocator_GetClone , METH_NOARGS , "This function allocates and returns a new locator that will have the same visiting course than the remaining one of the locator being cloned." }
, { "Delete" , (PyCFunction)PyComponentLocator_Delete , METH_NOARGS
, "Delete associated hurricane object, the python object remains." }
, {NULL, NULL, 0, NULL} /* sentinel */
};
// x-------------------------------------------------------------x
// | "PyComponentLocator" Object Methods |
// x-------------------------------------------------------------x
DirectDeleteMethod(PyComponentLocator_DeAlloc,PyComponentLocator)
LocatorPyTypeObjectLinkPyType(Component, Component*)
# else // End of Python Module Code Part.
// x=================================================================x
// | "PyComponentLocator" Shared Library Code Part |
// x=================================================================x
// ---------------------------------------------------------------
// PyComponentLocator Object Definitions.
PyTypeRootObjectDefinitions(ComponentLocator)
# endif // End of Shared Library Code Part.
} // End of extern "C".
} // End of Isobar namespace.

View File

@ -0,0 +1,98 @@
// -*- 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é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
// ===================================================================
//
// 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 |
// | =============================================================== |
// | C++ Header : "./PyComponentLocator.h" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#ifndef __PYCOMPONENTLOCATOR__
#define __PYCOMPONENTLOCATOR__
#include "PyHurricane.h"
#include "Component.h"
namespace Isobar {
extern "C" {
// -------------------------------------------------------------------
// Python Object : "PyComponentLocator".
typedef struct {
PyObject_HEAD
Hurricane::Locator<Hurricane::Component*>* _object;
} PyComponentLocator;
// -------------------------------------------------------------------
// Functions & Types exported to "PyHurricane.ccp".
extern PyTypeObject PyTypeComponentLocator;
extern PyMethodDef PyComponentLocator_Methods[];
extern void PyComponentLocator_LinkPyType ();
#define IsPyComponentLocator(v) ( (v)->ob_type == &PyTypeComponentLocator )
#define PYCOMPONENTLOCATOR(v) ( (PyComponentLocator*)(v) )
#define PYCOMPONENTLOCATOR_O(v) ( PYCOMPONENTLOCATOR(v)->_object )
} // End of extern "C".
} // End of Isobar namespace.
# endif

View File

@ -0,0 +1,242 @@
// -*- 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é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: PyContact.cpp,v 1.21 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 : Jean-Paul Chaput |
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
// | =============================================================== |
// | C++ Module : "./PyContact.cpp" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#include "PyNet.h"
#include "PyLayer.h"
#include "PyContact.h"
#include "PyHorizontal.h"
#include "PyVertical.h"
namespace Isobar {
USING_NAMESPACE_HURRICANE
extern "C" {
#undef ACCESS_OBJECT
#undef ACCESS_CLASS
#define ACCESS_OBJECT _baseObject._baseObject._object
#define ACCESS_CLASS(_pyObject) &(_pyObject->_baseObject._baseObject)
#define METHOD_HEAD(function) GENERIC_METHOD_HEAD(Contact,contact,function)
// x=================================================================x
// | "PyContact" Python Module Code Part |
// x=================================================================x
#if defined(__PYTHON_MODULE__)
// x-------------------------------------------------------------x
// | "PyContact" Attribute Methods |
// x-------------------------------------------------------------x
// Standart Accessors (Attributes).
DirectGetLongAttribute(PyContact_GetWidth , GetWidth , PyContact,Contact)
DirectGetLongAttribute(PyContact_GetHalfWidth , GetHalfWidth , PyContact,Contact)
DirectGetLongAttribute(PyContact_GetHeight , GetHeight , PyContact,Contact)
DirectGetLongAttribute(PyContact_GetHalfHeight, GetHalfHeight, PyContact,Contact)
DirectGetLongAttribute(PyContact_GetDx, GetDx, PyContact,Contact)
DirectGetLongAttribute(PyContact_GetDy, GetDy, PyContact,Contact)
// Standart Delete (Attribute).
DBoDeleteAttribute(PyContact_Delete, PyContact)
// ---------------------------------------------------------------
// PyContact Attribute Method table.
PyMethodDef PyContact_Methods[] =
{ { "Delete" , (PyCFunction)PyContact_Delete , METH_NOARGS
, "Delete associated hurricane object, the python object remains." }
, { "GetWidth" , (PyCFunction)PyContact_GetWidth , METH_NOARGS , "Return the contact width." }
, { "GetHalfWidth" , (PyCFunction)PyContact_GetHalfWidth , METH_NOARGS , "Return the contact half width." }
, { "GetHeight" , (PyCFunction)PyContact_GetHeight , METH_NOARGS , "Return the contact height." }
, { "GetHalfHeight" , (PyCFunction)PyContact_GetHalfHeight , METH_NOARGS , "Return the contact half height." }
, { "GetDx" , (PyCFunction)PyContact_GetDx , METH_NOARGS , "Return the contact dx value." }
, { "GetDy" , (PyCFunction)PyContact_GetDy , METH_NOARGS , "Return the contact dy value." }
, {NULL, NULL, 0, NULL} /* sentinel */
};
// x-------------------------------------------------------------x
// | "PyContact" Object Methods |
// x-------------------------------------------------------------x
// ---------------------------------------------------------------
// Attribute Method : "PyContact_new ()"
static PyObject* PyContact_new(PyTypeObject *type, PyObject *args, PyObject *kwds) {
trace << "PyContact_new()" << endl;
PyObject* arg0;
PyObject* arg1;
PyObject* arg2;
PyObject* arg3;
PyObject* arg4;
PyObject* arg5;
Contact* contact = NULL;
HTRY
__cs.Init ("Contact.new");
if ( ! PyArg_ParseTuple(args,"O&O&O&O&|O&O&:Contact.new"
,Converter,&arg0
,Converter,&arg1
,Converter,&arg2
,Converter,&arg3
,Converter,&arg4
,Converter,&arg5
) ) return ( NULL );
//cerr << "Format := " << __cs.GetObjectIds() << endl;
if ( __cs.GetObjectIds() == NET_LAYER_INTS2_ARG )
contact = Contact::Create ( PYNET_O(arg0)
, PYLAYER_O(arg1)
, PyInt_AsLong(arg2)
, PyInt_AsLong(arg3) );
else if ( __cs.GetObjectIds() == NET_LAYER_INTS3_ARG )
contact = Contact::Create ( PYNET_O(arg0)
, PYLAYER_O(arg1)
, PyInt_AsLong(arg2)
, PyInt_AsLong(arg3)
, PyInt_AsLong(arg4) );
else if ( __cs.GetObjectIds() == NET_LAYER_INTS4_ARG )
contact = Contact::Create ( PYNET_O(arg0)
, PYLAYER_O(arg1)
, PyInt_AsLong(arg2)
, PyInt_AsLong(arg3)
, PyInt_AsLong(arg4)
, PyInt_AsLong(arg5) );
else if ( __cs.GetObjectIds() == COMP_LAYER_INTS2_ARG )
contact = Contact::Create ( PYCOMPONENT_O(arg0)
, PYLAYER_O(arg1)
, PyInt_AsLong(arg2)
, PyInt_AsLong(arg3) );
else if ( __cs.GetObjectIds() == COMP_LAYER_INTS3_ARG )
contact = Contact::Create ( PYCOMPONENT_O(arg0)
, PYLAYER_O(arg1)
, PyInt_AsLong(arg2)
, PyInt_AsLong(arg3)
, PyInt_AsLong(arg4) );
else if ( __cs.GetObjectIds() == COMP_LAYER_INTS4_ARG )
contact = Contact::Create ( PYCOMPONENT_O(arg0)
, PYLAYER_O(arg1)
, PyInt_AsLong(arg2)
, PyInt_AsLong(arg3)
, PyInt_AsLong(arg4)
, PyInt_AsLong(arg5) );
else {
PyErr_SetString ( ConstructorError, "invalid number of parameters for Contact constructor." );
return ( NULL );
}
if (contact == NULL) { printf("error of creation of contact \n") ; return (NULL) ; }
HCATCH
return PyContact_Link ( contact );
}
DBoDeleteMethod(Contact)
PyTypeObjectLinkPyType(Contact)
PyTypeObjectConstructor(Contact)
#else // End of Python Module Code Part.
// x=================================================================x
// | "PyContact" Shared Library Code Part |
// x=================================================================x
// Link/Creation Method.
DBoLinkCreateMethod(PyContact_Link,PyContact,PyTypeContact,Contact)
// ---------------------------------------------------------------
// PyContact Object Definitions.
PyTypeInheritedObjectDefinitions(Contact, Component)
#endif // End of Shared Library Code Part.
} // End of extern "C".
} // End of Isobar namespace.

View File

@ -0,0 +1,107 @@
// -*- 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é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: PyContact.h,v 1.6 2006/05/03 14:00:02 jpc Exp $
//
// x-----------------------------------------------------------------x
// | |
// | 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@asim.lip6.fr |
// | =============================================================== |
// | C++ Header : "./PyContact.h" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#ifndef __PYCONTACT__
#define __PYCONTACT__
#include "PyComponent.h"
#include "Contact.h"
namespace Isobar {
extern "C" {
// -------------------------------------------------------------------
// Python Object : "PyContact".
typedef struct {
PyComponent _baseObject;
} PyContact;
// -------------------------------------------------------------------
// Functions & Types exported to "PyHurricane.ccp".
extern PyTypeObject PyTypeContact;
extern PyMethodDef PyContact_Methods[];
extern PyObject* PyContact_Link(Hurricane::Contact* object);
extern void PyContact_LinkPyType();
extern void PyContact_Constructor();
#define IsPyContact(v) ( (v)->ob_type == &PyTypeContact )
#define PYCONTACT(v) ( (PyContact*)(v) )
#define PYCONTACT_O(v) ( PYCONTACT(v)->_baseObject._baseObject._object )
} // End of extern "C".
} // End of Isobar namespace.
#endif

View File

@ -0,0 +1,193 @@
// -*- 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é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 |
// | |
// | Author : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
// | =============================================================== |
// | C++ Module : "./PyCataBase.cpp" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
# include "PyDataBase.h"
# include "PyTechnology.h"
namespace Isobar {
USING_NAMESPACE_HURRICANE
extern "C" {
# define METHOD_HEAD(function) GENERIC_METHOD_HEAD(DataBase,db,function)
// x=================================================================x
// | "PyDataBase" Python Module Code Part |
// x=================================================================x
# if defined(__PYTHON_MODULE__)
// x-------------------------------------------------------------x
// | "PyDataBase" Attribute Methods |
// x-------------------------------------------------------------x
// ---------------------------------------------------------------
// Attribute Method : "PyDataBase_GetDataBase ()"
PyObject* PyDataBase_GetDataBase ( PyObject* module ) {
trace << "PyDataBase_GetDataBase()" << endl;
DataBase* db = NULL;
HTRY
db = GetDataBase ();
if ( db == NULL )
PyErr_SetString ( HurricaneError, "DataBase has not been created yet" );
HCATCH
return PyDataBase_Link ( db );
}
// ---------------------------------------------------------------
// Attribute Method : "PyDataBase_GetTechnology ()"
PyObject* PyDataBase_GetTechnology ( PyDataBase* self ) {
trace << "PyDataBase_GetTechnology()" << endl;
Technology* techno = NULL;
HTRY
METHOD_HEAD("DataBase.GetTechnology()")
techno = db->GetTechnology ();
if ( techno == NULL )
Py_RETURN_NONE;
HCATCH
return PyTechnology_Link ( techno );
}
// Standart Accessors (Attributes).
// Standart Delete (Attribute).
DBoDeleteAttribute(PyDataBase_Delete,PyDataBase)
// ---------------------------------------------------------------
// PyDataBase Attribute Method table.
PyMethodDef PyDataBase_Methods[] =
{ { "GetTechnology", (PyCFunction)PyDataBase_GetTechnology, METH_NOARGS, "Return the Technology" }
, { "Delete" , (PyCFunction)PyDataBase_Delete , METH_NOARGS
, "Delete associated hurricane object The python object remains." }
, {NULL, NULL, 0, NULL} /* sentinel */
};
// x-------------------------------------------------------------x
// | "PyDataBase" Object Methods |
// x-------------------------------------------------------------x
// ---------------------------------------------------------------
// Attribute Method : "PyDataBase_new ()"
static PyObject* PyDataBase_new(PyTypeObject *type, PyObject *args, PyObject *kwds) {
trace << "PyDataBase_new()" << endl;
DataBase* db = NULL;
HTRY
db = DataBase::Create ();
HCATCH
return PyDataBase_Link(db);
}
DBoDeleteMethod(DataBase)
PyTypeObjectLinkPyType(DataBase)
PyTypeObjectConstructor(DataBase)
#else // End of Python Module Code Part.
// x=================================================================x
// | "PyCell" Shared Library Code Part |
// x=================================================================x
// Link/Creation Method.
DBoLinkCreateMethod(PyDataBase_Link,PyDataBase,PyTypeDataBase,DataBase)
// ---------------------------------------------------------------
// PyDataBase Object Definitions.
PyTypeRootObjectDefinitions(DataBase)
#endif // End of Shared Library Code Part.
} // End of extern "C".
} // End of Isobar namespace.

View File

@ -0,0 +1,109 @@
// -*- 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é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.h,v 1.1 2008/02/07 19:09:58 xtof Exp $
//
// x-----------------------------------------------------------------x
// | |
// | 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@asim.lip6.fr |
// | =============================================================== |
// | C++ Header : "./PyDataBase.h" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#ifndef __PYDATABASE__
#define __PYDATABASE__
#include "PyHurricane.h"
#include "DataBase.h"
namespace Isobar {
extern "C" {
// -------------------------------------------------------------------
// Python Object : "PyDataBase".
typedef struct {
PyObject_HEAD
Hurricane::DataBase* _object;
} PyDataBase;
// -------------------------------------------------------------------
// Functions & Types exported to "PyHurricane.ccp".
extern PyTypeObject PyTypeDataBase;
extern PyMethodDef PyDataBase_Methods[];
extern PyObject* PyDataBase_GetDataBase ( PyObject* module );
extern PyObject* PyDataBase_Link ( H::DataBase* db );
extern void PyDataBase_LinkPyType ();
extern void PyDataBase_Constructor ();
#define IsPyDataBase(v) ( (v)->ob_type == &PyTypeDataBase )
#define PYDATABASE(v) ( (PyDataBase*)(v) )
#define PYDATABASE_O(v) ( PYDATABASE(v)->_object )
} // End of extern "C".
} // End of Isobar namespace.
# endif

View File

@ -0,0 +1,219 @@
// -*- 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é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: PyEntity.cpp,v 1.8 2007/04/26 13:38:47 d2 Exp $
//
// x-----------------------------------------------------------------x
// | |
// | 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@asim.lip6.fr |
// | =============================================================== |
// | C++ Module : "./PyEntity.cpp" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#include "PyNet.h"
#include "PyLayer.h"
#include "PyPoint.h"
#include "PyBox.h"
#include "PyCell.h"
#include "PyInstance.h"
#include "PyReference.h"
#include "PyComponent.h"
#include "PyPlug.h"
#include "PyHorizontal.h"
#include "PyVertical.h"
#include "PyContact.h"
#include "PyPin.h"
namespace Isobar {
USING_NAMESPACE_HURRICANE
extern "C" {
// x=================================================================x
// | "PyEntity" Python Module Code Part |
// x=================================================================x
#if defined(__PYTHON_MODULE__)
#define METHOD_HEAD(function) GENERIC_METHOD_HEAD(Entity,entity,function)
// x-------------------------------------------------------------x
// | "PyEntity" Attribute Methods |
// x-------------------------------------------------------------x
// Standart Delete (Attribute).
DBoDeleteAttribute(PyEntity_Delete,PyEntity)
// ---------------------------------------------------------------
// Attribute Method : "PyEntity_GetCell ()"
static PyObject* PyEntity_GetCell ( PyEntity *self )
{
trace << "PyEntity_GetCell ()" << endl;
Cell* cell = NULL;
HTRY
METHOD_HEAD ( "Entity.GetCell()" )
cell = entity->GetCell ();
HCATCH
return PyCell_Link ( cell );
}
// ---------------------------------------------------------------
// PyEntity Attribute Method table.
PyMethodDef PyEntity_Methods[] =
{ { "GetCell" , (PyCFunction)PyEntity_GetCell , METH_NOARGS , "Returns the entity cell." }
, { "Delete" , (PyCFunction)PyEntity_Delete , METH_NOARGS
, "Delete associated hurricane object, the python object remains." }
, {NULL, NULL, 0, NULL} /* sentinel */
};
// x-------------------------------------------------------------x
// | "PyEntity" Object Methods |
// x-------------------------------------------------------------x
DBoDeleteMethod(Entity)
PyTypeObjectLinkPyType(Entity)
# else // End of Python Module Code Part.
// x=================================================================x
// | "PyEntity" Shared Library Code Part |
// x=================================================================x
// ---------------------------------------------------------------
// Allocator Method : "PyEntity_NEW ()"
//
// No PyEntity should ever be created, it's not a terminal object
// of the class hierarchy. Instead create the real underlying PyObject.
PyObject* PyEntity_NEW ( Entity* entity )
{
if ( !entity ) {
PyErr_SetString ( HurricaneError, "Invalid Entity (bad occurrence)" ); \
return NULL;
}
Cell* cell = dynamic_cast<Cell*>(entity);
if ( cell ) return PyCell_Link ( cell );
Instance* instance = dynamic_cast<Instance*>(entity);
if ( instance ) return PyInstance_Link ( instance );
Reference* reference = dynamic_cast<Reference*>(entity);
if ( reference ) return PyReference_Link ( reference );
Horizontal* horizontal = dynamic_cast<Horizontal*>(entity);
if ( horizontal ) return PyHorizontal_Link ( horizontal );
Vertical* vertical = dynamic_cast<Vertical*>(entity);
if ( vertical ) return PyVertical_Link ( vertical );
Contact* contact = dynamic_cast<Contact*>(entity);
if ( contact ) return PyContact_Link ( contact );
Plug* plug = dynamic_cast<Plug*>(entity);
if ( plug ) return PyPlug_Link ( plug );
Pin* pin = dynamic_cast<Pin*>(entity);
if ( pin ) return PyPin_Link ( pin );
Net* net = dynamic_cast<Net*>(entity);
if ( net ) return PyNet_Link ( net );
Py_RETURN_NONE;
}
PyTypeRootObjectDefinitions(Entity)
// ---------------------------------------------------------------
// PyEntity Object Definitions.
# endif // End of Shared Library Code Part.
} // End of extern "C".
# if !defined(__PYTHON_MODULE__)
Hurricane::Entity* EntityCast ( PyObject* derivedObject )
{
if ( IsPyCell (derivedObject) ) return PYCELL_O(derivedObject);
if ( IsPyInstance (derivedObject) ) return PYINSTANCE_O(derivedObject);
if ( IsPyReference (derivedObject) ) return PYREFERENCE_O(derivedObject);
if ( IsPyPlug (derivedObject) ) return PYPLUG_O(derivedObject);
if ( IsPyHorizontal(derivedObject) ) return PYHORIZONTAL_O(derivedObject);
if ( IsPyVertical (derivedObject) ) return PYVERTICAL_O(derivedObject);
if ( IsPyContact (derivedObject) ) return PYCONTACT_O(derivedObject);
if ( IsPyPin (derivedObject) ) return PYPIN_O(derivedObject);
if ( IsPyNet (derivedObject) ) return PYNET_O(derivedObject);
return NULL;
}
# endif
} // End of Isobar namespace.

View File

@ -0,0 +1,111 @@
// -*- 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é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: PyEntity.h,v 1.3 2006/05/03 14:00:02 jpc 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++ Header : "./PyEntity.h" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#ifndef __PYENTITY__
#define __PYENTITY__
#include "PyHurricane.h"
#include "Entity.h"
namespace Isobar {
extern "C" {
// -------------------------------------------------------------------
// Python Object : "PyEntity".
typedef struct {
PyObject_HEAD
Hurricane::Entity* _object;
} PyEntity;
// -------------------------------------------------------------------
// Functions & Types exported to "PyHurricane.ccp".
extern PyObject* PyEntity_NEW ( Hurricane::Entity* entity );
extern void PyEntity_LinkPyType ();
extern PyTypeObject PyTypeEntity;
extern PyMethodDef PyEntity_Methods[];
#define IsPyEntity(v) ( (v)->ob_type == &PyTypeEntity )
#define PYENTITY(v) ( (PyEntity*)(v) )
#define PYENTITY_O(v) ( PYENTITY(v)->_object )
} // End of extern "C".
Hurricane::Entity* EntityCast ( PyObject* derivedObject );
} // End of Isobar namespace.
#endif

View File

@ -0,0 +1,233 @@
// -*- 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é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: PyHorizontal.cpp,v 1.15 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 : "./PyHorizontal.cpp" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
# include "PyNet.h"
# include "PyLayer.h"
# include "PyHorizontal.h"
namespace Isobar {
USING_NAMESPACE_HURRICANE
extern "C" {
# undef ACCESS_OBJECT
# undef ACCESS_CLASS
# define ACCESS_OBJECT _baseObject._baseObject._baseObject._object
# define ACCESS_CLASS(_pyObject) &(_pyObject->_baseObject._baseObject._baseObject)
# define METHOD_HEAD(function) GENERIC_METHOD_HEAD_SUB(Horizontal,horizontal,function)
// x=================================================================x
// | "PyHorizontal" Python Module Code Part |
// x=================================================================x
# if defined(__PYTHON_MODULE__)
// x-------------------------------------------------------------x
// | "PyHorizontal" Attribute Methods |
// x-------------------------------------------------------------x
// Standart Delete (Attribute).
DBoDeleteAttribute(PyHorizontal_Delete,PyHorizontal)
// ---------------------------------------------------------------
// PyHorizontal Attribute Method table.
PyMethodDef PyHorizontal_Methods[] =
{ { "Delete" , (PyCFunction)PyHorizontal_Delete , METH_NOARGS
, "Delete associated hurricane object, the python object remains." }
, {NULL, NULL, 0, NULL} /* sentinel */
};
// x-------------------------------------------------------------x
// | "PyHorizontal" Object Methods |
// x-------------------------------------------------------------x
// ---------------------------------------------------------------
// Attribute Method : "PyHorizontal_new ()"
static PyObject* PyHorizontal_new(PyTypeObject *type, PyObject *args, PyObject *kwds) {
trace << "PyHorizontal_new()" << endl;
PyObject* arg0;
PyObject* arg1;
PyObject* arg2;
PyObject* arg3;
PyObject* arg4;
PyObject* arg5;
PyObject* arg6;
Horizontal* horizontal = NULL;
HTRY
__cs.Init ("Horizontal.Create");
if ( ! PyArg_ParseTuple(args,"O&O&O&|O&O&O&O&:Horizontal.Create"
,Converter,&arg0
,Converter,&arg1
,Converter,&arg2
,Converter,&arg3
,Converter,&arg4
,Converter,&arg5
,Converter,&arg6
) ) return ( NULL );
if ( __cs.GetObjectIds() == NET_LAYER_INT_ARG )
horizontal = Horizontal::Create ( PYNET_O(arg0)
, PYLAYER_O(arg1)
, PyInt_AsLong(arg2) );
else if ( __cs.GetObjectIds() == NET_LAYER_INTS2_ARG )
horizontal = Horizontal::Create ( PYNET_O(arg0)
, PYLAYER_O(arg1)
, PyInt_AsLong(arg2)
, PyInt_AsLong(arg3) );
else if ( __cs.GetObjectIds() == COMPS2_LAYER_INT_ARG )
horizontal = Horizontal::Create ( ComponentCast(arg0)
, ComponentCast(arg1)
, PYLAYER_O(arg2)
, PyInt_AsLong(arg3) );
else if ( __cs.GetObjectIds() == NET_LAYER_INTS3_ARG )
horizontal = Horizontal::Create ( PYNET_O(arg0)
, PYLAYER_O(arg1)
, PyInt_AsLong(arg2)
, PyInt_AsLong(arg3)
, PyInt_AsLong(arg4) );
else if ( __cs.GetObjectIds() == COMPS2_LAYER_INTS2_ARG )
horizontal = Horizontal::Create ( ComponentCast(arg0)
, ComponentCast(arg1)
, PYLAYER_O(arg2)
, PyInt_AsLong(arg3)
, PyInt_AsLong(arg4) );
else if ( __cs.GetObjectIds() == NET_LAYER_INTS4_ARG )
horizontal = Horizontal::Create ( PYNET_O(arg0)
, PYLAYER_O(arg1)
, PyInt_AsLong(arg2)
, PyInt_AsLong(arg3)
, PyInt_AsLong(arg4)
, PyInt_AsLong(arg5) );
else if ( __cs.GetObjectIds() == COMPS2_LAYER_INTS3_ARG )
horizontal = Horizontal::Create ( ComponentCast(arg0)
, ComponentCast(arg1)
, PYLAYER_O(arg2)
, PyInt_AsLong(arg3)
, PyInt_AsLong(arg4)
, PyInt_AsLong(arg5) );
else if ( __cs.GetObjectIds() == COMPS2_LAYER_INTS4_ARG )
horizontal = Horizontal::Create ( ComponentCast(arg0)
, ComponentCast(arg1)
, PYLAYER_O(arg2)
, PyInt_AsLong(arg3)
, PyInt_AsLong(arg4)
, PyInt_AsLong(arg5)
, PyInt_AsLong(arg6) );
else {
cerr << __cs.GetObjectIds() << endl;
PyErr_SetString ( ConstructorError, "invalid number of parameters for Horizontal constructor." );
return ( NULL );
}
HCATCH
return PyHorizontal_Link ( horizontal );
}
DBoDeleteMethod(Horizontal)
PyTypeObjectLinkPyType(Horizontal)
PyTypeObjectConstructor(Horizontal)
# else // End of Python Module Code Part.
// x=================================================================x
// | "PyHorizontal" Shared Library Code Part |
// x=================================================================x
// Link/Creation Method.
DBoLinkCreateMethod(PyHorizontal_Link,PyHorizontal,PyTypeHorizontal,Horizontal)
// ---------------------------------------------------------------
// PyHorizontal Object Definitions.
PyTypeInheritedObjectDefinitions(Horizontal, Segment)
# endif // End of Shared Library Code Part.
} // End of extern "C".
} // End of Isobar namespace.

View File

@ -0,0 +1,108 @@
// -*- 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é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: PyHorizontal.h,v 1.6 2007/01/30 14:47:24 cobell 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++ Header : "./PyHorizontal.h" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#ifndef __PYHORIZONTAL__
#define __PYHORIZONTAL__
#include "PySegment.h"
#include "Horizontal.h"
namespace Isobar {
extern "C" {
// -------------------------------------------------------------------
// Python Object : "PyHorizontal".
typedef struct {
PySegment _baseObject;
} PyHorizontal;
// -------------------------------------------------------------------
// Functions & Types exported to "PyHurricane.ccp".
extern PyTypeObject PyTypeHorizontal;
extern PyMethodDef PyHorizontal_Methods[];
extern PyObject* PyHorizontal_Link( Hurricane::Horizontal* object );
extern void PyHorizontal_LinkPyType();
extern void PyHorizontal_Constructor();
#define IsPyHorizontal(v) ( (v)->ob_type == &PyTypeHorizontal )
#define PYHORIZONTAL(v) ( (PyHorizontal*)(v) )
#define PYHORIZONTAL_O(v) ( PYHORIZONTAL(v)->_baseObject._baseObject._baseObject._object )
} // End of extern "C".
} // End of Isobar namespace.
#endif

View File

@ -0,0 +1,726 @@
// -*- 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é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: PyHurricane.cpp,v 1.58 2008/02/07 19:09:58 xtof Exp $
//
// x-----------------------------------------------------------------x
// | |
// | 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@asim.lip6.fr |
// | =============================================================== |
// | C++ Module : "./PyHurricane.cpp" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#include "PyHurricane.h"
#include "PyUpdateSession.h"
#include "PyUnit.h"
#include "PyPoint.h"
#include "PyBox.h"
#include "PyTransformation.h"
#include "PyName.h"
#include "PyDataBase.h"
#include "PyLibrary.h"
#include "PyEntity.h"
#include "PyCell.h"
#include "PyLayer.h"
#include "PyPin.h"
#include "PyInstance.h"
#include "PyReference.h"
#include "PyNet.h"
#include "PyHyperNet.h"
#include "PyComponent.h"
#include "PyPlug.h"
#include "PySegment.h"
#include "PyContact.h"
#include "PyHorizontal.h"
#include "PyVertical.h"
#include "PyPath.h"
#include "PyOccurrence.h"
#include "PyInstanceLocator.h"
#include "PyPlugLocator.h"
#include "PyPinLocator.h"
#include "PySegmentLocator.h"
#include "PyComponentLocator.h"
#include "PyOccurrenceLocator.h"
#include "PyNetLocator.h"
#include "PyCellLocator.h"
#include "PyReferenceLocator.h"
#include "PyTechnology.h"
#include "NetExternalComponents.h"
namespace Isobar {
# if !defined(__PYTHON_MODULE__)
// x=================================================================x
// | "PyHurricane" Shared Library Code Part |
// x=================================================================x
// x-----------------------------------------------------------------x
// | "PyHurricane" C++ Local Variables |
// x-----------------------------------------------------------------x
namespace {
using namespace std;
// ---------------------------------------------------------------
// Local Variables.
const char* objectTypeRedefinition =
"ConverterState::AddType () :\n\n"
" Attempt to add twice a type with identifier \n";
} // End of local namespace.
USING_NAMESPACE_HURRICANE
// x-----------------------------------------------------------------x
// | "PyHurricane" C++ Global Variables |
// x-----------------------------------------------------------------x
char* ConverterState::ObjectType::_inheritStop
= "comp";
ConverterState __cs = ConverterState ();
int __objectOffset = offsetof ( PyPoint, _object );
map <void*,PyObject*> H2PMap;
// x-----------------------------------------------------------------x
// | "PyHurricane" C++ Functions |
// x-----------------------------------------------------------------x
// -------------------------------------------------------------------
// Method : "::ConverterState::ObjectType::PyEqual ()"
bool ConverterState::ObjectType::PyEqual ( PyTypeObject* pyType ) {
if ( _pyType == pyType ) return true;
if ( _idBase[0] == '\0' ) return false;
return ( __cs.GetObject(_idBase)->PyEqual(pyType) );
}
// -------------------------------------------------------------------
// Method : "::ConverterState::ObjectType::PyBase ()"
ConverterState::ObjectType* ConverterState::ObjectType::PyBase ( PyTypeObject* pyType )
{
if ( _pyType != pyType ) return NULL;
return ( PyBase() );
}
ConverterState::ObjectType* ConverterState::ObjectType::PyBase ()
{
if ( _idBase[0] == '\0' ) return this;
if ( ! strcmp(_id,_inheritStop) ) return this;
return ( __cs.GetObject(_idBase)->PyBase() );
}
// -------------------------------------------------------------------
// Method : "::ConverterState::ObjectType::PyBaseId ()"
char* ConverterState::ObjectType::PyBaseId ( PyTypeObject* pyType )
{
if ( _idBase[0] == '\0' ) return _id;
if ( ! strcmp(_id,_inheritStop) ) return _id;
return ( __cs.GetObject(_idBase)->PyBase(pyType)->_id );
}
// -------------------------------------------------------------------
// Destructor : "::ConverterState::~ConverterState ()"
ConverterState::~ConverterState () {
for ( unsigned i=0 ; i < _types.size() ; i++ )
delete _types [ i ];
}
// -------------------------------------------------------------------
// Method : "::ConverterState::AddType ()"
void ConverterState::AddType ( char* id
, PyTypeObject* pyType
, char* name
, bool isPythonType
, char* idBase ) {
for ( unsigned i=0 ; i < _types.size() ; i++ ) {
if ( ! strcmp ( _types[i]->_id, id ) )
throw Error ( objectTypeRedefinition );
}
assert ( strlen ( id ) < 11 );
ObjectType* otype = new ObjectType;
strcpy ( otype->_id, id );
otype->_pyType = pyType;
otype->_name = name;
otype->_isPythonType = isPythonType;
strcpy ( otype->_idBase, idBase );
otype->_index = _types.size();
_types.push_back ( otype );
}
// -------------------------------------------------------------------
// Method : "::ConverterState::GetObjectType ()"
string ConverterState::GetObjectType ( string objectsTypes, unsigned n ) {
string temp;
size_t end, head, tail, start;
unsigned element = 0;
end = objectsTypes.size();
if ( end > 0 ) {
for ( head=0 ; head <= end ; head=tail ) {
tail = objectsTypes.find ( ':' , head+1 );
start = head+1;
temp = objectsTypes.substr ( start, tail-start );
if ( n == element )
return temp;
element++;
}
}
return "";
}
// -------------------------------------------------------------------
// Method : "::ConverterState::GetObjectId ()"
char* ConverterState::GetObjectId ( PyObject* object ) {
for ( unsigned i=0 ; i < _types.size() ; i++ ) {
if ( ( ! strcmp ( _types[i]->_id, "function" ) ) && ( PyCallable_Check(object) ) )
return ( _types[i]->_id );
if ( ( ! strcmp ( _types[i]->_id, "none" ) ) && ( object == Py_None ) )
return ( _types[i]->_id );
if ( object->ob_type == _types[i]->_pyType ) return ( _types[i]->_id );
}
return ( "unknown" ); // return 'X'
}
// -------------------------------------------------------------------
// Method : "::ConverterState::GetObject ()"
ConverterState::ObjectType* ConverterState::GetObject ( char* id ) {
for ( unsigned i=0 ; i < _types.size() ; i++ ) {
if ( ! strcmp ( id, _types[i]->_id ) ) return ( _types[i] );
}
return ( NULL );
}
// -------------------------------------------------------------------
// Method : "::ConverterState::GetObjectName ()"
char *ConverterState::GetObjectName ( string id ) {
for ( unsigned i=0 ; i < _types.size() ; i++ ) {
if ( ! strcmp ( id.c_str(), _types[i]->_id ) ) return ( _types[i]->_name );
}
return ( "<Unknown>" );
}
// -------------------------------------------------------------------
// Method : "::ConverterState::Init ()"
void ConverterState::Init ( char* function, char* inheritStop ) {
_objectIds = "";
SetFunction ( function );
ObjectType::_inheritStop = inheritStop;
};
// -------------------------------------------------------------------
// Function : "Converter ()"
int Converter ( PyObject* object, void** pArg ) {
ostringstream message;
string unboundObject = "";
ConverterState::ObjectType* baseType;
for ( unsigned i=0 ; i < __cs.GetTypes().size() ; i++ ) {
baseType = __cs.GetTypes()[i]->PyBase ( object->ob_type );
if ( PyCallable_Check(object) || baseType ) {
*pArg = object;
i = baseType->_index;
__cs.AddId ( baseType->_id );
if ( ! __cs.GetTypes()[i]->_isPythonType ) {
void** member = ( (void**)( (unsigned long)object + __objectOffset ) );
if ( *member == NULL ) {
unboundObject = __cs.GetTypes()[i]->_name;
break;
}
}
return ( 1 );
}
}
if ( unboundObject.size() ) {
message << "Attempt to call " << __cs.GetFunction()
<< "() with an unbound " << unboundObject << " argument";
PyErr_SetString ( ProxyError, message.str().c_str() );
return ( 0 );
}
message << "Argument " << __cs.GetSize() + 1
<< " of call to " << __cs.GetFunction()
<< "() is of unmanaged type " << object->ob_type->tp_name;
PyErr_SetString ( ProxyError, message.str().c_str() );
return ( 0 );
}
// -------------------------------------------------------------------
// Function : "ParseOneArg ()"
bool ParseOneArg ( char* function, PyObject* args, string format, PyObject** arg ) {
ostringstream message;
__cs.Init ( function );
if ( ! PyArg_ParseTuple(args,"O&",Converter,arg) ) return ( false );
string firstArgType = ConverterState::GetObjectType ( __cs.GetObjectIds(), 0 );
string firstArgTypeExp = ConverterState::GetObjectType ( format , 0 );
if ( firstArgType != firstArgTypeExp ) {
message << "First argument of call to " << __cs.GetFunction()
<< "() is of unexpected type " << (*arg)->ob_type->tp_name
<< ", must be of type " << __cs.GetObjectName( firstArgTypeExp );
PyErr_SetString ( ProxyError, message.str().c_str() );
return ( false );
}
return ( true );
}
// -------------------------------------------------------------------
// Function : "ParseTwoArg ()"
bool ParseTwoArg ( char* function, PyObject* args, string format, PyObject** arg0, PyObject** arg1 ) {
ostringstream message;
__cs.Init ( function );
if ( ! PyArg_ParseTuple(args,"O&O&",Converter,arg0,Converter,arg1) ) return ( false );
string firstArgType = ConverterState::GetObjectType ( __cs.GetObjectIds(), 0 );
string firstArgTypeExp = ConverterState::GetObjectType ( format , 0 );
if ( firstArgType != firstArgTypeExp ) {
message << "First argument of call to " << __cs.GetFunction()
<< "() is of unexpected type " << (*arg0)->ob_type->tp_name
<< ", must be of type " << __cs.GetObjectName( firstArgTypeExp );
PyErr_SetString ( ProxyError, message.str().c_str() );
return ( false );
}
string secondArgType = ConverterState::GetObjectType ( __cs.GetObjectIds(), 1 );
string secondArgTypeExp = ConverterState::GetObjectType ( format , 1 );
if ( secondArgType != secondArgTypeExp ) {
message << "Second argument of call to " << __cs.GetFunction()
<< "() is of unexpected type " << (*arg1)->ob_type->tp_name
<< ", must be of type " << __cs.GetObjectName( secondArgTypeExp );
PyErr_SetString ( ProxyError, message.str().c_str() );
return ( false );
}
return ( true );
}
// -------------------------------------------------------------------
// Function : "ParseThreeArg ()"
bool ParseThreeArg ( char* function, PyObject* args, string format, PyObject** arg0, PyObject** arg1, PyObject** arg2 ) {
ostringstream message;
__cs.Init ( function );
if ( ! PyArg_ParseTuple(args,"O&O&O&",Converter,arg0,Converter,arg1,Converter,arg2) ) return ( false );
string firstArgType = ConverterState::GetObjectType ( __cs.GetObjectIds(), 0 );
string firstArgTypeExp = ConverterState::GetObjectType ( format , 0 );
if ( firstArgType != firstArgTypeExp ) {
message << "First argument of call to " << __cs.GetFunction()
<< "() is of unexpected type " << (*arg0)->ob_type->tp_name
<< ", must be of type " << __cs.GetObjectName( firstArgTypeExp );
PyErr_SetString ( ProxyError, message.str().c_str() );
return ( false );
}
string secondArgType = ConverterState::GetObjectType ( __cs.GetObjectIds(), 1 );
string secondArgTypeExp = ConverterState::GetObjectType ( format , 1 );
if ( secondArgType != secondArgTypeExp ) {
message << "Second argument of call to " << __cs.GetFunction()
<< "() is of unexpected type " << (*arg1)->ob_type->tp_name
<< ", must be of type " << __cs.GetObjectName( secondArgTypeExp );
PyErr_SetString ( ProxyError, message.str().c_str() );
return ( false );
}
string thirdArgType = ConverterState::GetObjectType ( __cs.GetObjectIds(), 2 );
string thirdArgTypeExp = ConverterState::GetObjectType ( format , 2 );
if ( thirdArgType != thirdArgTypeExp ) {
message << "Third argument of call to " << __cs.GetFunction()
<< "() is of unexpected type " << (*arg2)->ob_type->tp_name
<< ", must be of type " << __cs.GetObjectName( thirdArgTypeExp );
PyErr_SetString ( ProxyError, message.str().c_str() );
return ( false );
}
return ( true );
}
// x-----------------------------------------------------------------x
// | "PyHurricane" C Global Variables |
// x-----------------------------------------------------------------x
extern "C" {
PyObject* ConstructorError = NULL;
PyObject* ProxyError = NULL;
PyObject* HurricaneError = NULL;
PyObject* CoriolisError = NULL;
PyObject* HurricaneWarning = NULL;
}
# else // End of PyHurricane Shared Library Code Part.
// x=================================================================x
// | "PyHurricane" Python Module Code Part |
// x=================================================================x
extern "C" {
// ---------------------------------------------------------------
// Attribute Method : "PyNetExternalComponents_GetNetExternalComponents ()"
PyObject* PyNetExternalComponents_GetExternalComponents ( PyObject* module, PyObject* args )
{
trace << "PyNetExternalComponents_GetExternalComponents()" << endl;
PyObject* arg0;
if ( ! ParseOneArg ( "GetExternalComponents", args, ":ent", &arg0) ) return ( NULL );
PyComponentLocator* pyComponentLocator = NULL;
HTRY
Components components = GetExternalComponents ( PYNET_O ( arg0 ) );
pyComponentLocator = PyObject_NEW ( PyComponentLocator, &PyTypeComponentLocator );
if (pyComponentLocator == NULL) { return NULL; }
pyComponentLocator->_object = components.GetLocator ();
HCATCH
return ( (PyObject*)pyComponentLocator );
}
// x-------------------------------------------------------------x
// | "PyHurricane" Module Methods |
// x-------------------------------------------------------------x
static PyMethodDef PyHurricane_Methods[] =
{ { "GetUnit" , PyUnit_GetUnit , METH_VARARGS, "Convert to Unit." }
, { "GetValue" , PyUnit_GetValue , METH_VARARGS, "Convert a Unit to a value." }
, { "GetDataBase" , (PyCFunction)PyDataBase_GetDataBase , METH_NOARGS , "Get the current DataBase." }
, { "OpenUpdateSession" , (PyCFunction)PyUpdateSession_OpenUpdateSession , METH_NOARGS , "Open an UpdateSession." }
, { "CloseUpdateSession" , (PyCFunction)PyUpdateSession_CloseUpdateSession, METH_NOARGS , "Close an UpdateSession." }
, { "GetExternalComponents" , (PyCFunction)PyNetExternalComponents_GetExternalComponents, METH_VARARGS, "Returns the components collection of an external net" }
, {NULL, NULL, 0, NULL} /* sentinel */
};
// ---------------------------------------------------------------
// Module Initialization : "initHurricane ()"
DL_EXPORT(void) initHurricane () {
trace << "initHurricane()" << endl;
PyPoint_LinkPyType ();
PyBox_LinkPyType ();
PyTransformation_LinkPyType ();
PyName_LinkPyType ();
PyDataBase_LinkPyType ();
PyTechnology_LinkPyType ();
PyLibrary_LinkPyType ();
PyEntity_LinkPyType ();
PyLayer_LinkPyType ();
PyPath_LinkPyType ();
PyOccurrence_LinkPyType ();
PyInstanceLocator_LinkPyType ();
PyPlugLocator_LinkPyType ();
PyNetLocator_LinkPyType ();
PyCellLocator_LinkPyType ();
PyPinLocator_LinkPyType ();
PySegmentLocator_LinkPyType ();
PyOccurrenceLocator_LinkPyType ();
PyComponentLocator_LinkPyType ();
PyReferenceLocator_LinkPyType ();
PyCell_LinkPyType ();
PyInstance_LinkPyType ();
PyReference_LinkPyType ();
PyNet_LinkPyType ();
PyHyperNet_LinkPyType ();
PyComponent_LinkPyType ();
PySegment_LinkPyType ();
PyVertical_LinkPyType ();
PyHorizontal_LinkPyType ();
PyContact_LinkPyType ();
PyPin_LinkPyType ();
PyPlug_LinkPyType ();
//constructors
PyPoint_Constructor();
PyDataBase_Constructor();
PyLibrary_Constructor();
PyBox_Constructor();
PyTransformation_Constructor();
PyName_Constructor();
PyReference_Constructor();
PyCell_Constructor();
PyInstance_Constructor();
PyNet_Constructor();
PyHyperNet_Constructor();
PyHorizontal_Constructor();
PyVertical_Constructor();
PyContact_Constructor();
PyPin_Constructor();
PyPath_Constructor();
PyOccurrence_Constructor();
PYTYPE_READY ( Point )
PYTYPE_READY ( Box )
PYTYPE_READY ( Transformation )
PYTYPE_READY ( Name )
PYTYPE_READY ( DataBase )
PYTYPE_READY ( Technology )
PYTYPE_READY ( Library )
PYTYPE_READY ( Entity )
PYTYPE_READY ( Layer )
PYTYPE_READY ( Path )
PYTYPE_READY ( Occurrence )
PYTYPE_READY ( InstanceLocator )
PYTYPE_READY ( PlugLocator )
PYTYPE_READY ( NetLocator )
PYTYPE_READY ( CellLocator )
PYTYPE_READY ( PinLocator )
PYTYPE_READY ( SegmentLocator )
PYTYPE_READY ( ComponentLocator )
PYTYPE_READY ( OccurrenceLocator)
PYTYPE_READY ( ReferenceLocator )
PYTYPE_READY ( HyperNet )
PYTYPE_READY_SUB ( Cell , Entity )
PYTYPE_READY_SUB ( Instance , Entity )
PYTYPE_READY_SUB ( Reference , Entity )
PYTYPE_READY_SUB ( Net , Entity )
PYTYPE_READY_SUB ( Component , Entity )
PYTYPE_READY_SUB ( Segment , Component)
PYTYPE_READY_SUB ( Horizontal, Segment )
PYTYPE_READY_SUB ( Vertical , Segment )
PYTYPE_READY_SUB ( Contact , Component)
PYTYPE_READY_SUB ( Pin , Contact )
PYTYPE_READY_SUB ( Plug , Component)
// Identifier string can take up to 10 characters !
__cs.AddType ( "box" , &PyTypeBox , "<Box>" , false );
__cs.AddType ( "ent" , &PyTypeEntity , "<Entity>" , false );
__cs.AddType ( "cell" , &PyTypeCell , "<Cell>" , false, "ent" );
__cs.AddType ( "cellLoc" , &PyTypeCellLocator , "<CellLocator>" , false );
__cs.AddType ( "comp" , &PyTypeComponent , "<Component>" , false, "ent" );
__cs.AddType ( "compLoc" , &PyTypeComponentLocator , "<ComponentLocator>" , false );
__cs.AddType ( "contact" , &PyTypeContact , "<Contact>" , false, "comp" );
// Do not change the "none" string. It's hardwired to the None object.
__cs.AddType ( "none" , Py_None->ob_type , "<None>" , true );
__cs.AddType ( "float" , &PyFloat_Type , "<Float>" , true );
__cs.AddType ( "int" , &PyInt_Type , "<Int>" , true );
__cs.AddType ( "bool" , &PyBool_Type , "<Bool>" , true );
__cs.AddType ( "string" , &PyString_Type , "<String>" , true );
__cs.AddType ( "list" , &PyList_Type , "<List>" , true );
// Do not change the "function" string. It's hardwired to callable (function) objects.
__cs.AddType ( "function" , NULL , "<Function>" , true );
__cs.AddType ( "horiz" , &PyTypeHorizontal , "<Horizontal>" , false, "segment" );
__cs.AddType ( "inst" , &PyTypeInstance , "<Instance>" , false, "ent" );
__cs.AddType ( "instLoc" , &PyTypeInstanceLocator , "<InstanceLocator>" , false );
__cs.AddType ( "layer" , &PyTypeLayer , "<Layer>" , false );
__cs.AddType ( "library" , &PyTypeLibrary , "<Library>" , false );
__cs.AddType ( "name" , &PyTypeName , "<Name>" , false );
__cs.AddType ( "ref" , &PyTypeReference , "<Reference>" , false, "ent" );
__cs.AddType ( "refLoc" , &PyTypeReferenceLocator , "<ReferenceLocator>" , false );
__cs.AddType ( "net" , &PyTypeNet , "<Net>" , false, "ent" );
__cs.AddType ( "netLoc" , &PyTypeNetLocator , "<NetLocator>" , false );
__cs.AddType ( "hyperNet" , &PyTypeHyperNet , "<HyperNet>" , false );
__cs.AddType ( "pin" , &PyTypePin , "<Pin>" , false, "contact" );
__cs.AddType ( "pinLoc" , &PyTypePinLocator , "<PinLocator>" , false );
__cs.AddType ( "plug" , &PyTypePlug , "<Plug>" , false, "comp" );
__cs.AddType ( "plugLoc" , &PyTypePlugLocator , "<PlugLocator>" , false );
__cs.AddType ( "point" , &PyTypePoint , "<Point>" , false );
__cs.AddType ( "segment" , &PyTypeSegment , "<Segment>" , false, "comp" );
__cs.AddType ( "segmentLoc" , &PyTypeSegmentLocator , "<SegmentLocator>" , false );
__cs.AddType ( "db" , &PyTypeDataBase , "<DataBase>" , false );
__cs.AddType ( "techno" , &PyTypeTechnology , "<Technology>" , false );
__cs.AddType ( "transfo" , &PyTypeTransformation , "<Transformation>" , false );
__cs.AddType ( "vert" , &PyTypeVertical , "<Vertical>" , false, "segment" );
__cs.AddType ( "path" , &PyTypePath , "<Path>" , false );
__cs.AddType ( "occur" , &PyTypeOccurrence , "<Occurrence>" , false );
__cs.AddType ( "occurLoc" , &PyTypeOccurrenceLocator, "<OccurrenceLocator>", false );
PyObject* module = Py_InitModule ( "Hurricane", PyHurricane_Methods );
if ( module == NULL ) {
cerr << "[ERROR]\n"
<< " Failed to initialize Hurricane module." << endl;
return;
}
PyModule_AddObject(module, "Point" , (PyObject*)&PyTypePoint);
PyModule_AddObject(module, "DataBase" , (PyObject*)&PyTypeDataBase);
PyModule_AddObject(module, "Library" , (PyObject*)&PyTypeLibrary);
PyModule_AddObject(module, "Box" , (PyObject*)&PyTypeBox);
PyModule_AddObject(module, "Transformation" , (PyObject*)&PyTypeTransformation);
PyModule_AddObject(module, "Name" , (PyObject*)&PyTypeName);
PyModule_AddObject(module, "Reference" , (PyObject*)&PyTypeReference);
PyModule_AddObject(module, "Cell" , (PyObject*)&PyTypeCell);
PyModule_AddObject(module, "Instance" , (PyObject*)&PyTypeInstance);
PyModule_AddObject(module, "Net" , (PyObject*)&PyTypeNet);
PyModule_AddObject(module, "HyperNet" , (PyObject*)&PyTypeHyperNet);
PyModule_AddObject(module, "Horizontal" , (PyObject*)&PyTypeHorizontal);
PyModule_AddObject(module, "Vertical" , (PyObject*)&PyTypeVertical);
PyModule_AddObject(module, "Contact" , (PyObject*)&PyTypeContact);
PyModule_AddObject(module, "Pin" , (PyObject*)&PyTypePin);
PyModule_AddObject(module, "Path" , (PyObject*)&PyTypePath);
PyModule_AddObject(module, "Occurrence" , (PyObject*)&PyTypeOccurrence);
PyObject* dictionnary = PyModule_GetDict ( module );
ConstructorError = PyErr_NewException ( "hurricane.ConstructorError", NULL, NULL );
ProxyError = PyErr_NewException ( "hurricane.ProxyError" , NULL, NULL );
HurricaneError = PyErr_NewException ( "hurricane.HurricaneError" , NULL, NULL );
HurricaneWarning = PyErr_NewException ( "hurricane.HurricaneWarning", PyExc_Warning, NULL );
PyDict_SetItemString ( dictionnary, "ConstructorError", ConstructorError );
PyDict_SetItemString ( dictionnary, "ProxyError" , ProxyError );
PyDict_SetItemString ( dictionnary, "HurricaneError" , HurricaneError );
TransformationLoadConstants ( dictionnary );
NetLoadConstants ( dictionnary );
InstanceLoadConstants ( dictionnary );
PinLoadConstants ( dictionnary );
}
} // End of extern "C".
# endif // End of Python Module Code Part.
} // End of Isobar namespace.

View File

@ -0,0 +1,846 @@
// -*- 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é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: PyHurricane.h,v 1.41 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 : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
// | =============================================================== |
// | C++ Header : "./PyHurricane.h" |
// | *************************************************************** |
// | U p d a t e s |
// | Damien DUPUIS 26/04/2005 |
// | |
// x-----------------------------------------------------------------x
#ifndef __PYHURRICANE__
#define __PYHURRICANE__
#include "Python.h"
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include "Error.h"
#include "Warning.h"
#include "ProxyProperty.h"
namespace Isobar {
#if PY_VERSION_HEX < 0x02040000
#define Py_RETURN_NONE return Py_INCREF(Py_None), Py_None
#endif
using namespace std;
// -------------------------------------------------------------------
// Class : "::ConverterState".
class ConverterState {
public:
struct ObjectType {
static char* _inheritStop;
char _id [11];
char _idBase[11];
PyTypeObject* _pyType;
char* _name;
bool _isPythonType;
unsigned _index;
bool PyEqual ( PyTypeObject* pyType );
ObjectType* PyBase ();
ObjectType* PyBase ( PyTypeObject* pyType );
char* PyBaseId ( PyTypeObject* pyType );
};
typedef vector<ObjectType*> ObjectTypeVector;
protected: string _objectIds;
protected: char* _function;
protected: ObjectTypeVector _types;
public: ConverterState () : _objectIds("")
, _function("<NoFunction>")
, _types()
{ }
public: ~ConverterState ();
public: ObjectType* GetObject ( char* id );
public: char* GetObjectId ( PyObject* object );
public: char* GetObjectName ( string id );
public: string GetObjectIds () const { return ( _objectIds ); };
public: char* GetFunction () const { return ( _function ); };
public: int GetSize () const { return ( _objectIds.size() ); };
public: const ObjectTypeVector& GetTypes () const { return ( _types ); };
public: void AddObject ( PyObject* object ) { _objectIds += GetObjectId ( object ); };
public: void AddId ( char* id ) { _objectIds += ":"; _objectIds += id; };
public: void SetFunction ( char* function ) { _function = function; };
public: void Init ( char* function, char* inheritStop="comp" );
public: void AddType ( char* id, PyTypeObject* pyType, char* name, bool isPythonType, char* idBase="" );
public: static string GetObjectType ( string objectsTypes, unsigned n );
};
// -------------------------------------------------------------------
// Isobar Global Functions.
int Converter ( PyObject* object, void** pArg );
bool ParseOneArg ( char* function, PyObject* args, string format, PyObject** arg );
bool ParseTwoArg ( char* function, PyObject* args, string format, PyObject** arg0, PyObject** arg1 );
bool ParseThreeArg ( char* function, PyObject* args, string format, PyObject** arg0, PyObject** arg1, PyObject** arg2 );
// -------------------------------------------------------------------
// Isobar Global variables.
extern ConverterState __cs;
extern int __objectOffset;
extern "C" {
extern PyObject* ConstructorError;
extern PyObject* ProxyError;
extern PyObject* HurricaneError;
extern PyObject* HurricaneWarning;
extern PyObject* CoriolisError;
// -------------------------------------------------------------------
// Defines arguments strings
#define NO_ARG ""
#define BOX_ARG ":box"
#define CELL_ARG ":ent"
#define POINT_ARG ":point"
#define POINTS2_ARG ":point:point"
#define POINT_INT_ARG ":point:int"
#define INT_ARG ":int"
#define INTS2_ARG ":int:int"
#define INTS3_ARG ":int:int:int"
#define INTS4_ARG ":int:int:int:int"
#define INTS2_FUNCTION_ARG ":int:int:function"
#define FLOAT_ARG ":float"
#define BOOL_ARG ":bool"
#define NAME_ARG ":name"
#define INSTANCE_ARG ":ent"
#define HOOK_ARG ":hook"
#define TRANS_ARG ":transfo"
#define STRING_ARG ":string"
#define STRING_CELL_ARG ":string:ent"
#define NET_ARG ":ent"
#define NET_NAME_ARG ":ent:name"
#define NET_LAYER_INT_ARG ":ent:layer:int"
#define NET_LAYER_INTS2_ARG ":ent:layer:int:int"
#define NET_LAYER_INTS3_ARG ":ent:layer:int:int:int"
#define NET_LAYER_INTS4_ARG ":ent:layer:int:int:int:int"
#define COMP_LAYER_INTS2_ARG ":comp:layer:int:int"
#define COMP_LAYER_INTS3_ARG ":comp:layer:int:int:int"
#define COMP_LAYER_INTS4_ARG ":comp:layer:int:int:int:int"
#define COMPS2_LAYER_INT_ARG ":comp:comp:layer:int"
#define COMPS2_LAYER_INTS2_ARG ":comp:comp:layer:int:int"
#define COMPS2_LAYER_INTS3_ARG ":comp:comp:layer:int:int:int"
#define COMPS2_LAYER_INTS4_ARG ":comp:comp:layer:int:int:int:int"
#define CELL_BOX_ARG ":ent:box"
#define CELL_INT_ARG ":ent:int"
#define CELL_NAME_ARG ":ent:name"
#define CELL_NAME_CELL_ARG ":ent:name:ent"
#define CELL_NAME_CELL_TRANS_ARG ":ent:name:ent:transfo"
#define CELL_NAME_INTS2_ARG ":ent:name:int:int"
#define CELL_NAME_POINT_ARG ":ent:name:point"
#define INST_ARG ":ent"
#define INST_PATH_ARG ":ent:path"
#define PATH_INST_ARG ":path:ent"
#define CELL_STRING_ARG ":ent:string"
#define ENT_ARG ":ent"
#define ENT_PATH_ARG ":ent:path"
#define COMP_PATH_ARG ":comp:path"
// -------------------------------------------------------------------
// Miscellaneous.
# define DEFERRED_ADDRESS(ADDR) 0
// This macro must be redefined in derived classes.
// Example : _baseOject._object
# define ACCESS_OBJECT _object
# define ACCESS_CLASS(_pyObject) _pyObject
# define LOAD_CONSTANT(CONSTANT_VALUE,CONSTANT_NAME) \
constant = PyInt_FromLong ( (long)CONSTANT_VALUE ); \
PyDict_SetItemString ( dictionnary, CONSTANT_NAME, constant ); \
Py_DECREF ( constant );
// -------------------------------------------------------------------
// Generic Method Header.
# define GENERIC_METHOD_HEAD(SELF_TYPE,SELF_OBJECT,function) \
if ( self->ACCESS_OBJECT == NULL ) { \
PyErr_SetString ( ProxyError, "Attempt to call " function " on an unbound hurricane object" ); \
return ( NULL ); \
} \
SELF_TYPE* SELF_OBJECT = dynamic_cast<SELF_TYPE*>(self->ACCESS_OBJECT); \
if ( self->ACCESS_OBJECT == NULL ) { \
PyErr_SetString ( ProxyError, "Invalid dynamic_cast while calling " function "" ); \
return ( NULL ); \
}
// -------------------------------------------------------------------
// Attribute Method Macro For Checking Bound.
# define GetBoundStateAttribute(PY_FUNC_NAME,PY_SELF_TYPE,SELF_TYPE) \
static PyObject* PY_FUNC_NAME ( PY_SELF_TYPE *self ) \
{ \
long result = 1; \
if ( self->ACCESS_OBJECT == NULL ) result = 0; \
\
return ( Py_BuildValue ("i",result) ); \
}
// -------------------------------------------------------------------
// Attribute Method Macro For Booleans.
# define DirectGetBoolAttribute(PY_FUNC_NAME,FUNC_NAME,PY_SELF_TYPE,SELF_TYPE) \
static PyObject* PY_FUNC_NAME ( PY_SELF_TYPE *self, PyObject* args ) \
{ \
GENERIC_METHOD_HEAD(SELF_TYPE,cobject,"DirectGetBoolAttribute()") \
return ( Py_BuildValue ("i",cobject->FUNC_NAME()) ); \
}
// -------------------------------------------------------------------
// Attribute Method Macro For Long.
# define DirectGetLongAttribute(PY_FUNC_NAME,FUNC_NAME,PY_SELF_TYPE,SELF_TYPE) \
static PyObject* PY_FUNC_NAME ( PY_SELF_TYPE *self, PyObject* args ) \
{ \
GENERIC_METHOD_HEAD(SELF_TYPE,cobject,"DirectGetLongAttribute()") \
return ( Py_BuildValue ("l",cobject->FUNC_NAME()) ); \
}
// -------------------------------------------------------------------
// Attribute Method Macro For Double.
# define DirectGetDoubleAttribute(PY_FUNC_NAME,FUNC_NAME,PY_SELF_TYPE,SELF_TYPE) \
static PyObject* PY_FUNC_NAME ( PY_SELF_TYPE *self, PyObject* args ) \
{ \
GENERIC_METHOD_HEAD(SELF_TYPE,cobject,"DirectGetDoubleAttribute()") \
return ( Py_BuildValue ("d",cobject->FUNC_NAME()) ); \
}
// -------------------------------------------------------------------
// Attribute Method Macro For Long.
# define DirectSetLongAttribute(PY_FUNC_NAME,FUNC_NAME,PY_FORMAT,PY_SELF_TYPE,SELF_TYPE) \
static PyObject* PY_FUNC_NAME ( PY_SELF_TYPE *self, PyObject* args ) \
{ \
GENERIC_METHOD_HEAD(SELF_TYPE,cobject,"DirectSetLongAttribute()") \
\
PyObject* arg0; \
if ( ! PyArg_ParseTuple ( args, "O:" PY_FORMAT, &arg0 ) ) \
return ( NULL ); \
cobject->FUNC_NAME ( PyInt_AsLong(arg0) ); \
\
Py_RETURN_NONE; \
}
// -------------------------------------------------------------------
// Attribute Macro For Deletion.
# define DirectDeleteAttribute(PY_FUNC_NAME,PY_SELF_TYPE) \
static PyObject* PY_FUNC_NAME ( PY_SELF_TYPE *self, PyObject* args ) \
{ \
if ( self->ACCESS_OBJECT != NULL ) { \
delete self->ACCESS_OBJECT; \
self->ACCESS_OBJECT = NULL; \
} \
\
Py_RETURN_NONE; \
}
// -------------------------------------------------------------------
// Attribute Method For Deletion.
# define DirectDeleteMethod(PY_FUNC_NAME,PY_SELF_TYPE) \
static void PY_FUNC_NAME ( PY_SELF_TYPE *self ) \
{ \
trace << "PyHObject_DeAlloc(" << hex << self << ") " \
<< self->ACCESS_OBJECT << endl; \
\
if ( self->ACCESS_OBJECT ) delete self->ACCESS_OBJECT; \
PyObject_DEL ( self ); \
}
// -------------------------------------------------------------------
// Attribute Method For Deletion.
# define PlugDeleteMethod(PY_FUNC_NAME,PY_SELF_TYPE) \
static void PY_FUNC_NAME ( PY_SELF_TYPE *self ) \
{ \
trace << "PyHObject_DeAlloc(" << hex << self << ") " \
<< self->ACCESS_OBJECT << endl; \
\
PyObject_DEL ( self ); \
}
// -------------------------------------------------------------------
// Attribute Method For Getting Attributes.
# define DirectGetAttrMethod(PY_FUNC_NAME,PY_OBJECT_METHODS) \
static PyObject* PY_FUNC_NAME ( PyObject* self, char* name ) \
{ \
return ( Py_FindMethod(PY_OBJECT_METHODS,self,name) ); \
}
// -------------------------------------------------------------------
// Attribute Method For void methods.
#define DirectVoidMethod(SELF_TYPE, SELF_OBJECT, FUNC_NAME) \
static PyObject* Py##SELF_TYPE##_##FUNC_NAME(Py##SELF_TYPE* self) \
{ \
trace << "Py" #SELF_TYPE "_" #FUNC_NAME "()" << endl; \
HTRY \
METHOD_HEAD(#SELF_TYPE "." #FUNC_NAME "()") \
SELF_OBJECT->FUNC_NAME(); \
HCATCH \
Py_RETURN_NONE; \
}
// -------------------------------------------------------------------
// Locator Attribute Method For Progress.
# define LocatorProgressAttribute(SELF_TYPE) \
static PyObject* Py##SELF_TYPE##Locator_Progress ( Py##SELF_TYPE##Locator *self ) \
{ \
trace << #SELF_TYPE "Locator.Progress()" << endl; \
METHOD_HEAD ( #SELF_TYPE "Locator.Progress()" ) \
\
HTRY \
locator->Progress (); \
HCATCH \
\
Py_RETURN_NONE; \
}
// -------------------------------------------------------------------
// Locator Attribute Method For GetElement.
# define LocatorGetElementAttribute(SELF_TYPE) \
static PyObject* Py##SELF_TYPE##Locator_GetElement ( Py##SELF_TYPE##Locator *self ) \
{ \
trace << #SELF_TYPE "Locator.GetElement()" << endl; \
METHOD_HEAD ( #SELF_TYPE "Locator.GetElement()" ) \
\
SELF_TYPE* element = NULL; \
\
HTRY \
element = locator->GetElement (); \
HCATCH \
\
return Py##SELF_TYPE##_Link ( element ); \
}
// -------------------------------------------------------------------
// Locator Attribute Method For GetElement (element is PyEntity).
# define LocatorGetElementEntityAttribute(SELF_TYPE) \
static PyObject* Py##SELF_TYPE##Locator_GetElement ( Py##SELF_TYPE##Locator *self ) \
{ \
trace << #SELF_TYPE "Locator.GetElement()" << endl; \
METHOD_HEAD ( #SELF_TYPE "Locator.GetElement()" ) \
\
PyObject* pyElement = NULL; \
\
HTRY \
SELF_TYPE* element = locator->GetElement (); \
if ( element == NULL ) \
Py_RETURN_NONE; \
pyElement = PyEntity_NEW ( element ); \
HCATCH \
\
return pyElement; \
}
// -------------------------------------------------------------------
// Locator Attribute Method For GetClone.
# define LocatorGetCloneAttribute(SELF_TYPE) \
static PyObject* Py##SELF_TYPE##Locator_GetClone ( Py##SELF_TYPE##Locator *self ) \
{ \
trace << #SELF_TYPE "Locator.GetClone()" << endl; \
METHOD_HEAD ( #SELF_TYPE "Locator.GetClone()" ) \
\
Py##SELF_TYPE##Locator* cloneLocator = NULL; \
\
HTRY \
cloneLocator = PyObject_NEW ( Py##SELF_TYPE##Locator, &PyType##SELF_TYPE##Locator ); \
if (cloneLocator == NULL) { return NULL; } \
\
cloneLocator->_object = locator->GetClone(); \
HCATCH \
\
return ( (PyObject*)cloneLocator ); \
}
// -------------------------------------------------------------------
// Attribute Method For Repr.
# define DirectReprMethod(PY_FUNC_NAME,PY_SELF_TYPE,SELF_TYPE) \
static PyObject* PY_FUNC_NAME ( PY_SELF_TYPE *self ) \
{ \
if ( self->ACCESS_OBJECT == NULL ) \
return ( PyString_FromString("<PyObject unbound>") ); \
SELF_TYPE* object = dynamic_cast<SELF_TYPE*>(self->ACCESS_OBJECT); \
if ( object == NULL ) \
return ( PyString_FromString("<PyObject invalid dynamic-cast>") ); \
\
ostringstream repr; \
repr << "[" << hex << self << "<->" << (void*)object << " " << GetString(object) << "]"; \
\
return ( PyString_FromString(repr.str().c_str()) ); \
}
// -------------------------------------------------------------------
// Attribute Method For Str.
# define DirectStrMethod(PY_FUNC_NAME,PY_SELF_TYPE,SELF_TYPE) \
static PyObject* PY_FUNC_NAME ( PY_SELF_TYPE *self ) \
{ \
if ( self->ACCESS_OBJECT == NULL ) \
return ( PyString_FromString("<PyObject unbound>") ); \
SELF_TYPE* object = dynamic_cast<SELF_TYPE*>(self->ACCESS_OBJECT); \
if ( object == NULL ) \
return ( PyString_FromString("<PyObject invalid dynamic_cast>") ); \
\
return ( PyString_FromString(GetString(object).c_str()) ); \
}
// -------------------------------------------------------------------
// Attribute Method For Cmp.
# define DirectCmpMethod(PY_FUNC_NAME,IS_PY_OBJECT,PY_SELF_TYPE) \
static int PY_FUNC_NAME ( PY_SELF_TYPE *self, PyObject* other ) \
{ \
if ( ! IS_PY_OBJECT(other) ) { return ( -1 ); } \
\
PY_SELF_TYPE* otherPyObject = (PY_SELF_TYPE *)other; \
if ( self->ACCESS_OBJECT == otherPyObject->ACCESS_OBJECT ) return ( 0 ); \
if ( self->ACCESS_OBJECT < otherPyObject->ACCESS_OBJECT ) return ( -1 ); \
\
return ( 1 ); \
}
// -------------------------------------------------------------------
// Attribute Method For Hash.
# define DirectHashMethod(PY_FUNC_NAME,PY_SELF_TYPE) \
static int PY_FUNC_NAME ( PY_SELF_TYPE *self) \
{ \
return (long)self->ACCESS_OBJECT; \
}
// -------------------------------------------------------------------
// Attribute Macro For DBo Deletion.
# define DBoDeleteAttribute(PY_FUNC_NAME,PY_SELF_TYPE) \
static PyObject* PY_FUNC_NAME ( PY_SELF_TYPE *self ) \
{ \
HTRY \
if ( self->ACCESS_OBJECT == NULL ) { \
ostringstream message; \
message << "applying a Delete to a Python object with no HURRICANE object attached"; \
PyErr_SetString ( ProxyError, message.str().c_str() ); \
return ( NULL ); \
} \
ProxyProperty* proxy = dynamic_cast<ProxyProperty*> \
( self->ACCESS_OBJECT->GetProperty ( ProxyProperty::GetPropertyName() ) ); \
if (proxy == NULL) { \
ostringstream message; \
message << "Trying to Delete a Hurricane object of with no Proxy attached "; \
PyErr_SetString ( ProxyError, message.str().c_str() ); \
return ( NULL ); \
} \
self->ACCESS_OBJECT->Delete (); \
HCATCH \
Py_RETURN_NONE; \
}
// -------------------------------------------------------------------
// Attribute Macro For BDo Link/Creation.
# define DBoLinkCreateMethod(PY_FUNC_NAME,PY_SELF_TYPE,PY_SELF_CLASS,SELF_TYPE) \
PyObject* PY_FUNC_NAME ( SELF_TYPE* object ) \
{ \
if ( object == NULL ) \
Py_RETURN_NONE; \
PY_SELF_TYPE* pyObject = NULL; \
HTRY \
ProxyProperty* proxy = dynamic_cast<ProxyProperty*> \
( object->GetProperty ( ProxyProperty::GetPropertyName() ) ); \
if ( proxy == NULL ) { \
pyObject = PyObject_NEW(PY_SELF_TYPE, &PY_SELF_CLASS); \
if (pyObject == NULL) { return NULL; } \
\
proxy = ProxyProperty::Create ( (void*)pyObject ); \
CHECK_OFFSET ( pyObject ) \
\
pyObject->ACCESS_OBJECT = object; \
object->Put ( proxy ); \
} else { \
pyObject = (PY_SELF_TYPE*)proxy->GetShadow (); \
Py_INCREF ( ACCESS_CLASS(pyObject) ); \
} \
HCATCH \
\
return ( (PyObject*)pyObject ); \
}
// -------------------------------------------------------------------
// Attribute Method For BDo Deletion.
# define DBoDeleteMethod(SELF_TYPE) \
static void Py##SELF_TYPE##_DeAlloc ( Py##SELF_TYPE *self ) \
{ \
trace << "PyDbObject_DeAlloc(" << hex << self << ") " \
<< self->ACCESS_OBJECT << endl; \
\
if ( self->ACCESS_OBJECT != NULL ) { \
ProxyProperty* proxy = dynamic_cast<ProxyProperty*> \
( self->ACCESS_OBJECT->GetProperty ( ProxyProperty::GetPropertyName() ) ); \
if (proxy == NULL) { \
ostringstream message; \
message << "deleting a Python object with no Proxy attached "; \
PyErr_SetString ( ProxyError, message.str().c_str() ); \
} \
self->ACCESS_OBJECT->Remove ( proxy ); \
} \
PyObject_DEL ( self ); \
}
// -------------------------------------------------------------------
// Initialisation Function for PyTypeObject Runtime Link.
#define PyTypeObjectLinkPyType(SELF_TYPE) \
DirectReprMethod(Py##SELF_TYPE##_Repr, Py##SELF_TYPE, SELF_TYPE) \
DirectStrMethod (Py##SELF_TYPE##_Str, Py##SELF_TYPE, SELF_TYPE) \
DirectCmpMethod (Py##SELF_TYPE##_Cmp, IsPy##SELF_TYPE, Py##SELF_TYPE) \
DirectHashMethod(Py##SELF_TYPE##_Hash, Py##SELF_TYPE) \
extern void Py##SELF_TYPE##_LinkPyType() { \
trace << "Py" #SELF_TYPE "_LinkType()" << endl; \
\
PyType##SELF_TYPE.tp_dealloc = (destructor)Py##SELF_TYPE##_DeAlloc; \
PyType##SELF_TYPE.tp_compare = (cmpfunc) Py##SELF_TYPE##_Cmp; \
PyType##SELF_TYPE.tp_repr = (reprfunc) Py##SELF_TYPE##_Repr; \
PyType##SELF_TYPE.tp_str = (reprfunc) Py##SELF_TYPE##_Str; \
PyType##SELF_TYPE.tp_hash = (hashfunc) Py##SELF_TYPE##_Hash; \
PyType##SELF_TYPE.tp_methods = Py##SELF_TYPE##_Methods; \
}
// -------------------------------------------------------------------
// Initialisation Function for PyTypeObject Runtime Link.
// Special method to add constructor new function
#define PyTypeObjectConstructor(SELF_TYPE) \
extern void Py##SELF_TYPE##_Constructor() { \
trace << "Py" #SELF_TYPE "_Constructor()" << endl; \
\
PyType##SELF_TYPE.tp_new = Py##SELF_TYPE##_new; \
}
// Special Initialisation Function for Locator PyTypeObject Runtime Link.
#define LocatorPyTypeObjectLinkPyType(PY_SELF_TYPE, SELF_TYPE) \
DirectReprMethod(Py##PY_SELF_TYPE##Locator_Repr, Py##PY_SELF_TYPE##Locator, Locator<SELF_TYPE>) \
DirectStrMethod (Py##PY_SELF_TYPE##Locator_Str, Py##PY_SELF_TYPE##Locator, Locator<SELF_TYPE>) \
DirectCmpMethod (Py##PY_SELF_TYPE##Locator_Cmp, IsPy##PY_SELF_TYPE##Locator, Py##PY_SELF_TYPE##Locator) \
extern void Py##PY_SELF_TYPE##Locator_LinkPyType () \
{ \
trace << "Py" #PY_SELF_TYPE "Locator_LinkType()" << endl; \
\
PyType##PY_SELF_TYPE##Locator.tp_dealloc = (destructor)Py##PY_SELF_TYPE##Locator_DeAlloc; \
PyType##PY_SELF_TYPE##Locator.tp_compare = (cmpfunc) Py##PY_SELF_TYPE##Locator_Cmp; \
PyType##PY_SELF_TYPE##Locator.tp_repr = (reprfunc) Py##PY_SELF_TYPE##Locator_Repr; \
PyType##PY_SELF_TYPE##Locator.tp_str = (reprfunc) Py##PY_SELF_TYPE##Locator_Str; \
PyType##PY_SELF_TYPE##Locator.tp_methods = Py##PY_SELF_TYPE##Locator_Methods; \
}
// -------------------------------------------------------------------
// CEngine Initialization
#define CEngineModuleInitialization(CENGINE) \
DL_EXPORT(void) init##CENGINE () { \
trace << "init" #CENGINE "()" << endl; \
Py##CENGINE##_LinkPyType (); \
PYTYPE_READY_SUB ( CENGINE, CEngine ) \
__cs.AddType ( #CENGINE, &PyType##CENGINE, "<" #CENGINE ">", false, "cengine" ); \
PyObject* module = Py_InitModule(#CENGINE, Py##CENGINE##Module_Methods); \
if ( module == NULL ) { \
cerr << "[ERROR]\n" \
<< " Failed to initialize " #CENGINE " module." << endl; \
} \
}
// -------------------------------------------------------------------
// Direct GetCEngine() Method (no argument)
#define DirectGetCEngine(CENGINE) \
PyObject* Py##CENGINE##_Get##CENGINE ( PyObject* module, PyObject* args ) \
{ \
PyObject* arg0; \
CENGINE* cengine = NULL; \
HTRY \
if (!ParseOneArg("Get" #CENGINE, args, CELL_ARG, &arg0 ) ) return ( NULL ); \
Cell* cell = PYCELL_O(arg0); \
cengine = dynamic_cast<CENGINE*>(GetCEngine(cell, Name(#CENGINE))); \
if (!cengine) { \
cengine = CENGINE::Create (cell); \
} \
HCATCH \
return Py##CENGINE##_Link( cengine ); \
}
// -------------------------------------------------------------------
// Object Definitions for inherited types
// root of the inheritance tree
# define PyTypeRootObjectDefinitions(SELF_TYPE) \
PyTypeObject PyType##SELF_TYPE = \
{ PyObject_HEAD_INIT(&PyType_Type) \
0 /* ob_size. */ \
, #SELF_TYPE /* tp_name. */ \
, sizeof(Py##SELF_TYPE) /* tp_basicsize. */ \
, 0 /* tp_itemsize. */ \
/* methods. */ \
, 0 /* tp_dealloc. */ \
, 0 /* tp_print. */ \
, 0 /* tp_getattr. */ \
, 0 /* tp_setattr. */ \
, 0 /* tp_compare. */ \
, 0 /* tp_repr. */ \
, 0 /* tp_as_number. */ \
, 0 /* tp_as_sequence. */ \
, 0 /* tp_as_mapping. */ \
, 0 /* tp_hash. */ \
, 0 /* tp_call. */ \
, 0 /* tp_str */ \
, 0 /* tp_getattro. */ \
, 0 /* tp_setattro. */ \
, 0 /* tp_as_buffer. */ \
, Py_TPFLAGS_DEFAULT \
| Py_TPFLAGS_BASETYPE /* tp_flags. */ \
, 0 /* tp_doc. */ \
, 0 /* tp_traverse. */ \
, 0 /* tp_clear. */ \
, 0 /* tp_richcompare. */ \
, 0 /* tp_weaklistoffset.*/ \
, 0 /* tp_iter. */ \
, 0 /* tp_iternext. */ \
, 0 /* tp_methods. */ \
, 0 /* tp_members. */ \
, 0 /* tp_getset. */ \
, 0 /* tp_base. */ \
, 0 /* tp_dict. */ \
, 0 /* tp_descr_get. */ \
, 0 /* tp_descr_set. */ \
, 0 /* tp_dictoffset. */ \
, 0 /* tp_init. */ \
, 0 /* tp_alloc. */ \
, 0 /* tp_new. */ \
, 0 /* tp_free. */ \
, 0 /* tp_is_gc. */ \
};
// -------------------------------------------------------------------
// Object Definitions for types with inheritance (from Inherited or Root)
# define PyTypeInheritedObjectDefinitions(SELF_TYPE, INHERITED_TYPE) \
PyTypeObject PyType##SELF_TYPE = \
{ PyObject_HEAD_INIT(DEFERRED_ADDRESS(&PyType##INHERITED_TYPE)) \
0 /* ob_size. */ \
, #SELF_TYPE /* tp_name. */ \
, sizeof(Py##SELF_TYPE) /* tp_basicsize. */ \
, 0 /* tp_itemsize. */ \
/* methods. */ \
, 0 /* tp_dealloc. */ \
, 0 /* tp_print. */ \
, 0 /* tp_getattr. */ \
, 0 /* tp_setattr. */ \
, 0 /* tp_compare. */ \
, 0 /* tp_repr. */ \
, 0 /* tp_as_number. */ \
, 0 /* tp_as_sequence. */ \
, 0 /* tp_as_mapping. */ \
, 0 /* tp_hash. */ \
, 0 /* tp_call. */ \
, 0 /* tp_str */ \
, 0 /* tp_getattro. */ \
, 0 /* tp_setattro. */ \
, 0 /* tp_as_buffer. */ \
, Py_TPFLAGS_DEFAULT \
| Py_TPFLAGS_BASETYPE /* tp_flags. */ \
, 0 /* tp_doc. */ \
, 0 /* tp_traverse. */ \
, 0 /* tp_clear. */ \
, 0 /* tp_richcompare. */ \
, 0 /* tp_weaklistoffset.*/ \
, 0 /* tp_iter. */ \
, 0 /* tp_iternext. */ \
, 0 /* tp_methods. */ \
, 0 /* tp_members. */ \
, 0 /* tp_getset. */ \
, DEFERRED_ADDRESS(&PyType##INHERITED_TYPE) \
/* tp_base. */ \
, 0 /* tp_dict. */ \
, 0 /* tp_descr_get. */ \
, 0 /* tp_descr_set. */ \
, 0 /* tp_dictoffset. */ \
, 0 /* tp_init. */ \
, 0 /* tp_alloc. */ \
, 0 /* tp_new. */ \
, 0 /* tp_free. */ \
, 0 /* tp_is_gc. */ \
};
// -------------------------------------------------------------------
//PyType_Ready Methods
# define PYTYPE_READY(TYPE) \
if ( PyType_Ready( &PyType##TYPE ) < 0 ) { \
cerr << "[ERROR]\n" \
<< " Failed to initialize <Py" #TYPE ">." << endl; \
return; \
}
# define PYTYPE_READY_SUB(TYPE, TYPE_BASE) \
PyType##TYPE.tp_base = &PyType##TYPE_BASE; \
if ( PyType_Ready( &PyType##TYPE ) < 0 ) { \
cerr << "[ERROR]\n" \
<< " Failed to initialize <Py" #TYPE ">." << endl; \
return; \
}
// -------------------------------------------------------------------
// Hurricane Try / Catch.
# define HTRY try {
# define HCATCH \
} \
catch ( Error& e ) { \
PyErr_SetString ( HurricaneError, GetString(e).c_str() ); \
return ( NULL ); \
} \
catch ( Warning& w ) { \
PyErr_Warn ( HurricaneWarning, const_cast<char*>(GetString(w).c_str()) ); \
}
} // End of extern "C".
} // End of Isobar namespace.
# endif

View File

@ -0,0 +1,221 @@
// -*- 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é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 |
// | =============================================================== |
// | C++ Module : "./PyHyperNet.cpp" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
# include "PyHyperNet.h"
# include "PyCell.h"
# include "PyOccurrence.h"
# include "PyOccurrenceLocator.h"
USING_NAMESPACE_HURRICANE
namespace Isobar {
USING_NAMESPACE_HURRICANE
extern "C" {
# 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
// Standart Predicates (Attributes).
DirectGetBoolAttribute(PyHyperNet_IsValid ,IsValid ,PyHyperNet,HyperNet)
// Standart Delete (Attribute).
DirectDeleteAttribute(PyHyperNet_Delete,PyHyperNet)
// ---------------------------------------------------------------
// Attribute Method : "PyHyperNet_GetPlugsLocator ()"
static PyObject* PyHyperNet_GetLeafPlugOccurrenceLocator ( PyHyperNet *self )
{
trace << "PyHyperNet_GetLeafPlugOccurrenceLocator ()" << endl;
METHOD_HEAD ( "HyperNet.GetLeafPlugOccurrenceLocator()" )
Occurrences occurrences = hyperNet->GetLeafPlugOccurrences ();
PyOccurrenceLocator* pyOccurrenceLocator = PyObject_NEW ( PyOccurrenceLocator, &PyTypeOccurrenceLocator );
if (pyOccurrenceLocator == NULL) { return NULL; }
trace_in ();
trace << "new PyOccurrenceLocator [" << hex << pyOccurrenceLocator << "]" << endl;
trace_out ();
HTRY
pyOccurrenceLocator->_object = occurrences.GetLocator ();
HCATCH
return ( (PyObject*)pyOccurrenceLocator );
}
// ---------------------------------------------------------------
// Attribute Method : "PyHyperNet_GetCell ()"
static PyObject* PyHyperNet_GetCell ( PyHyperNet *self )
{
trace << "PyHyperNet_GetCell ()" << endl;
Cell* cell = NULL;
HTRY
METHOD_HEAD ( "HyperNet.GetCell()" )
cell = hyperNet->GetCell ();
HCATCH
return PyCell_Link ( cell );
}
// ---------------------------------------------------------------
// 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." }
, { "GetLeafPlugOccurrenceLocator", (PyCFunction)PyHyperNet_GetLeafPlugOccurrenceLocator, METH_NOARGS
, "Returns the collection of leaf occurrences" }
, { "Delete" , (PyCFunction)PyHyperNet_Delete , METH_NOARGS
, "Delete associated hurricane object, the python object remains." }
, {NULL, NULL, 0, NULL} /* sentinel */
};
// x-------------------------------------------------------------x
// | "PyHyperNet" Object Methods |
// x-------------------------------------------------------------x
// ---------------------------------------------------------------
// Attribute Method : "PyHyperNet_Create ()"
static PyObject* PyHyperNet_new(PyTypeObject *type, PyObject *args, PyObject *kwds) {
trace << "PyHyperNet_new()" << endl;
HyperNet* hyperNet = NULL;
PyObject* arg0;
if ( ! ParseOneArg ( "HyperNet.new()", args, ":occur", &arg0 ) ) return ( NULL );
hyperNet = new HyperNet ( *PYOCCURRENCE_O(arg0) );
PyHyperNet* pyHyperNet;
pyHyperNet = PyObject_NEW(PyHyperNet, &PyTypeHyperNet);
if (pyHyperNet == NULL) return NULL;
HTRY
pyHyperNet->_object = hyperNet;
HCATCH
return ( (PyObject*)pyHyperNet );
}
DirectDeleteMethod(PyHyperNet_DeAlloc,PyHyperNet)
PyTypeObjectLinkPyType(HyperNet)
PyTypeObjectConstructor(HyperNet)
# else // End of Python Module Code Part.
// x=================================================================x
// | "PyHyperNet" Shared Library Code Part |
// x=================================================================x
// ---------------------------------------------------------------
// PyHyperNet Object Definitions.
PyTypeRootObjectDefinitions(HyperNet)
# endif // End of Shared Library Code Part.
} // End of extern "C".
} // End of Isobar namespace.

View File

@ -0,0 +1,104 @@
// -*- 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é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.h,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 |
// | =============================================================== |
// | C++ Header : "./PyHyperNet.h" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#ifndef __PYHYPERNET__
#define __PYHYPERNET__
#include "PyHurricane.h"
#include "PyPlugLocator.h"
#include "HyperNet.h"
namespace Isobar {
extern "C" {
// -------------------------------------------------------------------
// Python Object : "PyHyperNet".
typedef struct {
PyObject_HEAD
Hurricane::HyperNet* _object;
} PyHyperNet;
// -------------------------------------------------------------------
// Functions & Types exported to "PyHurricane.ccp".
extern PyTypeObject PyTypeHyperNet;
extern PyMethodDef PyHyperNet_Methods[];
extern void PyHyperNet_LinkPyType();
extern void PyHyperNet_Constructor();
#define IsPyHyperNet(v) ( (v)->ob_type == &PyTypeHyperNet )
#define PYHYPERNET(v) ( (PyHyperNet*)(v) )
#define PYHYPERNET_O(v) ( PYHYPERNET(v)->_object )
} // End of extern "C".
} // End of Isobar namespace.
# endif

View File

@ -0,0 +1,530 @@
// -*- 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é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: PyInstance.cpp,v 1.31 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 : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
// | =============================================================== |
// | C++ Module : "./PyInstance.cpp" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#include "PyBox.h"
#include "PyName.h"
#include "PyTransformation.h"
#include "PyLibrary.h"
#include "PyCell.h"
#include "PyInstance.h"
#include "PyNet.h"
#include "PyPlug.h"
#include "PyPlugLocator.h"
namespace Isobar {
USING_NAMESPACE_HURRICANE
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(Instance,instance,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
// | "PyInstance" Python Module Code Part |
// x=================================================================x
#if defined(__PYTHON_MODULE__)
// x-------------------------------------------------------------x
// | Global Constants Loading |
// x-------------------------------------------------------------x
extern void InstanceLoadConstants ( PyObject* dictionnary )
{
PyObject* constant;
LOAD_CONSTANT ( Instance::PlacementStatus::UNPLACED, "PlacementStatusUNPLACED" )
LOAD_CONSTANT ( Instance::PlacementStatus::PLACED , "PlacementStatusPLACED" )
LOAD_CONSTANT ( Instance::PlacementStatus::FIXED , "PlacementStatusFIXED" )
}
// x-------------------------------------------------------------x
// | "PyInstance" Local Functions |
// x-------------------------------------------------------------x
// ---------------------------------------------------------------
// Local Function : "PyInt_AsType ()"
static Instance::PlacementStatus PyInt_AsPlacementStatus ( PyObject* object )
{
switch ( PyInt_AsLong(object) ) {
case Instance::PlacementStatus::UNPLACED : return ( Instance::PlacementStatus(Instance::PlacementStatus::UNPLACED) );
case Instance::PlacementStatus::PLACED : return ( Instance::PlacementStatus(Instance::PlacementStatus::PLACED) );
case Instance::PlacementStatus::FIXED : return ( Instance::PlacementStatus(Instance::PlacementStatus::FIXED) );
}
return ( Instance::PlacementStatus(Instance::PlacementStatus::UNPLACED) );
}
// x-------------------------------------------------------------x
// | "PyInstance" Attribute Methods |
// x-------------------------------------------------------------x
// Standart Accessors (Attributes).
// Standart Delete (Attribute).
DBoDeleteAttribute(PyInstance_Delete,PyInstance)
// ---------------------------------------------------------------
// Attribute Method : "PyInstance_GetName ()"
static PyObject* PyInstance_GetName ( PyInstance *self ) {
trace << "PyInstance_GetName ()" << endl;
METHOD_HEAD ( "Instance.GetName()" )
PyName* pyName = PyObject_NEW ( PyName, &PyTypeName );
if ( pyName == NULL ) { return NULL; }
HTRY
pyName->_object = new Name ( instance->GetName() );
HCATCH
return ( (PyObject*)pyName );
}
// ---------------------------------------------------------------
// Attribute Method : "PyInstance_GetMasterCell ()"
static PyObject* PyInstance_GetMasterCell ( PyInstance *self ) {
trace << "PyInstance_GetMasterCell ()" << endl;
Cell* cell = NULL;
HTRY
METHOD_HEAD ( "Instance.GetMasterCell()" )
cell = instance->GetMasterCell ();
HCATCH
return PyCell_Link ( cell );
}
// ---------------------------------------------------------------
// Attribute Method : "PyInstance_GetPlacementStatus ()"
static PyObject* PyInstance_GetPlacementStatus ( PyInstance *self ) {
trace << "PyInstance_GetPlacementStatus ()" << endl;
METHOD_HEAD ( "Instance.GetPlacementStatus()" );
PyObject* pyObject = NULL;
HTRY
pyObject = (PyObject*)Py_BuildValue("i",(long)instance->GetPlacementStatus().GetCode());
HCATCH
return pyObject;
}
// ---------------------------------------------------------------
// Attribute Method : "PyInstance_SetPlacementStatus ()"
static PyObject* PyInstance_SetPlacementStatus ( PyInstance *self, PyObject* args ) {
trace << "PyInstance_SetPlacementStatus()" << endl;
METHOD_HEAD ( "Instance.SetPlacementStatus()" )
HTRY
PyObject* arg0;
if ( ! ParseOneArg ( "Instance.SetPlacementStatus()", args, INT_ARG, (PyObject**)&arg0 ) ) return ( NULL );
instance->SetPlacementStatus ( PyInt_AsPlacementStatus(arg0) );
HCATCH
Py_RETURN_NONE;
}
// ---------------------------------------------------------------
// Attribute Method : "PyInstance_GetTransformation ()"
static PyObject* PyInstance_GetTransformation ( PyInstance *self ) {
trace << "PyInstance_GetTransformation ()" << endl;
METHOD_HEAD ( "Instance.GetTransformation()" );
PyTransformation* resultPyTransf = PyObject_NEW ( PyTransformation, &PyTypeTransformation );
if ( resultPyTransf == NULL ) { return NULL; }
HTRY
resultPyTransf->_object = new Transformation ( instance->GetTransformation () );
HCATCH
return ( (PyObject*)resultPyTransf );
}
// ---------------------------------------------------------------
// Attribute Method : "PyInstance_GetPlug ()"
static PyObject* PyInstance_GetPlug ( PyInstance *self, PyObject* args ) {
trace << "PyInstance_GetPlug ()" << endl;
Plug* plug = NULL;
HTRY
METHOD_HEAD ( "Instance.GetPlug()" )
PyNet* masterNet;
if ( ! ParseOneArg ( "Instance.GetPlug", args, NET_ARG, (PyObject**)&masterNet ) ) return ( NULL );
plug = instance->GetPlug( PYNET_O(masterNet) );
HCATCH
return PyPlug_Link ( plug );
}
// ---------------------------------------------------------------
// Attribute Method : "PyInstance_GetPlugsLocator ()"
static PyObject* PyInstance_GetPlugsLocator ( PyInstance *self ) {
trace << "PyInstance_GetPlugsLocator ()" << endl;
METHOD_HEAD ( "Instance.GetPlugsLocator()" )
PyPlugLocator* pyPlugLocator = NULL;
HTRY
Plugs plugs = instance->GetPlugs ();
pyPlugLocator = PyObject_NEW ( PyPlugLocator, &PyTypePlugLocator );
if (pyPlugLocator == NULL) { return NULL; }
pyPlugLocator->_object = plugs.GetLocator ();
HCATCH
return ( (PyObject*)pyPlugLocator );
}
// ---------------------------------------------------------------
// Attribute Method : "PyInstance_GetConnectedPlugsLocator ()"
static PyObject* PyInstance_GetConnectedPlugsLocator ( PyInstance *self )
{
trace << "PyInstance_GetConnectedPlugsLocator ()" << endl;
METHOD_HEAD ( "Instance.GetConnectedPlugsLocator()" )
PyPlugLocator* pyPlugLocator = NULL;
HTRY
Plugs plugs = instance->GetConnectedPlugs ();
pyPlugLocator = PyObject_NEW ( PyPlugLocator, &PyTypePlugLocator );
if (pyPlugLocator == NULL) { return NULL; }
pyPlugLocator->_object = plugs.GetLocator ();
HCATCH
return ( (PyObject*)pyPlugLocator );
}
// ---------------------------------------------------------------
// Attribute Method : "PyInstance_GetUnconnectedPlugsLocator ()"
static PyObject* PyInstance_GetUnconnectedPlugsLocator ( PyInstance *self )
{
trace << "PyInstance_GetUnconnectedPlugsLocator ()" << endl;
METHOD_HEAD ( "Instance.GetUnconnectedPlugsLocator()" )
PyPlugLocator* pyPlugLocator = NULL;
HTRY
Plugs plugs = instance->GetUnconnectedPlugs ();
pyPlugLocator = PyObject_NEW ( PyPlugLocator, &PyTypePlugLocator );
if (pyPlugLocator == NULL) { return NULL; }
pyPlugLocator->_object = plugs.GetLocator ();
HCATCH
return ( (PyObject*)pyPlugLocator );
}
// ---------------------------------------------------------------
// Attribute Method : "PyInstance_GetAbutmentBox ()"
static PyObject* PyInstance_GetAbutmentBox ( PyInstance *self )
{
trace << "PyInstance_GetAbutmentBox ()" << endl;
METHOD_HEAD ( "Instance.GetAbutmentBox()" )
PyBox* pyBox = PyObject_NEW ( PyBox, &PyTypeBox );
if (pyBox == NULL) { return NULL; }
HTRY
pyBox->_object = new Box ( instance->GetAbutmentBox() );
HCATCH
return ( (PyObject*)pyBox );
}
// ---------------------------------------------------------------
// Attribute Method : "PyInstance_SetName ()"
static PyObject* PyInstance_SetName ( PyInstance *self, PyObject* args )
{
trace << "PyInstance_SetName()" << endl;
METHOD_HEAD ( "Instance.SetName()" )
HTRY
PyName* name;
if ( ! ParseOneArg ( "Instance.SetName", args, NAME_ARG, (PyObject**)&name ) ) return ( NULL );
instance->SetName ( *PYNAME_O(name) );
HCATCH
Py_RETURN_NONE;
}
// ---------------------------------------------------------------
// Attribute Method : "PyInstance_SetTransformation ()"
static PyObject* PyInstance_SetTransformation ( PyInstance *self, PyObject* args )
{
trace << "PyInstance_SetTransformation()" << endl;
METHOD_HEAD ( "Instance.SetTransformation()" )
HTRY
PyTransformation* transformation;
if ( ! ParseOneArg ( "Instance.SetTransformation", args, TRANS_ARG, (PyObject**)&transformation ) ) return ( NULL );
instance->SetTransformation ( *PYTRANSFORMATION_O(transformation) );
HCATCH
Py_RETURN_NONE;
}
// ---------------------------------------------------------------
// Attribute Method : "PyInstance_SetMasterCell ()"
static PyObject* PyInstance_SetMasterCell ( PyInstance *self, PyObject* args )
{
trace << "Instance.SetMasterCell()" << endl;
METHOD_HEAD ( "Instance.SetMasterCell()" )
HTRY
PyCell* masterCell;
if ( ! ParseOneArg ( "Instance.SetMasterCell", args, CELL_ARG, (PyObject**)&masterCell ) ) return ( NULL );
instance->SetMasterCell ( PYCELL_O(masterCell) );
HCATCH
Py_RETURN_NONE;
}
// Standart Predicates (Attributes).
DirectGetBoolAttribute(PyInstance_IsTerminal ,IsTerminal ,PyInstance,Instance)
DirectGetBoolAttribute(PyInstance_IsLeaf ,IsLeaf ,PyInstance,Instance)
GetBoundStateAttribute(PyInstance_IsPyBound ,PyInstance,Instance)
// ---------------------------------------------------------------
// PyInstance Attribute Method table.
PyMethodDef PyInstance_Methods[] =
{ { "GetName" , (PyCFunction)PyInstance_GetName , METH_NOARGS , "Returns the instance name." }
, { "GetMasterCell" , (PyCFunction)PyInstance_GetMasterCell , METH_NOARGS , "Returns the cell model referenced by the instance." }
, { "GetTransformation" , (PyCFunction)PyInstance_GetTransformation , METH_NOARGS , "Returns the transformation associated to the instance." }
, { "GetPlacementStatus" , (PyCFunction)PyInstance_GetPlacementStatus , METH_NOARGS , "Returns the placement status of the instance." }
, { "GetPlug" , (PyCFunction)PyInstance_GetPlug , METH_VARARGS, "Returns the plug associated to the <masterNet> if it exists or else NULL (if the net is not external)." }
, { "GetPlugsLocator" , (PyCFunction)PyInstance_GetPlugsLocator , METH_NOARGS , "Returns the collection of instance plugs." }
, { "GetConnectedPlugsLocator" , (PyCFunction)PyInstance_GetConnectedPlugsLocator , METH_NOARGS , "Returns the collection of instance plugs which are effectively connected." }
, { "GetUnconnectedPlugsLocator", (PyCFunction)PyInstance_GetUnconnectedPlugsLocator, METH_NOARGS , "Returns the collection of instance plugs which are not connected." }
//, { "GetPath" , (PyCFunction)PyInstance_GetPath , METH_NOARGS , "Returns the path composed of the instance solely." }
//, { "GetPath" , (PyCFunction)PyInstance_GetPath , METH_VARARGS, "Returns the path resulting of the concatenation of the instance and the tail path (possibly empty)." }
, { "GetAbutmentBox" , (PyCFunction)PyInstance_GetAbutmentBox , METH_NOARGS , "Returns the abutment box of the instance, that is the abutment box of the master cell to which has been applied the instance transformation." }
, { "IsTerminal" , (PyCFunction)PyInstance_IsTerminal , METH_NOARGS , "Returns true if the instance is a terminal instance." }
, { "IsLeaf" , (PyCFunction)PyInstance_IsLeaf , METH_NOARGS , "Returns true if the instance is a leaf instance." }
, { "IsBound" , (PyCFunction)PyInstance_IsPyBound , METH_NOARGS, "Returns true if the instance is bounded to the hurricane instance" }
, { "SetName" , (PyCFunction)PyInstance_SetName , METH_VARARGS, "Allows to change the instance name." }
, { "SetTransformation" , (PyCFunction)PyInstance_SetTransformation , METH_VARARGS, "Allows to modify the instance transformation." }
, { "SetPlacementStatus" , (PyCFunction)PyInstance_SetPlacementStatus , METH_VARARGS, "Allows to modify the instance placement status." }
, { "SetMasterCell" , (PyCFunction)PyInstance_SetMasterCell , METH_VARARGS, "Allows to change the cell referenced by this instance." }
, { "Delete" , (PyCFunction)PyInstance_Delete , METH_NOARGS
, "Delete associated hurricane object The python object remains." }
, {NULL, NULL, 0, NULL} /* sentinel */
};
// x-------------------------------------------------------------x
// | "PyInstance" Object Methods |
// x-------------------------------------------------------------x
// ---------------------------------------------------------------
// Attribute Method : "PyInstance_new ()"
static PyObject* PyInstance_new(PyTypeObject *type, PyObject *args, PyObject *kwds) {
trace << "PyInstance_new ()" << endl;
Instance* instance = NULL;
PyObject* arg0;
PyObject* arg1;
PyObject* arg2;
PyObject* arg3;
HTRY
__cs.Init ("Instance.new");
if ( ! PyArg_ParseTuple(args,"O&O&O&|O&:Instance.new"
,Converter,&arg0
,Converter,&arg1
,Converter,&arg2
,Converter,&arg3
) ) return ( NULL );
if ( __cs.GetObjectIds() == CELL_NAME_CELL_ARG ) { instance = Instance::Create ( PYCELL_O(arg0)
, *PYNAME_O(arg1)
, PYCELL_O(arg2) ); }
else if ( __cs.GetObjectIds() == CELL_NAME_CELL_TRANS_ARG ) { instance = Instance::Create ( PYCELL_O(arg0)
, *PYNAME_O(arg1)
, PYCELL_O(arg2)
, *PYTRANSFORMATION_O(arg3)
, Instance::PlacementStatus::PLACED); } else {
cerr << __cs.GetObjectIds() << endl;
PyErr_SetString ( ConstructorError, "invalid number of parameters for Instance constructor." );
return ( NULL );
}
HCATCH
return PyInstance_Link ( instance );
}
DBoDeleteMethod(Instance)
PyTypeObjectLinkPyType(Instance)
PyTypeObjectConstructor(Instance)
# else // End of Python Module Code Part.
// x=================================================================x
// | "PyInstance" Shared Library Code Part |
// x=================================================================x
// Link/Creation Method.
DBoLinkCreateMethod(PyInstance_Link,PyInstance,PyTypeInstance,Instance)
// ---------------------------------------------------------------
// PyInstance Object Definitions.
PyTypeInheritedObjectDefinitions(Instance, Entity)
# endif // End of Shared Library Code Part.
} // End of extern "C".
} // End of Isobar namespace.

View File

@ -0,0 +1,112 @@
// -*- 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é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: PyInstance.h,v 1.9 2006/05/03 14:00:03 jpc Exp $
//
// x-----------------------------------------------------------------x
// | |
// | 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@asim.lip6.fr |
// | =============================================================== |
// | C++ Header : "./PyInstance.h" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#ifndef __PYINSTANCE__
#define __PYINSTANCE__
#include "PyEntity.h"
#include "Instance.h"
namespace Isobar {
USING_NAMESPACE_HURRICANE
extern "C" {
// -------------------------------------------------------------------
// Python Object : "PyInstance".
typedef struct {
PyEntity _baseObject;
} PyInstance;
// -------------------------------------------------------------------
// Functions & Types exported to "PyHurricane.ccp".
extern PyTypeObject PyTypeInstance;
extern PyMethodDef PyInstance_Methods[];
extern PyObject* PyInstance_Link(Hurricane::Instance* object);
extern void InstanceLoadConstants(PyObject* dictionnary);
extern void PyInstance_LinkPyType();
extern void PyInstance_Constructor();
#define IsPyInstance(v) ((v)->ob_type == &PyTypeInstance )
#define PYINSTANCE(v) ((PyInstance*)(v) )
#define PYINSTANCE_O(v) (static_cast<Instance*>(PYINSTANCE(v)->_baseObject._object))
} // End of extern "C".
} // End of Isobar namespace.
#endif

View File

@ -0,0 +1,150 @@
// -*- 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é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: PyInstanceLocator.cpp,v 1.12 2006/09/22 11:27:31 tsunami 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 : "./PyInstanceLocator.cpp" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
# include "PyInstanceLocator.h"
# include "PyInstance.h"
namespace Isobar {
USING_NAMESPACE_HURRICANE
extern "C" {
# define METHOD_HEAD(function) GENERIC_METHOD_HEAD(Locator<Instance*>,locator,function)
// x=================================================================x
// | "PyInstanceLocator" Python Module Code Part |
// x=================================================================x
# if defined(__PYTHON_MODULE__)
// x-------------------------------------------------------------x
// | "PyInstanceLocator" Attribute Methods |
// x-------------------------------------------------------------x
// Standart Accessors (Attributes).
// Standart Predicates (Attributes).
DirectGetBoolAttribute(PyInstanceLocator_IsValid,IsValid,PyInstanceLocator,Locator<Instance*>)
// Standart Locator Accessors (Attributes).
LocatorProgressAttribute(Instance)
LocatorGetElementAttribute(Instance)
LocatorGetCloneAttribute(Instance)
// Standart Delete (Attribute).
DirectDeleteAttribute(PyInstanceLocator_Delete,PyInstanceLocator)
// ---------------------------------------------------------------
// PyInstanceLocator Attribute Method table.
PyMethodDef PyInstanceLocator_Methods[] =
{ { "IsValid" , (PyCFunction)PyInstanceLocator_IsValid , METH_NOARGS , "Returns true while the walk has not exhausted the set of elements, else false." }
, { "Progress" , (PyCFunction)PyInstanceLocator_Progress , METH_NOARGS , "Moves forward the locator to the following element." }
, { "GetElement" , (PyCFunction)PyInstanceLocator_GetElement , METH_NOARGS , "Returns the current element (or the value Type() when the locator is not or no longer valid)." }
, { "GetClone" , (PyCFunction)PyInstanceLocator_GetClone , METH_NOARGS , "This function allocates and returns a new locator that will have the same visiting course than the remaining one of the locator being cloned." }
, { "Delete" , (PyCFunction)PyInstanceLocator_Delete , METH_NOARGS
, "Delete associated hurricane object, the python object remains." }
, {NULL, NULL, 0, NULL} /* sentinel */
};
// x-------------------------------------------------------------x
// | "PyInstanceLocator" Object Methods |
// x-------------------------------------------------------------x
DirectDeleteMethod(PyInstanceLocator_DeAlloc,PyInstanceLocator)
LocatorPyTypeObjectLinkPyType(Instance, Instance*)
# else // End of Python Module Code Part.
// x=================================================================x
// | "PyInstanceLocator" Shared Library Code Part |
// x=================================================================x
// ---------------------------------------------------------------
// PyInstanceLocator Object Definitions.
PyTypeRootObjectDefinitions(InstanceLocator)
# endif // End of Shared Library Code Part.
} // End of extern "C".
} // End of Isobar namespace.

View File

@ -0,0 +1,107 @@
// -*- 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é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: PyInstanceLocator.h,v 1.4 2006/05/03 14:00:03 jpc 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++ Header : "./PyInstanceLocator.h" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
# ifndef __PYINSTANCELOCATOR__
# define __PYINSTANCELOCATOR__
# include "PyHurricane.h"
# include "Locator.h"
# include "Instance.h"
namespace Isobar {
extern "C" {
// -------------------------------------------------------------------
// Python Object : "PyInstanceLocator".
typedef struct {
PyObject_HEAD
Hurricane::Locator<Hurricane::Instance*>* _object;
} PyInstanceLocator;
// -------------------------------------------------------------------
// Functions & Types exported to "PyHurricane.ccp".
extern PyTypeObject PyTypeInstanceLocator;
extern PyMethodDef PyInstanceLocator_Methods[];
extern void PyInstanceLocator_LinkPyType ();
# define IsPyInstanceLocator(v) ( (v)->ob_type == &PyTypeInstanceLocator )
# define PYINSTANCELOCATOR(v) ( (PyInstanceLocator*)(v) )
# define PYINSTANCELOCATOR_O(v) ( PYINSTANCELOCATOR(v)->_object )
} // End of extern "C".
} // End of Isobar namespace.
# endif

View File

@ -0,0 +1,200 @@
// -*- 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é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: PyLayer.cpp,v 1.10 2006/09/22 11:27:31 tsunami 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@asim.lip6.fr |
// | =============================================================== |
// | C++ Module : "./PyLayer.cpp" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#include "PyLayer.h"
#include "PyName.h"
#include "PyTechnology.h"
namespace Isobar {
USING_NAMESPACE_HURRICANE
extern "C" {
#define METHOD_HEAD(function) GENERIC_METHOD_HEAD(Layer,layer,function)
// x=================================================================x
// | "PyLayer" Python Module Code Part |
// x=================================================================x
#if defined(__PYTHON_MODULE__)
// x-------------------------------------------------------------x
// | "PyLayer" Attribute Methods |
// x-------------------------------------------------------------x
// Standart Accessors (Attributes).
// Standart Delete (Attribute).
DBoDeleteAttribute(PyLayer_Delete,PyLayer)
// ---------------------------------------------------------------
// Attribute Method : "PyLayer_GetTechnology ()"
static PyObject* PyLayer_GetTechnology ( PyLayer *self )
{
trace << "PyLayer_GetTechnology ()" << endl;
Technology* techno = NULL;
HTRY
METHOD_HEAD ( "Layer.GetTechnology()" )
techno = layer->GetTechnology ();
HCATCH
return PyTechnology_Link ( techno );
}
// ---------------------------------------------------------------
// Attribute Method : "PyLayer_GetName ()"
static PyObject* PyLayer_GetName ( PyLayer *self )
{
trace << "Layer_GetName ()" << endl;
METHOD_HEAD ( "Layer.GetName()" )
PyName* pyName = PyObject_NEW ( PyName, &PyTypeName );
if ( pyName == NULL ) { return NULL; }
HTRY
pyName->_object = new Name ( layer->GetName() );
HCATCH
return ( (PyObject*)pyName );
}
// ---------------------------------------------------------------
// Attribute Method : "PyLayer_SetName ()"
static PyObject* PyLayer_SetName ( PyLayer *self, PyObject* args )
{
trace << "Layer.SetName()" << endl;
METHOD_HEAD ( "Layer.SetName()" )
HTRY
PyName* name;
if ( ! ParseOneArg ( "Layer.SetName", args, NAME_ARG, (PyObject**)&name ) ) return ( NULL );
layer->SetName ( *PYNAME_O(name) );
HCATCH
Py_RETURN_NONE;
}
// ---------------------------------------------------------------
// PyLayer Attribute Method table.
PyMethodDef PyLayer_Methods[] =
{ { "GetTechnology" , (PyCFunction)PyLayer_GetTechnology , METH_NOARGS , "Returns the technology owning the layer." }
, { "GetName" , (PyCFunction)PyLayer_GetName , METH_NOARGS , "Returns the name of the layer." }
, { "SetName" , (PyCFunction)PyLayer_SetName , METH_VARARGS, "Allows to change the layer name." }
, { "Delete" , (PyCFunction)PyLayer_Delete , METH_NOARGS
, "Delete associated hurricane object The python object remains." }
, {NULL, NULL, 0, NULL} /* sentinel */
};
// x-------------------------------------------------------------x
// | "PyLayer" Object Methods |
// x-------------------------------------------------------------x
DBoDeleteMethod(Layer)
PyTypeObjectLinkPyType(Layer)
#else // End of Python Module Code Part.
// x=================================================================x
// | "PyLayer" Shared Library Code Part |
// x=================================================================x
// Link/Creation Method.
DBoLinkCreateMethod(PyLayer_Link,PyLayer,PyTypeLayer,Layer)
// ---------------------------------------------------------------
// PyLayer Object Definitions.
PyTypeRootObjectDefinitions(Layer)
#endif // End of Shared Library Code Part.
} // End of extern "C".
} // End of Isobar namespace.

View File

@ -0,0 +1,91 @@
// -*- 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é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: PyLayer.h,v 1.4 2006/05/03 14:00:03 jpc 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@asim.lip6.fr |
// | =============================================================== |
// | C++ Header : "./PyLayer.h" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
# ifndef __PYLAYER__
# define __PYLAYER__
# include "PyHurricane.h"
# include "Layer.h"
namespace Isobar {
USING_NAMESPACE_HURRICANE
extern "C" {
// -------------------------------------------------------------------
// Python Object : "PyLayer".
typedef struct {
PyObject_HEAD
Layer* _object;
} PyLayer;
// -------------------------------------------------------------------
// Functions & Types exported to "PyHurricane.ccp".
extern PyTypeObject PyTypeLayer;
extern PyMethodDef PyLayer_Methods[];
extern PyObject* PyLayer_Link ( Hurricane::Layer* object );
extern void PyLayer_LinkPyType ();
# define IsPyLayer(v) ( (v)->ob_type == &PyTypeLayer )
# define PYLAYER(v) ( (PyLayer*)(v) )
# define PYLAYER_O(v) ( PYLAYER(v)->_object )
} // End of extern "C".
} // End of Isobar namespace.
# endif

View File

@ -0,0 +1,226 @@
// -*- 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é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: PyLibrary.cpp,v 1.17 2006/09/22 11:27:31 tsunami Exp $
//
// x-----------------------------------------------------------------x
// | |
// | 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@asim.lip6.fr |
// | =============================================================== |
// | C++ Module : "./PyLibrary.cpp" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#include "PyDataBase.h"
#include "PyName.h"
#include "PyLibrary.h"
#include "PyCell.h"
#include "PyCellLocator.h"
namespace Isobar {
USING_NAMESPACE_HURRICANE
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 ()"
static PyObject* PyLibrary_GetName ( PyLibrary *self ) {
trace << "PyLibrary_GetName ()" << endl;
METHOD_HEAD ( "Library.GetName()" )
PyName* pyName = PyObject_NEW ( PyName, &PyTypeName );
if ( pyName == NULL ) { return NULL; }
HTRY
pyName->_object = new Name ( lib->GetName() );
HCATCH
return ( (PyObject*)pyName );
}
// ---------------------------------------------------------------
// Attribute Method : "PyLibrary_GetCell ()"
PyObject* PyLibrary_GetCell ( PyLibrary* self, PyObject* args ) {
trace << "PyLibrary_GetCell ()" << endl;
Cell* cell = NULL;
HTRY
METHOD_HEAD ( "Library.GetCell()" )
PyObject* arg0;
if ( ! ParseOneArg ( "Library.GetCell", args, NAME_ARG, &arg0 ) ) return ( NULL );
cell = lib->GetCell ( *PYNAME_O(arg0) );
HCATCH
return PyCell_Link ( cell );
}
// ---------------------------------------------------------------
// Attribute Method : "PyLibrary_GetCellsLocator ()"
static PyObject* PyLibrary_GetCellsLocator ( PyLibrary *self ) {
trace << "PyLibrary_GetCellsLocator ()" << endl;
METHOD_HEAD ( "Library.GetCellsLocator()" )
Cells cells = lib->GetCells ();
PyCellLocator* pyCellLocator = PyObject_NEW ( PyCellLocator, &PyTypeCellLocator );
if (pyCellLocator == NULL) { return NULL; }
HTRY
pyCellLocator->_object = cells.GetLocator ();
HCATCH
return ( (PyObject*)pyCellLocator );
}
// Standart Accessors (Attributes).
// Standart Delete (Attribute).
DBoDeleteAttribute(PyLibrary_Delete,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>" }
, { "GetCellsLocator", (PyCFunction)PyLibrary_GetCellsLocator, METH_NOARGS , "Returns the collection of all cells of the library." }
, { "Delete" , (PyCFunction)PyLibrary_Delete , METH_NOARGS
, "Delete associated hurricane object The python object remains." }
, {NULL, NULL, 0, NULL} /* sentinel */
};
// x-------------------------------------------------------------x
// | "PyLibrary" Object Methods |
// x-------------------------------------------------------------x
static PyObject* PyLibrary_new(PyTypeObject *type, PyObject *args, PyObject *kwds) {
trace << "PyLibrary_new()" << endl;
PyObject* arg0;
PyObject* arg1;
Library* library = NULL;
if (ParseTwoArg("Library.new", args, ":db:name", &arg0, &arg1)) {
HTRY
DataBase* db = PYDATABASE_O(arg0);
library = Library::Create(db, *PYNAME_O(arg1));
HCATCH
} else if (ParseTwoArg("Library.new", args, ":db:name", &arg0, &arg1)) {
HTRY
Library* masterLibrary = PYLIBRARY_O(arg0);
library = Library::Create(masterLibrary, *PYNAME_O(arg1));
HCATCH
} else {
return NULL;
}
return PyLibrary_Link ( library );
}
DBoDeleteMethod(Library)
PyTypeObjectLinkPyType(Library)
PyTypeObjectConstructor(Library)
# else // End of Python Module Code Part.
// x=================================================================x
// | "PyLibrary" Shared Library Code Part |
// x=================================================================x
// Link/Creation Method.
DBoLinkCreateMethod(PyLibrary_Link,PyLibrary,PyTypeLibrary,Library)
// ---------------------------------------------------------------
// PyLibrary Object Definitions.
PyTypeRootObjectDefinitions(Library)
# endif // End of Shared Library Code Part.
} // End of extern "C".
} // End of Isobar namespace.

View File

@ -0,0 +1,105 @@
// -*- 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é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: PyLibrary.h,v 1.7 2006/05/03 14:00:03 jpc Exp $
//
// x-----------------------------------------------------------------x
// | |
// | 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@asim.lip6.fr |
// | =============================================================== |
// | C++ Header : "./PyLibrary.h" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#ifndef __PYLIBRARY__
#define __PYLIBRARY__
#include "PyHurricane.h"
#include "Library.h"
namespace Isobar {
USING_NAMESPACE_HURRICANE
extern "C" {
// -------------------------------------------------------------------
// Python Object : "PyLibrary".
typedef struct {
PyObject_HEAD
Library* _object;
} PyLibrary;
// -------------------------------------------------------------------
// Functions & Types exported to "PyHurricane.ccp".
extern PyTypeObject PyTypeLibrary;
extern PyMethodDef PyLibrary_Methods[];
extern PyObject* PyLibrary_GetLibrary ( PyObject* module );
extern PyObject* PyLibrary_Link ( Hurricane::Library* lib );
extern void PyLibrary_LinkPyType ();
extern void PyLibrary_Constructor();
#define IsPyLibrary(v) ( (v)->ob_type == &PyTypeLibrary )
#define PYLIBRARY(v) ( (PyLibrary*)(v) )
#define PYLIBRARY_O(v) ( PYLIBRARY(v)->_object )
} // End of extern "C".
} // End of Isobar namespace.
# endif

View File

@ -0,0 +1,169 @@
// -*- 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é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: PyName.cpp,v 1.13 2006/09/22 11:27:31 tsunami Exp $
//
// x-----------------------------------------------------------------x
// | |
// | 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@asim.lip6.fr |
// | =============================================================== |
// | C++ Module : "./PyName.cpp" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#include "PyName.h"
namespace Isobar {
USING_NAMESPACE_HURRICANE
extern "C" {
#define METHOD_HEAD(function) GENERIC_METHOD_HEAD(Name,_object,function)
// x=================================================================x
// | "PyName" Python Module Code Part |
// x=================================================================x
#if defined(__PYTHON_MODULE__)
// x-------------------------------------------------------------x
// | "PyName" Attribute Methods |
// x-------------------------------------------------------------x
// Standart Delete (Attribute).
//DirectGetBoolAttribute(PyName_IsEmpty,IsEmpty,PyName,Name)
static PyObject* PyName_IsEmpty ( PyName *self )
{
trace << "PyName_IsEmpty()" << endl;
METHOD_HEAD ( "Name.IsEmpty()" )
return ( Py_BuildValue ("i",_object->IsEmpty()) );
}
// Standart Delete (Attribute).
DirectDeleteAttribute(PyName_Delete,PyName)
// ---------------------------------------------------------------
// PyName Attribute Method table.
PyMethodDef PyName_Methods[] =
{ { "IsEmpty" , (PyCFunction)PyName_IsEmpty , METH_NOARGS , "True if empty." }
, { "Delete" , (PyCFunction)PyName_Delete , METH_NOARGS
, "Delete associated hurricane object The python object remains." }
, {NULL, NULL, 0, NULL} /* sentinel */
};
// ---------------------------------------------------------------
// Attribute Method : "PyName_new ()"
static PyObject* PyName_new(PyTypeObject *type, PyObject *args, PyObject *kwds) {
trace << "PyName_new ()" << endl;
Name* name = NULL;
PyObject* arg0;
__cs.Init ("Name.new");
if (!PyArg_ParseTuple(args,"|O&:Name.new",Converter,&arg0) ) return ( NULL );
HTRY
if (__cs.GetObjectIds() == NO_ARG ) { name = new Name (); }
else if (__cs.GetObjectIds() == STRING_ARG ) { name = new Name ( PyString_AsString(arg0) ); }
else {
PyErr_SetString ( ConstructorError, "invalid number of parameters for Name constructor." );
return(NULL);
}
HCATCH
PyObject* pyName = type->tp_alloc(type, 0);
if (pyName != NULL) {
((PyName*)pyName)->ACCESS_OBJECT = name;
}
return pyName;
}
DirectDeleteMethod(PyName_DeAlloc,PyName)
PyTypeObjectLinkPyType(Name)
PyTypeObjectConstructor(Name)
#else // End of Python Module Code Part.
// x=================================================================x
// | "PyName" Shared Library Code Part |
// x=================================================================x
// ---------------------------------------------------------------
// PyName Object Definitions.
PyTypeRootObjectDefinitions(Name)
#endif // End of Shared Library Code Part.
} // End of extern "C".
} // End of Isobar namespace.

View File

@ -0,0 +1,106 @@
// -*- 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é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: PyName.h,v 1.7 2006/05/03 14:00:03 jpc Exp $
//
// x-----------------------------------------------------------------x
// | |
// | 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@asim.lip6.fr |
// | =============================================================== |
// | C++ Header : "./PyName.h" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#ifndef __PYNAME__
#define __PYNAME__
#include "PyHurricane.h"
#include "Name.h"
namespace Isobar {
extern "C" {
// -------------------------------------------------------------------
// Python Object : "PyName".
typedef struct {
PyObject_HEAD
Hurricane::Name* _object;
} PyName;
// -------------------------------------------------------------------
// Functions & Types exported to "PyHurricane.ccp".
extern PyTypeObject PyTypeName;
extern PyMethodDef PyName_Methods[];
extern void PyName_LinkPyType();
extern void PyName_Constructor();
#define IsPyName(v) ( (v)->ob_type == &PyTypeName )
#define PYNAME(v) ( (PyName*)(v) )
#define PYNAME_O(v) ( PYNAME(v)->_object )
} // End of extern "C".
} // End of Isobar namespace.
#endif

View File

@ -0,0 +1,633 @@
// -*- 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é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 "PyNet.h"
# include "PyName.h"
# include "PyCell.h"
# include "PyPoint.h"
# include "PyPlugLocator.h"
# include "PySegmentLocator.h"
# include "PyComponentLocator.h"
# include "PyPinLocator.h"
# include "NetExternalComponents.h"
USING_NAMESPACE_HURRICANE
namespace Isobar {
USING_NAMESPACE_HURRICANE
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).
DirectGetLongAttribute(PyNet_GetX,GetX,PyNet,Net)
DirectGetLongAttribute(PyNet_GetY,GetY,PyNet,Net)
// Standart Predicates (Attributes).
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)
GetBoundStateAttribute(PyNet_IsPyBound ,PyNet,Net)
// Standart Delete (Attribute).
DBoDeleteAttribute(PyNet_Delete,PyNet)
// ---------------------------------------------------------------
// Attribute Method : "PyNet_GetName ()"
static PyObject* PyNet_GetName ( PyNet *self )
{
trace << "PyNet_GetName ()" << endl;
METHOD_HEAD ( "Net.GetName()" )
PyName* pyName = PyObject_NEW ( PyName, &PyTypeName );
if ( pyName == NULL ) { return NULL; }
trace_in ();
trace << "new PyName [" << hex << pyName << "]" << endl;
trace_out ();
HTRY
pyName->_object = new Name ( net->GetName() );
HCATCH
return ( (PyObject*)pyName );
}
// ---------------------------------------------------------------
// Attribute Method : "PyNet_GetType ()"
static PyObject* PyNet_GetType ( PyNet *self )
{
trace << "PyNet_GetType ()" << endl;
METHOD_HEAD ( "Net.GetType()" )
return ( (PyObject*)Py_BuildValue("i",(long)net->GetType().GetCode()) );
}
// ---------------------------------------------------------------
// Attribute Method : "PyNet_GetDirection ()"
static PyObject* PyNet_GetDirection ( PyNet *self )
{
trace << "PyNet_GetDirection ()" << endl;
METHOD_HEAD ( "Net.GetDirection()" )
return ( (PyObject*)Py_BuildValue("i",(long)net->GetDirection().GetCode()) );
}
// ---------------------------------------------------------------
// Attribute Method : "PyNet_GetPlugsLocator ()"
static PyObject* PyNet_GetPlugsLocator ( PyNet *self )
{
trace << "PyNet_GetPlugsLocator ()" << endl;
METHOD_HEAD ( "Net.GetPlugsLocator()" )
Plugs plugs = net->GetPlugs ();
PyPlugLocator* pyPlugLocator = PyObject_NEW ( PyPlugLocator, &PyTypePlugLocator );
if (pyPlugLocator == NULL) { return NULL; }
trace_in ();
trace << "new PyPlugLocator [" << hex << pyPlugLocator << "]" << endl;
trace_out ();
HTRY
pyPlugLocator->_object = plugs.GetLocator ();
HCATCH
return ( (PyObject*)pyPlugLocator );
}
// ---------------------------------------------------------------
// Attribute Method : "PyNet_GetSegmentsLocator ()"
static PyObject* PyNet_GetSegmentsLocator ( PyNet *self )
{
trace << "PyNet_GetSegmentsLocator ()" << endl;
METHOD_HEAD ( "Net.GetSegmentsLocator()" )
Segments segments = net->GetSegments ();
PySegmentLocator* pySegmentLocator = PyObject_NEW ( PySegmentLocator, &PyTypeSegmentLocator );
if (pySegmentLocator == NULL) { return NULL; }
trace_in ();
trace << "new PySegmentLocator [" << hex << pySegmentLocator << "]" << endl;
trace_out ();
HTRY
pySegmentLocator->_object = segments.GetLocator ();
HCATCH
return ( (PyObject*)pySegmentLocator );
}
// ---------------------------------------------------------------
// Attribute Method : "PyNet_GetPinsLocator ()"
static PyObject* PyNet_GetPinsLocator ( PyNet *self )
{
trace << "PyNet_GetPinsLocator ()" << endl;
METHOD_HEAD ( "Net.GetPinsLocator()" )
Pins pins = net->GetPins ();
PyPinLocator* pyPinLocator = PyObject_NEW ( PyPinLocator, &PyTypePinLocator );
if (pyPinLocator == NULL) { return NULL; }
trace_in ();
trace << "new PyPinLocator [" << hex << pyPinLocator << "]" << endl;
trace_out ();
HTRY
pyPinLocator->_object = pins.GetLocator ();
HCATCH
return ( (PyObject*)pyPinLocator );
}
// ---------------------------------------------------------------
// Attribute Method : "PyNet_GetExternalComponentsLocator ()"
static PyObject* PyNet_GetExternalComponentsLocator ( PyNet *self )
{
trace << "PyNet_GetExternalComponentsLocator ()" << endl;
METHOD_HEAD ( "Net.GetExternalcomponentsLocator()" )
Components externalComponents = GetExternalComponents(net);
PyComponentLocator* pyExternalComponentsLocator = PyObject_NEW ( PyComponentLocator, &PyTypeComponentLocator );
if (pyExternalComponentsLocator == NULL) { return NULL; }
trace_in ();
trace << "new PyExternalComponentsLocator [" << hex << pyExternalComponentsLocator << "]" << endl;
trace_out ();
HTRY
pyExternalComponentsLocator->_object = externalComponents.GetLocator ();
HCATCH
return ( (PyObject*)pyExternalComponentsLocator );
}
// ---------------------------------------------------------------
// Attribute Method : "PyNet_SetName ()"
static PyObject* PyNet_SetName ( PyNet *self, PyObject* args )
{
trace << "PyNet_SetName()" << endl;
HTRY
METHOD_HEAD ( "Net.SetName()" )
PyObject* arg0;
if ( ! ParseOneArg ( "Net.SetName", args, NET_ARG, (PyObject**)&arg0 ) ) return ( NULL );
net->SetName ( *PYNAME_O(arg0) );
HCATCH
Py_RETURN_NONE;
}
// ---------------------------------------------------------------
// Attribute Method : "PyNet_SetGlobal ()"
static PyObject* PyNet_SetGlobal ( PyNet *self, PyObject* args )
{
trace << "PyNet_SetGlobal()" << endl;
HTRY
METHOD_HEAD ( "Net.SetGlobal()" )
PyObject* arg0;
if ( ! ParseOneArg ( "Net.SetGlobal", args, INT_ARG, (PyObject**)&arg0 ) ) return ( NULL );
net->SetGlobal ( PyInt_AsLong(arg0) != 0 );
HCATCH
Py_RETURN_NONE;
}
// ---------------------------------------------------------------
// Attribute Method : "PyNet_SetExternal ()"
static PyObject* PyNet_SetExternal ( PyNet *self, PyObject* args )
{
trace << "PyNet_SetExternal()" << endl;
HTRY
METHOD_HEAD ( "Net.SetExternal()" )
PyObject* arg0;
if ( ! ParseOneArg ( "Net.SetExternal", args, INT_ARG, (PyObject**)&arg0 ) ) return ( NULL );
net->SetExternal ( PyInt_AsLong(arg0) != 0 );
HCATCH
Py_RETURN_NONE;
}
// ---------------------------------------------------------------
// Attribute Method : "PyNet_SetType ()"
static PyObject* PyNet_SetType ( PyNet *self, PyObject* args )
{
trace << "PyNet_SetType()" << endl;
HTRY
METHOD_HEAD ( "Net.SetType()" )
PyObject* arg0;
if ( ! ParseOneArg ( "Net.SetType", args, INT_ARG, (PyObject**)&arg0 ) ) return ( NULL );
net->SetType ( PyInt_AsType(arg0) );
HCATCH
Py_RETURN_NONE;
}
// ---------------------------------------------------------------
// Attribute Method : "PyNet_SetDirection ()"
static PyObject* PyNet_SetDirection ( PyNet *self, PyObject* args )
{
trace << "PyNet_SetDirection()" << endl;
HTRY
METHOD_HEAD ( "Net.SetDirection()" )
PyObject* arg0;
if ( ! ParseOneArg ( "Net.SetDirection", args, INT_ARG, (PyObject**)&arg0 ) ) return ( NULL );
net->SetDirection ( PyInt_AsDirection(arg0) );
HCATCH
Py_RETURN_NONE;
}
// ---------------------------------------------------------------
// Attribute Method : "PyNet_SetPosition ()"
static PyObject* PyNet_SetPosition ( PyNet *self, PyObject* args )
{
trace << "PyNet_SetPosition()" << endl;
HTRY
METHOD_HEAD ( "Net.SetPosition()" )
PyObject* arg0;
if ( ! ParseOneArg ( "Net.SetPosition", args, POINT_ARG, (PyObject**)&arg0 ) ) return ( NULL );
net->SetPosition ( *PYPOINT_O(arg0) );
HCATCH
Py_RETURN_NONE;
}
// ---------------------------------------------------------------
// Attribute Method : "PyNet_Merge ()"
static PyObject* PyNet_Merge ( PyNet *self, PyObject* args )
{
trace << "PyNet_Merge()" << endl;
HTRY
METHOD_HEAD ( "Net.Merge()" )
PyObject* arg0;
if ( ! ParseOneArg ( "Net.Merge", args, NET_ARG, (PyObject**)&arg0 ) ) return ( NULL );
net->Merge ( PYNET_O(arg0) );
HCATCH
Py_RETURN_NONE;
}
// ---------------------------------------------------------------
// PyNet Attribute Method table.
PyMethodDef PyNet_Methods[] =
{ { "GetName" , (PyCFunction)PyNet_GetName , METH_NOARGS , "Returns the net name." }
//, { "GetArity" , (PyCFunction)PyNet_GetArity , METH_NOARGS , "Returns the signal arity." }
, { "GetType" , (PyCFunction)PyNet_GetType , METH_NOARGS
, "Returns the signal type (by default set to UNDEFINED)." }
, { "GetDirection" , (PyCFunction)PyNet_GetDirection , METH_NOARGS
, "Returns the signal direction (by default set to UNDEFINED)." }
//, { "GetPosition" , (PyCFunction)PyNet_GetPosition , METH_NOARGS
// , "Returns the X,Y position of the net. This position is used for computing the location of the plugs (on slave instances calling the cell owning this net) having that net as master." }
, { "GetX" , (PyCFunction)PyNet_GetX , METH_NOARGS , "Returns net abscissa." }
, { "GetY" , (PyCFunction)PyNet_GetY , METH_NOARGS , "Returns net ordinate." }
//, { "GetRubbers" , (PyCFunction)PyNet_GetRubbers , METH_NOARGS , "Returns the collection of net's rubbers." }
//, { "GetComponents" , (PyCFunction)PyNet_GetComponents , METH_NOARGS , "Returns the collection of net's components." }
, { "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." }
//, { "GetContacts" , (PyCFunction)PyNet_GetContacts , METH_NOARGS , "Returns the collection of net's contacts." }
, { "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." }
//, { "GetSegments" , (PyCFunction)PyNet_GetSegments , METH_NOARGS , "Returns the collection of net's segments." }
//, { "GetVerticals" , (PyCFunction)PyNet_GetVerticals , METH_NOARGS , "Returns the collection of net's vertical segments." }
//, { "GetHorizontals" , (PyCFunction)PyNet_GetHorizontals , METH_NOARGS , "Returns the collection of net's horizontal segments." }
//, { "GetPads" , (PyCFunction)PyNet_GetPads , METH_NOARGS , "Returns the collection of net's pads." }
//, { "GetSavePlugs" , (PyCFunction)PyNet_GetSavePlugs , METH_NOARGS , "Returns the collection of plugs which have this net as master." }
//, { "GetConnectedSavePlugs", (PyCFunction)PyNet_GetConnectedSavePlugs , METH_NOARGS
// , "Returns the collection of connected plugs which have this net as master." }
//, { "GetUnconnectedSavePlugs", (PyCFunction)PyNet_GetUnconnectedSavePlugs, METH_NOARGS
// , "Returns the collection of unconnected plugs which have this net as master." }
, { "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." }
//, { "SetArity" , (PyCFunction)PyNet_SetArity , METH_VARARGS, "Sets the signal arity to <arity>." }
, { "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." }
//, { "Materialize" , (PyCFunction)PyNet_Materialize , METH_NOARGS
// , "Materializes all the rubbers and components of a net." }
//, { "Unmaterialize" , (PyCFunction)PyNet_Unmaterialize , METH_NOARGS
// , "De-materializes all the rubbers and components of a net." }
, { "Merge" , (PyCFunction)PyNet_Merge , METH_VARARGS
, "Merges the net <net> to the net <this> which keeps its characteristics (arity, global, external and direction)." }
, { "Delete" , (PyCFunction)PyNet_Delete , METH_NOARGS
, "Delete associated hurricane object, the python object remains." }
, {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
net = Net::Create ( PYCELL_O(arg0), *PYNAME_O(arg1) );
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.

109
hurricane/src/pyext/PyNet.h Normal file
View File

@ -0,0 +1,109 @@
// -*- 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é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.h,v 1.7 2006/05/03 14:00:03 jpc 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++ Header : "./PyNet.h" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#ifndef __PYNET__
#define __PYNET__
#include "PyEntity.h"
#include "Net.h"
namespace Isobar {
extern "C" {
// -------------------------------------------------------------------
// Python Object : "PyNet".
typedef struct {
PyEntity _baseObject;
} PyNet;
// -------------------------------------------------------------------
// Functions & Types exported to "PyHurricane.ccp".
extern PyTypeObject PyTypeNet;
extern PyMethodDef PyNet_Methods[];
extern PyObject* PyNet_Link(Hurricane::Net* object);
extern void NetLoadConstants(PyObject* dictionnary);
extern void PyNet_LinkPyType();
extern void PyNet_Constructor();
#define IsPyNet(v) ((v)->ob_type == &PyTypeNet)
#define PYNET(v) ((PyNet*)(v))
#define PYNET_O(v) (dynamic_cast<Net*>(PYNET(v)->_baseObject._object))
} // End of extern "C".
} // End of Isobar namespace.
#endif

View File

@ -0,0 +1,152 @@
// -*- 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é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
// ===================================================================
//
// 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 : "./PyNetLocator.cpp" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
# include "PyNetLocator.h"
# include "PyNet.h"
namespace Isobar {
USING_NAMESPACE_HURRICANE
extern "C" {
# define METHOD_HEAD(function) GENERIC_METHOD_HEAD(Locator<Net*>,locator,function)
// x=================================================================x
// | "PyNetLocator" Python Module Code Part |
// x=================================================================x
# if defined(__PYTHON_MODULE__)
// x-------------------------------------------------------------x
// | "PyNetLocator" Attribute Methods |
// x-------------------------------------------------------------x
// ---------------------------------------------------------------
// Attribute Method : "PyNetLocator_Create ()"
// Standart Accessors (Attributes).
// Standart Predicates (Attributes).
DirectGetBoolAttribute(PyNetLocator_IsValid,IsValid,PyNetLocator,Locator<Net*>)
// Standart Locator Accessors (Attributes).
LocatorProgressAttribute(Net)
LocatorGetElementAttribute(Net)
LocatorGetCloneAttribute(Net)
// Standart Delete (Attribute).
DirectDeleteAttribute(PyNetLocator_Delete,PyNetLocator)
// ---------------------------------------------------------------
// PyNetLocator Attribute Method table.
PyMethodDef PyNetLocator_Methods[] =
{ { "IsValid" , (PyCFunction)PyNetLocator_IsValid , METH_NOARGS , "Returns true while the walk has not exhausted the set of elements, else false." }
, { "Progress" , (PyCFunction)PyNetLocator_Progress , METH_NOARGS , "Moves forward the locator to the following element." }
, { "GetElement" , (PyCFunction)PyNetLocator_GetElement , METH_NOARGS , "Returns the current element (or the value Type() when the locator is not or no longer valid)." }
, { "GetClone" , (PyCFunction)PyNetLocator_GetClone , METH_NOARGS , "This function allocates and returns a new locator that will have the same visiting course than the remaining one of the locator being cloned." }
, { "Delete" , (PyCFunction)PyNetLocator_Delete , METH_NOARGS
, "Delete associated hurricane object, the python object remains." }
, {NULL, NULL, 0, NULL} /* sentinel */
};
// x-------------------------------------------------------------x
// | "PyNetLocator" Object Methods |
// x-------------------------------------------------------------x
DirectDeleteMethod(PyNetLocator_DeAlloc,PyNetLocator)
LocatorPyTypeObjectLinkPyType(Net, Net*)
# else // End of Python Module Code Part.
// x=================================================================x
// | "PyNetLocator" Shared Library Code Part |
// x=================================================================x
// ---------------------------------------------------------------
// PyNetLocator Object Definitions.
PyTypeRootObjectDefinitions(NetLocator)
# endif // End of Shared Library Code Part.
} // End of extern "C".
} // End of Isobar namespace.

View File

@ -0,0 +1,105 @@
// -*- 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é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
// ===================================================================
//
// 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++ Header : "./PyNetLocator.h" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
# ifndef __PYNETLOCATOR__
# define __PYNETLOCATOR__
# include "PyHurricane.h"
# include "Locator.h"
# include "Net.h"
namespace Isobar {
extern "C" {
// -------------------------------------------------------------------
// Python Object : "PyNetLocator".
typedef struct {
PyObject_HEAD
Hurricane::Locator<Hurricane::Net*>* _object;
} PyNetLocator;
// -------------------------------------------------------------------
// Functions & Types exported to "PyHurricane.ccp".
extern PyTypeObject PyTypeNetLocator;
extern PyMethodDef PyNetLocator_Methods[];
extern void PyNetLocator_LinkPyType ();
# define IsPyNetLocator(v) ( (v)->ob_type == &PyTypeNetLocator )
# define PYNETLOCATOR(v) ( (PyNetLocator*)(v) )
# define PYNETLOCATOR_O(v) ( PYNETLOCATOR(v)->_object )
} // End of extern "C".
} // End of Isobar namespace.
# endif

View File

@ -0,0 +1,316 @@
// -*- 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é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: PyOccurrence.cpp,v 1.7 2007/05/02 11:50:46 d2 Exp $
//
// x-----------------------------------------------------------------x
// | |
// | 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@asim.lip6.fr |
// | =============================================================== |
// | C++ Module : "./PyOccurrence.cpp" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#include "PyBox.h"
#include "PyTransformation.h"
#include "PyName.h"
#include "PyPath.h"
#include "PyOccurrence.h"
#include "PyCell.h"
#include "PySegment.h"
namespace Isobar {
USING_NAMESPACE_HURRICANE
extern "C" {
#define METHOD_HEAD(function) GENERIC_METHOD_HEAD(Occurrence,occurrence,function)
// x=================================================================x
// | "PyOccurrence" Python Module Code Part |
// x=================================================================x
#if defined(__PYTHON_MODULE__)
// x-------------------------------------------------------------x
// | "PyOccurrence" Attribute Methods |
// x-------------------------------------------------------------x
// Standart Accessors (Attributes).
// Standart Predicates (Attributes).
DirectGetBoolAttribute(PyOccurrence_IsValid ,IsValid ,PyOccurrence,Occurrence)
DirectGetBoolAttribute(PyOccurrence_HasProperty,HasProperty,PyOccurrence,Occurrence)
// Standart Delete (Attribute).
DirectDeleteAttribute(PyOccurrence_Delete,PyOccurrence)
// ---------------------------------------------------------------
// Attribute Method : "PyOccurrence_GetEntity ()"
static PyObject* PyOccurrence_GetEntity ( PyOccurrence *self )
{
trace << "PyOccurrence_GetEntity()" << endl;
METHOD_HEAD ( "Occurrence.GetEntity()" )
PyObject* pyEntity = NULL;
HTRY
Entity* entity = occurrence->GetEntity();
if ( entity == NULL )
Py_RETURN_NONE;
pyEntity = PyEntity_NEW ( entity );
HCATCH
return pyEntity;
}
// ---------------------------------------------------------------
// Attribute Method : "PyOccurrence_GetOwnerCell ()"
static PyObject* PyOccurrence_GetOwnerCell ( PyOccurrence *self )
{
trace << "PyOccurrence_GetOwnerCell()" << endl;
METHOD_HEAD ( "Occurernce.GetOwnerCell()" )
Cell* cell = NULL;
HTRY
cell = occurrence->GetOwnerCell();
HCATCH
return PyCell_Link ( cell );
}
// ---------------------------------------------------------------
// Attribute Method : "PyOccurrence_GetMasterCell ()"
static PyObject* PyOccurrence_GetMasterCell ( PyOccurrence *self )
{
trace << "PyOccurrence_GetMasterCell()" << endl;
METHOD_HEAD ( "Occurrence.GetMasterCell()" )
Cell* cell = NULL;
HTRY
cell = occurrence->GetMasterCell();
HCATCH
return PyCell_Link ( cell );
}
// ---------------------------------------------------------------
// Attribute Method : "PyOccurrence_GetPath ()"
static PyObject* PyOccurrence_GetPath ( PyOccurrence *self )
{
trace << "PyOccurrence_GetPath ()" << endl;
METHOD_HEAD ( "Occurrence.GetPath()" )
PyPath* pyPath = PyObject_NEW ( PyPath, &PyTypePath );
if ( pyPath == NULL ) { return NULL; }
HTRY
pyPath->_object = new Path ( occurrence->GetPath() );
HCATCH
return ( (PyObject*)pyPath );
}
// ---------------------------------------------------------------
// Attribute Method : "PyOccurrence_GetName ()"
static PyObject* PyOccurrence_GetName ( PyOccurrence *self )
{
trace << "PyOccurrence_GetName ()" << endl;
METHOD_HEAD ( "Occurrence.GetName()" )
PyName* pyName = PyObject_NEW ( PyName, &PyTypeName );
if ( pyName == NULL ) { return NULL; }
HTRY
pyName->_object = new Name ( occurrence->GetName() );
HCATCH
return ( (PyObject*)pyName );
}
// ---------------------------------------------------------------
// Attribute Method : "PyOccurrence_GetBoundingBox ()"
static PyObject* PyOccurrence_GetBoundingBox ( PyOccurrence *self )
{
trace << "PyOccurrence_GetBoundingBox ()" << endl;
METHOD_HEAD ( "Occurrence.GetBoundingBox()" )
PyBox* pyBox = PyObject_NEW ( PyBox, &PyTypeBox );
if ( pyBox == NULL ) { return NULL; }
HTRY
pyBox->_object = new Box ( occurrence->GetBoundingBox() );
HCATCH
return ( (PyObject*)pyBox );
}
// ---------------------------------------------------------------
// PyOccurrence Attribute Method table.
PyMethodDef PyOccurrence_Methods[] =
{ { "GetEntity" , (PyCFunction)PyOccurrence_GetEntity , METH_NOARGS, "Returns the referenced entity." }
, { "GetPath" , (PyCFunction)PyOccurrence_GetPath , METH_NOARGS, "Returns the hierarchical instaciation path." }
, { "GetName" , (PyCFunction)PyOccurrence_GetName , METH_NOARGS, "Returns the occurrence name (concatenation of path and entity name." }
, { "GetOwnerCell" , (PyCFunction)PyOccurrence_GetOwnerCell , METH_NOARGS, "Returns the occurrence owner cell." }
, { "GetMasterCell" , (PyCFunction)PyOccurrence_GetMasterCell , METH_NOARGS, "Returns the cell owning the referenced entity." }
, { "GetBoundingBox", (PyCFunction)PyOccurrence_GetBoundingBox, METH_NOARGS, "Returns the occurrence bounding box." }
, { "IsValid" , (PyCFunction)PyOccurrence_IsValid , METH_NOARGS, "Returns true if the occurrence is valid." }
, { "HasProperty" , (PyCFunction)PyOccurrence_HasProperty , METH_NOARGS, "Returns true if the occurrence owns some properties." }
, { "Delete" , (PyCFunction)PyOccurrence_Delete , METH_NOARGS
, "Delete associated hurricane object, the python object remains." }
, {NULL, NULL, 0, NULL} /* sentinel */
};
// x-------------------------------------------------------------x
// | "PyOccurrence" Object Methods |
// x-------------------------------------------------------------x
// ---------------------------------------------------------------
// Attribute Method : "PyOccurrence_new ()"
static PyObject* PyOccurrence_new(PyTypeObject *type, PyObject *args, PyObject *kwds) {
trace << "PyOccurrence_new()" << endl;
Occurrence* occurrence;
PyObject* arg0;
PyObject* arg1;
__cs.Init ("Occurrence.new");
if ( ! PyArg_ParseTuple(args,"|O&O&:Occurrence.new"
,Converter,&arg0
,Converter,&arg1
) ) return ( NULL );
if ( __cs.GetObjectIds() == NO_ARG ) { occurrence = new Occurrence (); }
else if ( __cs.GetObjectIds() == ENT_ARG ) { occurrence = new Occurrence ( PYENTITY_O(arg0) ); }
else if ( __cs.GetObjectIds() == COMP_PATH_ARG) { occurrence = new Occurrence ( PYSEGMENT_O(arg0)
, *PYPATH_O(arg1) ); }
else if ( __cs.GetObjectIds() == ENT_PATH_ARG ) { occurrence = new Occurrence ( PYENTITY_O(arg0)
, *PYPATH_O(arg1) ); }
else {
PyErr_SetString ( ConstructorError, "invalid number of parameters for Occurrence constructor. " );
return ( NULL );
}
PyOccurrence* pyOccurrence = PyObject_NEW(PyOccurrence, &PyTypeOccurrence);
if (pyOccurrence == NULL) return NULL;
HTRY
pyOccurrence->_object = occurrence;
HCATCH
return ( (PyObject*)pyOccurrence );
}
DirectDeleteMethod(PyOccurrence_DeAlloc,PyOccurrence)
PyTypeObjectLinkPyType(Occurrence)
PyTypeObjectConstructor(Occurrence)
# else // End of Python Module Code Part.
// x=================================================================x
// | "PyOccurrence" Shared Library Code Part |
// x=================================================================x
// ---------------------------------------------------------------
// PyOccurrence Object Definitions.
PyTypeRootObjectDefinitions(Occurrence)
# endif // End of Shared Library Code Part.
} // End of extern "C".
} // End of Isobar namespace.

View File

@ -0,0 +1,106 @@
// -*- 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é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: PyOccurrence.h,v 1.2 2006/05/03 14:00:03 jpc Exp $
//
// x-----------------------------------------------------------------x
// | |
// | 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@asim.lip6.fr |
// | =============================================================== |
// | C++ Header : "./PyOccurrence.h" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
# ifndef __PYOCCURRENCE__
# define __PYOCCURRENCE__
# include "PyHurricane.h"
# include "Occurrence.h"
namespace Isobar {
extern "C" {
// -------------------------------------------------------------------
// Python Object : "PyOccurrence".
typedef struct {
PyObject_HEAD
Hurricane::Occurrence* _object;
} PyOccurrence;
// -------------------------------------------------------------------
// Functions & Types exported to "PyHurricane.cpp".
extern PyTypeObject PyTypeOccurrence;
extern PyMethodDef PyOccurrence_Methods[];
extern void PyOccurrence_LinkPyType();
extern void PyOccurrence_Constructor();
#define IsPyOccurrence(v) ( (v)->ob_type == &PyTypeOccurrence )
#define PYOCCURRENCE(v) ( (PyOccurrence*)(v) )
#define PYOCCURRENCE_O(v) ( PYOCCURRENCE(v)->_object )
} // End of extern "C".
} // End of Isobar namespace.
# endif

View File

@ -0,0 +1,196 @@
// -*- 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é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
// ===================================================================
//
// x-----------------------------------------------------------------x
// | |
// | C O R I O L I S |
// | I s o b a r - Hurricane / Python Interface |
// | |
// | Author : Sophie BELLOEIL |
// | E-mail : Damien.Dupuis@lip6.fr |
// | =============================================================== |
// | C++ Module : "./PyNetLocator.cpp" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
# include "PyOccurrence.h"
# include "PyOccurrenceLocator.h"
namespace Isobar {
USING_NAMESPACE_HURRICANE
extern "C" {
# define METHOD_HEAD(function) GENERIC_METHOD_HEAD(Locator<Occurrence>,locator,function)
// x=================================================================x
// | "PyOccurrenceLocator" Python Module Code Part |
// x=================================================================x
# if defined(__PYTHON_MODULE__)
// x-------------------------------------------------------------x
// | "PyOccurrenceLocator" Attribute Methods |
// x-------------------------------------------------------------x
// ---------------------------------------------------------------
// Attribute Method : "PyOccurrenceLocator_Create ()"
// Standart Accessors (Attributes).
// Standart Predicates (Attributes).
DirectGetBoolAttribute(PyOccurrenceLocator_IsValid,IsValid,PyOccurrenceLocator,Locator<Occurrence>)
// Standart Delete (Attribute).
DirectDeleteAttribute(PyOccurrenceLocator_Delete,PyOccurrenceLocator)
// ---------------------------------------------------------------
// Attribute Method : "PyOccurrenceLocator_Progress ()"
static PyObject* PyOccurrenceLocator_Progress ( PyOccurrenceLocator *self )
{
trace << "OccurrenceLocator.Progress()" << endl;
HTRY
METHOD_HEAD ( "OccurrenceLocator.Progress()" )
locator->Progress ();
HCATCH
Py_RETURN_NONE;
}
// ---------------------------------------------------------------
// Attribute Method : "PyOccurrenceLocator_GetElement ()"
static PyObject* PyOccurrenceLocator_GetElement ( PyOccurrenceLocator *self )
{
trace << "OccurrenceLocator.GetElement()" << endl;
METHOD_HEAD ( "OccurrenceLocator.GetElement()" )
PyOccurrence* pyOccurrence = PyObject_NEW ( PyOccurrence, &PyTypeOccurrence );
if ( pyOccurrence == NULL ) return NULL;
HTRY
Occurrence occurrence = locator->GetElement ();
if ( occurrence == NULL )
Py_RETURN_NONE;
pyOccurrence->_object = new Occurrence ( occurrence );
HCATCH
return (PyObject*)pyOccurrence;
}
// ---------------------------------------------------------------
// Attribute Method : "PyOccurrenceLocator_GetClone ()"
static PyObject* PyOccurrenceLocator_GetClone ( PyOccurrenceLocator *self )
{
trace << "OccurrenceLocator.GetClone()" << endl;
METHOD_HEAD ( "OccurrenceLocator.GetClone()" )
PyOccurrenceLocator* pyOccurrenceLocator = NULL;
HTRY
pyOccurrenceLocator = PyObject_NEW ( PyOccurrenceLocator, &PyTypeOccurrenceLocator );
if ( pyOccurrenceLocator == NULL ) { return NULL; }
pyOccurrenceLocator->_object = locator->GetClone();
HCATCH
return ( (PyObject*)pyOccurrenceLocator );
}
// ---------------------------------------------------------------
// PyOccurrenceLocator Attribute Method table.
PyMethodDef PyOccurrenceLocator_Methods[] =
{ { "IsValid" , (PyCFunction)PyOccurrenceLocator_IsValid , METH_NOARGS , "Returns true while the walk has not exhausted the set of elements, else false." }
, { "Progress" , (PyCFunction)PyOccurrenceLocator_Progress , METH_NOARGS , "Moves forward the locator to the following element." }
, { "GetElement" , (PyCFunction)PyOccurrenceLocator_GetElement , METH_NOARGS , "Returns the current element (or the value Type() when the locator is not or no longer valid)." }
, { "GetClone" , (PyCFunction)PyOccurrenceLocator_GetClone , METH_NOARGS , "This function allocates and returns a new locator that will have the same visiting course than the remaining one of the locator being cloned." }
, { "Delete" , (PyCFunction)PyOccurrenceLocator_Delete , METH_NOARGS
, "Delete associated hurricane object, the python object remains." }
, {NULL, NULL, 0, NULL} /* sentinel */
};
// x-------------------------------------------------------------x
// | "PyOccurrenceLocator" Object Methods |
// x-------------------------------------------------------------x
DirectDeleteMethod(PyOccurrenceLocator_DeAlloc,PyOccurrenceLocator)
LocatorPyTypeObjectLinkPyType(Occurrence, Occurrence)
# else // End of Python Module Code Part.
// x=================================================================x
// | "PyOccurrenceLocator" Shared Library Code Part |
// x=================================================================x
// ---------------------------------------------------------------
// PyOccurrenceLocator Object Definitions.
PyTypeRootObjectDefinitions(OccurrenceLocator)
# endif // End of Shared Library Code Part.
} // End of extern "C".
} // End of Isobar namespace.

View File

@ -0,0 +1,98 @@
// -*- 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é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
// ===================================================================
//
// x-----------------------------------------------------------------x
// | |
// | 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@asim.lip6.fr |
// | =============================================================== |
// | C++ Header : "./PyOccurrenceLocator.h" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
# ifndef __PYOCCURRENCELOCATOR__
# define __PYOCCURRENCELOCATOR__
# include "PyHurricane.h"
# include "Occurrence.h"
namespace Isobar {
extern "C" {
// -------------------------------------------------------------------
// Python Object : "PyOccurrenceLocator".
typedef struct {
PyObject_HEAD
Hurricane::Locator<Hurricane::Occurrence>* _object;
} PyOccurrenceLocator;
// -------------------------------------------------------------------
// Functions & Types exported to "PyHurricane.ccp".
extern PyTypeObject PyTypeOccurrenceLocator;
extern PyMethodDef PyOccurrenceLocator_Methods[];
extern void PyOccurrenceLocator_LinkPyType ();
# define IsPyOccurrenceLocator(v) ( (v)->ob_type == &PyTypeOccurrenceLocator )
# define PYOCCURRENCELOCATOR(v) ( (PyOccurrenceLocator*)(v) )
# define PYOCCURRENCELOCATOR_O(v) ( PYOCCURRENCELOCATOR(v)->_object )
} // End of extern "C".
} // End of Isobar namespace.
# endif

View File

@ -0,0 +1,389 @@
// -*- 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é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: PyPath.cpp,v 1.6 2006/09/22 11:27:32 tsunami Exp $
//
// x-----------------------------------------------------------------x
// | |
// | 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@asim.lip6.fr |
// | =============================================================== |
// | C++ Module : "./PyPath.cpp" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#include "PyTransformation.h"
#include "PyName.h"
#include "PyPath.h"
#include "PyCell.h"
#include "PyInstance.h"
#include "PyInstanceLocator.h"
namespace Isobar {
USING_NAMESPACE_HURRICANE
extern "C" {
#define METHOD_HEAD(function) GENERIC_METHOD_HEAD(Path,path,function)
// x=================================================================x
// | "PyPath" Python Module Code Part |
// x=================================================================x
#if defined(__PYTHON_MODULE__)
// x-------------------------------------------------------------x
// | "PyPath" Attribute Methods |
// x-------------------------------------------------------------x
// Standart Accessors (Attributes).
// Standart Predicates (Attributes).
DirectGetBoolAttribute(PyPath_IsEmpty ,IsEmpty ,PyPath,Path)
// Standart Delete (Attribute).
DirectDeleteAttribute(PyPath_Delete,PyPath)
// ---------------------------------------------------------------
// Attribute Method : "PyPath_GetHeadInstance ()"
static PyObject* PyPath_GetHeadInstance ( PyPath *self )
{
trace << "PyPath_GetHeadInstance()" << endl;
METHOD_HEAD ( "Path.GetHeadInstance()" )
Instance* instance = NULL;
HTRY
instance = path->GetHeadInstance();
HCATCH
return PyInstance_Link ( instance );
}
// ---------------------------------------------------------------
// Attribute Method : "PyPath_GetTailInstance ()"
static PyObject* PyPath_GetTailInstance ( PyPath *self )
{
trace << "PyPath_GetTailInstance()" << endl;
METHOD_HEAD ( "Path.GetTailInstance()" )
Instance* instance = NULL;
HTRY
instance = path->GetTailInstance();
HCATCH
return PyInstance_Link ( instance );
}
// ---------------------------------------------------------------
// Attribute Method : "PyPath_GetOwnerCell ()"
static PyObject* PyPath_GetOwnerCell ( PyPath *self )
{
trace << "PyPath_GetOwnerCell()" << endl;
METHOD_HEAD ( "Path.GetOwnerCell()" )
Cell* cell = NULL;
HTRY
cell = path->GetOwnerCell();
HCATCH
return PyCell_Link ( cell );
}
// ---------------------------------------------------------------
// Attribute Method : "PyPath_GetMasterCell ()"
static PyObject* PyPath_GetMasterCell ( PyPath *self )
{
trace << "PyPath_GetMasterCell()" << endl;
METHOD_HEAD ( "Path.GetMasterCell()" )
Cell* cell = NULL;
HTRY
cell = path->GetMasterCell();
HCATCH
return PyCell_Link ( cell );
}
// ---------------------------------------------------------------
// Attribute Method : "PyPath_GetName ()"
static PyObject* PyPath_GetName ( PyPath *self )
{
trace << "PyPath_GetName ()" << endl;
METHOD_HEAD ( "Path.GetName()" )
PyName* pyName = PyObject_NEW ( PyName, &PyTypeName );
if ( pyName == NULL ) { return NULL; }
HTRY
pyName->_object = new Name ( path->GetName() );
HCATCH
return ( (PyObject*)pyName );
}
// ---------------------------------------------------------------
// Attribute Method : "PyPath_GetHeadPath ()"
static PyObject* PyPath_GetHeadPath ( PyPath *self )
{
trace << "PyPath_GetHeadPath ()" << endl;
METHOD_HEAD ( "Path.GetHeadPath()" )
PyPath* pyPath = PyObject_NEW ( PyPath, &PyTypePath );
if ( pyPath == NULL ) { return NULL; }
HTRY
pyPath->_object = new Path ( path->GetHeadPath() );
HCATCH
return ( (PyObject*)pyPath );
}
// ---------------------------------------------------------------
// Attribute Method : "PyPath_GetTailPath ()"
static PyObject* PyPath_GetTailPath ( PyPath *self )
{
trace << "PyPath_GetTailPath ()" << endl;
METHOD_HEAD ( "Path.GetTailPath()" )
PyPath* pyPath = PyObject_NEW ( PyPath, &PyTypePath );
if ( pyPath == NULL ) { return NULL; }
HTRY
pyPath->_object = new Path ( path->GetTailPath() );
HCATCH
return ( (PyObject*)pyPath );
}
// ---------------------------------------------------------------
// Attribute Method : "PyPath_GetTransformation ()"
static PyObject* PyPath_GetTransformation ( PyPath *self, PyObject* args )
{
trace << "PyPath_GetTransformation ()" << endl;
METHOD_HEAD ( "Instance.GetTransformation()" );
PyObject* arg0;
PyTransformation* pyTransf = PyObject_NEW ( PyTransformation, &PyTypeTransformation );
if ( pyTransf == NULL ) { return NULL; }
__cs.Init ("Path.GetTransformation");
if ( ! PyArg_ParseTuple(args,"|O&:Path.GetTransformation",Converter,&arg0) ) return ( NULL );
HTRY
if ( __cs.GetObjectIds() == NO_ARG )
{ pyTransf->_object = new Transformation ( path->GetTransformation () ); }
else if ( __cs.GetObjectIds() == TRANS_ARG )
{ pyTransf->_object = new Transformation ( path->GetTransformation (*PYTRANSFORMATION_O(arg0)) ); }
else {
PyErr_SetString ( ConstructorError, "invalid number of parameters for Path constructor." );
return ( NULL );
}
HCATCH
return ( (PyObject*)pyTransf );
}
// ---------------------------------------------------------------
// Attribute Method : "PyPath_GetInstancesLocator ()"
static PyObject* PyPath_GetInstancesLocator ( PyPath *self )
{
trace << "PyPath_GetInstancesLocator ()" << endl;
METHOD_HEAD ( "Path.GetInstancesLocator()" )
Instances instances = path->GetInstances ();
PyInstanceLocator* pyInstanceLocator = PyObject_NEW ( PyInstanceLocator, &PyTypeInstanceLocator );
if (pyInstanceLocator == NULL) { return NULL; }
HTRY
pyInstanceLocator->_object = instances.GetLocator ();
HCATCH
return ( (PyObject*)pyInstanceLocator );
}
// ---------------------------------------------------------------
// PyPath Attribute Method table.
PyMethodDef PyPath_Methods[] =
{ { "GetHeadInstance" , (PyCFunction)PyPath_GetHeadInstance , METH_NOARGS , "Return the head instance." }
, { "GetTailInstance" , (PyCFunction)PyPath_GetTailInstance , METH_NOARGS , "Return the tail instance." }
, { "GetHeadPath" , (PyCFunction)PyPath_GetHeadPath , METH_NOARGS , "Return the head path." }
, { "GetTailPath" , (PyCFunction)PyPath_GetTailPath , METH_NOARGS , "Return the tail path." }
, { "GetOwnerCell" , (PyCFunction)PyPath_GetOwnerCell , METH_NOARGS , "Return the cell owning the head instance." }
, { "GetMasterCell" , (PyCFunction)PyPath_GetMasterCell , METH_NOARGS , "Returns the master cell referenced by the last instance of the path." }
, { "GetName" , (PyCFunction)PyPath_GetName , METH_NOARGS , "Returns the concatenation of instances names." }
, { "GetTransformation" , (PyCFunction)PyPath_GetTransformation , METH_VARARGS, "Return the resulting transformation." }
, { "GetInstancesLocator", (PyCFunction)PyPath_GetInstancesLocator, METH_NOARGS , "Returns the collection of instances defining the path." }
, { "IsEmpty" , (PyCFunction)PyPath_IsEmpty , METH_NOARGS , "Return true if the path is empty." }
, { "Delete" , (PyCFunction)PyPath_Delete , METH_NOARGS
, "Delete associated hurricane object, the python object remains." }
, {NULL, NULL, 0, NULL} /* sentinel */
};
// x-------------------------------------------------------------x
// | "PyPath" Object Methods |
// x-------------------------------------------------------------x
// ---------------------------------------------------------------
// Attribute Method : "PyPath_new ()"
static PyObject* PyPath_new(PyTypeObject *type, PyObject *args, PyObject *kwds) {
trace << "PyPath_new()" << endl;
Path* path = NULL;
PyObject* arg0 = NULL;
PyObject* arg1 = NULL;
PyPath* pyPath = NULL;
__cs.Init ("Path.new");
if ( ! PyArg_ParseTuple(args,"|O&O&:Path.new"
,Converter,&arg0
,Converter,&arg1
) ) return ( NULL );
HTRY
if ( __cs.GetObjectIds() == NO_ARG ) { path = new Path (); }
else if ( __cs.GetObjectIds() == INST_ARG ) { path = new Path ( PYINSTANCE_O(arg0) ); }
else if ( __cs.GetObjectIds() == INST_PATH_ARG ) { path = new Path ( PYINSTANCE_O(arg0)
, *PYPATH_O(arg1) ); }
else if ( __cs.GetObjectIds() == PATH_INST_ARG ) { path = new Path ( *PYPATH_O(arg0)
, PYINSTANCE_O(arg1) ); }
else if ( __cs.GetObjectIds() == CELL_STRING_ARG ) { path = new Path ( PYCELL_O(arg0)
, PyString_AsString(arg1) ); }
else {
PyErr_SetString ( ConstructorError, "invalid number of parameters for Path constructor." );
return ( NULL );
}
pyPath = PyObject_NEW(PyPath, &PyTypePath);
if (pyPath == NULL) return NULL;
pyPath->_object = path;
HCATCH
return ( (PyObject*)pyPath );
}
DirectDeleteMethod(PyPath_DeAlloc,PyPath)
PyTypeObjectLinkPyType(Path)
PyTypeObjectConstructor(Path)
# else // End of Python Module Code Part.
// x=================================================================x
// | "PyPath" Shared Library Code Part |
// x=================================================================x
// ---------------------------------------------------------------
// PyPath Object Definitions.
PyTypeRootObjectDefinitions(Path)
# endif // End of Shared Library Code Part.
} // End of extern "C".
} // End of Isobar namespace.

View File

@ -0,0 +1,106 @@
// -*- 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é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: PyPath.h,v 1.2 2006/05/03 14:00:04 jpc Exp $
//
// x-----------------------------------------------------------------x
// | |
// | 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@asim.lip6.fr |
// | =============================================================== |
// | C++ Header : "./PyPath.h" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#ifndef __PYPATH__
#define __PYPATH__
#include "PyHurricane.h"
#include "Path.h"
namespace Isobar {
extern "C" {
// -------------------------------------------------------------------
// Python Object : "PyPath".
typedef struct {
PyObject_HEAD
Hurricane::Path* _object;
} PyPath;
// -------------------------------------------------------------------
// Functions & Types exported to "PyHurricane.cpp".
extern PyTypeObject PyTypePath;
extern PyMethodDef PyPath_Methods[];
extern void PyPath_LinkPyType();
extern void PyPath_Constructor();
#define IsPyPath(v) ( (v)->ob_type == &PyTypePath )
#define PYPATH(v) ( (PyPath*)(v) )
#define PYPATH_O(v) ( PYPATH(v)->_object )
} // End of extern "C".
} // End of Isobar namespace.
#endif

View File

@ -0,0 +1,259 @@
// -*- 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é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: PyPin.cpp,v 1.18 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 : Damien DUPUIS |
// | E-mail : Damien.Dupuis@asim.lip6.fr |
// | =============================================================== |
// | C++ Module : "./PyPin.cpp" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#include "PyPin.h"
#include "PyNet.h"
#include "PyName.h"
#include "PyLayer.h"
namespace Isobar {
USING_NAMESPACE_HURRICANE
extern "C" {
#undef ACCESS_OBJECT
#undef ACCESS_CLASS
#define ACCESS_OBJECT _baseObject._baseObject._baseObject._object
#define ACCESS_CLASS(_pyObject) &(_pyObject->_baseObject._baseObject._baseObject)
#define METHOD_HEAD(function) GENERIC_METHOD_HEAD(Pin,pin,function)
// x=================================================================x
// | "PyPin" Python Module Code Part |
// x=================================================================x
#if defined(__PYTHON_MODULE__)
// x-------------------------------------------------------------x
// | Global Constants Loading |
// x-------------------------------------------------------------x
extern void PinLoadConstants ( PyObject* dictionnary ) {
PyObject* constant;
LOAD_CONSTANT ( Pin::PlacementStatus::UNPLACED , "PinPlacementStatusUNPLACED" )
LOAD_CONSTANT ( Pin::PlacementStatus::PLACED , "PinPlacementStatusPLACED" )
LOAD_CONSTANT ( Pin::PlacementStatus::FIXED , "PinPlacementStatusFIXED" )
LOAD_CONSTANT ( Pin::AccessDirection::UNDEFINED, "PinAccessDirectionUNDEFINED" )
LOAD_CONSTANT ( Pin::AccessDirection::NORTH , "PinAccessDirectionNORTH" )
LOAD_CONSTANT ( Pin::AccessDirection::SOUTH , "PinAccessDirectionSOUTH" )
LOAD_CONSTANT ( Pin::AccessDirection::EAST , "PinAccessDirectionEAST" )
LOAD_CONSTANT ( Pin::AccessDirection::WEST , "PinAccessDirectionWEST" )
}
// x-------------------------------------------------------------x
// | "PyPin" Attribute Methods |
// x-------------------------------------------------------------x
// Standart Accessors (Attributes).
PyObject* PyPin_GetAccessDirection( PyPin* self ) {
trace << "PyNet_GetAccessDirection ()" << endl;
METHOD_HEAD ( "Net.GetAccessDirection()" )
return (PyObject *)Py_BuildValue("l", pin->GetAccessDirection().GetCode() );
}
// ---------------------------------------------------------------
// PyPin Attribute Method table.
PyMethodDef PyPin_Methods[] =
{ { "GetAccessDirection" , (PyCFunction)PyPin_GetAccessDirection , METH_NOARGS
, "Returns the pin accessdirection (by default set to UNDEFINED) ." }
, {NULL, NULL, 0, NULL} /* sentinel */
};
// x-------------------------------------------------------------x
// | "PyPin" Object Methods |
// x-------------------------------------------------------------x
static Pin::PlacementStatus PyInt_AsPlacementStatus ( PyObject* object ) {
switch ( PyInt_AsLong(object) ) {
case Pin::PlacementStatus::UNPLACED : return ( Pin::PlacementStatus(Pin::PlacementStatus::UNPLACED) );
case Pin::PlacementStatus::PLACED : return ( Pin::PlacementStatus(Pin::PlacementStatus::PLACED) );
case Pin::PlacementStatus::FIXED : return ( Pin::PlacementStatus(Pin::PlacementStatus::FIXED) );
}
return ( Pin::PlacementStatus(Pin::PlacementStatus::UNPLACED) );
}
static Pin::AccessDirection PyInt_AsAccessDirection ( PyObject* object ) {
switch ( PyInt_AsLong(object) ) {
case Pin::AccessDirection::UNDEFINED : return ( Pin::AccessDirection(Pin::AccessDirection::UNDEFINED) );
case Pin::AccessDirection::NORTH : return ( Pin::AccessDirection(Pin::AccessDirection::NORTH) );
case Pin::AccessDirection::SOUTH : return ( Pin::AccessDirection(Pin::AccessDirection::SOUTH) );
case Pin::AccessDirection::EAST : return ( Pin::AccessDirection(Pin::AccessDirection::EAST) );
case Pin::AccessDirection::WEST : return ( Pin::AccessDirection(Pin::AccessDirection::WEST) );
}
return ( Pin::AccessDirection(Pin::AccessDirection::UNDEFINED) );
}
// ---------------------------------------------------------------
// Attribute Method : "PyPin_new ()"
static PyObject* PyPin_new(PyTypeObject *type, PyObject *args, PyObject *kwds) {
Pin* pin = NULL;
HTRY
trace << "PyPin_new()" << endl;
PyObject* arg0;
PyObject* arg1;
PyObject* arg2;
PyObject* arg3;
PyObject* arg4;
PyObject* arg5;
PyObject* arg6;
PyObject* arg7;
PyObject* arg8;
__cs.Init ("Pin.new");
if ( ! PyArg_ParseTuple(args,"O&O&O&O&O&O&O&|O&O&:Pin.new"
, Converter, &arg0
, Converter, &arg1
, Converter, &arg2
, Converter, &arg3
, Converter, &arg4
, Converter, &arg5
, Converter, &arg6
, Converter, &arg7
, Converter, &arg8
) ) return ( NULL );
string pin_arg1 = ":ent:name:int:int:layer:int:int:int:int";
string pin_arg2 = ":ent:name:int:int:layer:int:int:int";
string pin_arg3 = ":ent:name:int:int:layer:int:int";
if ( __cs.GetObjectIds() == pin_arg1 ) { pin = Pin::Create ( PYNET_O ( arg0 )
, *PYNAME_O ( arg1 )
, PyInt_AsAccessDirection ( arg2 )
, PyInt_AsPlacementStatus ( arg3 )
, PYLAYER_O ( arg4 )
, PyInt_AsLong ( arg5 )
, PyInt_AsLong ( arg6 )
, PyInt_AsLong ( arg7 )
, PyInt_AsLong ( arg8 ) ); }
else if ( __cs.GetObjectIds() == pin_arg2 ) { pin = Pin::Create ( PYNET_O ( arg0 )
, *PYNAME_O ( arg1 )
, PyInt_AsAccessDirection ( arg2 )
, PyInt_AsPlacementStatus ( arg3 )
, PYLAYER_O ( arg4 )
, PyInt_AsLong ( arg5 )
, PyInt_AsLong ( arg6 )
, PyInt_AsLong ( arg7 ) ); }
else if ( __cs.GetObjectIds() == pin_arg3 ) { pin = Pin::Create ( PYNET_O ( arg0 )
, *PYNAME_O ( arg1 )
, PyInt_AsAccessDirection ( arg2 )
, PyInt_AsPlacementStatus ( arg3 )
, PYLAYER_O ( arg4 )
, PyInt_AsLong ( arg5 )
, PyInt_AsLong ( arg6 ) ); }
else {
PyErr_SetString ( ConstructorError, "invalid number of parameters for Pin constructor." );
return ( NULL );
}
HCATCH
return PyPin_Link ( pin );
}
DBoDeleteMethod(Pin)
PyTypeObjectLinkPyType(Pin)
PyTypeObjectConstructor(Pin)
#else // End of Python Module Code Part.
// x=================================================================x
// | "PyPin" Shared Library Code Part |
// x=================================================================x
// Link/Creation Method.
DBoLinkCreateMethod(PyPin_Link,PyPin,PyTypePin,Pin)
// ---------------------------------------------------------------
// PyPin Object Definitions.
PyTypeInheritedObjectDefinitions(Pin, Contact)
#endif // End of Shared Library Code Part.
} // End of extern "C".
} // End of Isobar namespace.

View File

@ -0,0 +1,93 @@
// -*- 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é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: PyPin.h,v 1.9 2006/11/29 10:40:25 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@asim.lip6.fr |
// | =============================================================== |
// | C++ Header : "./PyPin.h" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#ifndef __PYPIN__
#define __PYPIN__
#include "PyContact.h"
#include "Pin.h"
namespace Isobar {
USING_NAMESPACE_HURRICANE
extern "C" {
// -------------------------------------------------------------------
// Python Object : "PyPin".
typedef struct {
PyContact _baseObject;
} PyPin;
// -------------------------------------------------------------------
// Functions & Types exported to "PyHurricane.ccp".
extern PyTypeObject PyTypePin;
extern PyMethodDef PyPin_Methods[];
extern PyObject* PyPin_Link(Hurricane::Pin* object );
extern void PinLoadConstants( PyObject* dictionnary );
extern void PyPin_LinkPyType();
extern void PyPin_Constructor();
# define IsPyPin(v) ( (v)->ob_type == &PyTypePin )
# define PYPIN(v) ( (PyPin*)(v) )
# define PYPIN_O(v) ( PYPIN(v)->_baseObject._baseObject._baseObject._object )
} // End of extern "C".
} // End of Isobar namespace.
# endif

View File

@ -0,0 +1,151 @@
// -*- 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é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: PyPinLocator.cpp,v 1.9 2006/09/22 11:27:32 tsunami 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 : "./PyPinLocator.cpp" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
# include "PyPinLocator.h"
# include "PyPin.h"
namespace Isobar {
USING_NAMESPACE_HURRICANE
extern "C" {
# undef ACCESS_OBJECT
# define ACCESS_OBJECT _object
# define METHOD_HEAD(function) GENERIC_METHOD_HEAD(Locator<Pin*>,locator,function)
// x=================================================================x
// | "PyPin" Python Module Code Part |
// x=================================================================x
# if defined(__PYTHON_MODULE__)
// x-------------------------------------------------------------x
// | "PyPinLocator" Attribute Methods |
// x-------------------------------------------------------------x
// Standart Accessors (Attributes).
// Standart Predicates (Attributes).
DirectGetBoolAttribute(PyPinLocator_IsValid,IsValid,PyPinLocator,Locator<Pin*>)
// Standart Locator Accessors (Attributes).
LocatorProgressAttribute(Pin)
LocatorGetElementAttribute(Pin)
LocatorGetCloneAttribute(Pin)
// Standart Delete (Attribute).
DirectDeleteAttribute(PyPinLocator_Delete,PyPinLocator)
// ---------------------------------------------------------------
// PyPinLocator Attribute Method table.
PyMethodDef PyPinLocator_Methods[] =
{ { "IsValid" , (PyCFunction)PyPinLocator_IsValid , METH_NOARGS , "Returns true while the walk has not exhausted the set of elements, else false." }
, { "Progress" , (PyCFunction)PyPinLocator_Progress , METH_NOARGS , "Moves forward the locator to the following element." }
, { "GetElement" , (PyCFunction)PyPinLocator_GetElement , METH_NOARGS , "Returns the current element (or the value Type() when the locator is not or no longer valid)." }
, { "GetClone" , (PyCFunction)PyPinLocator_GetClone , METH_NOARGS , "This function allocates and returns a new locator that will have the same visiting course than the remaining one of the locator being cloned." }
, { "Delete" , (PyCFunction)PyPinLocator_Delete , METH_NOARGS
, "Delete associated hurricane object, the python object remains." }
, {NULL, NULL, 0, NULL} /* sentinel */
};
// x-------------------------------------------------------------x
// | "PyPinLocator" Object Methods |
// x-------------------------------------------------------------x
DirectDeleteMethod(PyPinLocator_DeAlloc,PyPinLocator)
LocatorPyTypeObjectLinkPyType(Pin, Pin*)
# else // End of Python Module Code Part.
// x=================================================================x
// | "PyPin" Shared Library Code Part |
// x=================================================================x
// ---------------------------------------------------------------
// PyPinLocator Object Definitions.
PyTypeRootObjectDefinitions(PinLocator)
# endif // End of Shared Library Code Part.
} // End of extern "C".
} // End of Isobar namespace.

View File

@ -0,0 +1,107 @@
// -*- 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é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: PyPinLocator.h,v 1.3 2006/05/03 14:00:04 jpc 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++ Header : "./PyPinLocator.h" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
# ifndef __PYPINLOCATOR__
# define __PYPINLOCATOR__
# include "PyHurricane.h"
# include "Locator.h"
# include "Pin.h"
namespace Isobar {
extern "C" {
// -------------------------------------------------------------------
// Python Object : "PyPinLocator".
typedef struct {
PyObject_HEAD
Hurricane::Locator<Hurricane::Pin*>* _object;
} PyPinLocator;
// -------------------------------------------------------------------
// Functions & Types exported to "PyHurricane.ccp".
extern PyTypeObject PyTypePinLocator;
extern PyMethodDef PyPinLocator_Methods[];
extern void PyPinLocator_LinkPyType ();
# define IsPyPinLocator(v) ( (v)->ob_type == &PyTypePinLocator )
# define PYPINLOCATOR(v) ( (PyPinLocator*)(v) )
# define PYPINLOCATOR_O(v) ( PYPINLOCATOR(v)->_object )
} // End of extern "C".
} // End of Isobar namespace.
# endif

View File

@ -0,0 +1,223 @@
// -*- 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é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: PyPlug.cpp,v 1.21 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 : "./PyPlug.cpp" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
# include "PyPlug.h"
# include "PyInstance.h"
# include "PyNet.h"
namespace Isobar {
USING_NAMESPACE_HURRICANE
extern "C" {
# undef ACCESS_OBJECT
# undef ACCESS_CLASS
# define ACCESS_OBJECT _baseObject._baseObject._object
# define ACCESS_CLASS(_pyObject) &(_pyObject->_baseObject._baseObject)
# define METHOD_HEAD(function) GENERIC_METHOD_HEAD(Plug,plug,function)
// x=================================================================x
// | "PyPlug" Python Module Code Part |
// x=================================================================x
# if defined(__PYTHON_MODULE__)
// x-------------------------------------------------------------x
// | "PyPlug" Attribute Methods |
// x-------------------------------------------------------------x
// Standart Predicates (Attributes).
DirectGetBoolAttribute(PyPlug_IsConnected,IsConnected,PyPlug,Plug)
// ---------------------------------------------------------------
// Attribute Method : "PyPlug_GetInstance ()"
static PyObject* PyPlug_GetInstance ( PyPlug *self )
{
trace << "PyPlug_GetInstance ()" << endl;
Instance* instance = NULL;
HTRY
METHOD_HEAD ( "Plug.GetInstance()" )
instance = plug->GetInstance ( );
HCATCH
return PyInstance_Link ( instance );
}
// ---------------------------------------------------------------
// Attribute Method : "PyPlug_GetMasterNet ()"
static PyObject* PyPlug_GetMasterNet ( PyPlug *self )
{
trace << "PyPlug_GetMasterNet ()" << endl;
Net* net = NULL;
HTRY
METHOD_HEAD ( "Plug.GetMasterNet()" )
net = plug->GetMasterNet ( );
HCATCH
return PyNet_Link ( net );
}
// ---------------------------------------------------------------
// Attribute Method : "PyPlug_GetNet ()"
static PyObject* PyPlug_GetNet ( PyPlug *self )
{
trace << "PyPlug_GetNet ()" << endl;
Net* net = NULL;
HTRY
METHOD_HEAD ( "Plug.GetNet()" )
net = plug->GetNet ( );
HCATCH
return PyNet_Link ( net );
}
// ---------------------------------------------------------------
// Attribute Method : "PyPlug_SetNet ()"
static PyObject* PyPlug_SetNet ( PyPlug *self, PyObject* args )
{
trace << "PyPlug_SetNet()" << endl;
HTRY
METHOD_HEAD ( "Plug.SetNet()" )
PyNet* net;
if ( ! ParseOneArg ( "Plug.SetNet", args, NET_ARG, (PyObject**)&net ) ) return ( NULL );
plug->SetNet ( PYNET_O(net) );
HCATCH
Py_RETURN_NONE;
}
// ---------------------------------------------------------------
// PyPlug Attribute Method table.
PyMethodDef PyPlug_Methods[] =
{ { "GetInstance" , (PyCFunction)PyPlug_GetInstance , METH_NOARGS , "Return the instance to which belongs the plug." }
, { "GetMasterNet" , (PyCFunction)PyPlug_GetMasterNet , METH_NOARGS , "Returns the external net referenced by the plug in the master cell of its instance." }
, { "GetNet" , (PyCFunction)PyPlug_GetNet , METH_NOARGS , "Returns the net connected by the plug in the cell of its instance." }
, { "IsConnected" , (PyCFunction)PyPlug_IsConnected , METH_NOARGS , "Returns true if the plug is connected, else false." }
, { "SetNet" , (PyCFunction)PyPlug_SetNet , METH_VARARGS, "This method allows to connect or change the net of a plug." }
, {NULL, NULL, 0, NULL} /* sentinel */
};
// x-------------------------------------------------------------x
// | "PyPlug" Object Methods |
// x-------------------------------------------------------------x
DBoDeleteMethod(Plug)
PyTypeObjectLinkPyType(Plug)
# else // End of Python Module Code Part.
// x=================================================================x
// | "PyPlug" Shared Library Code Part |
// x=================================================================x
// Link/Creation Method.
DBoLinkCreateMethod(PyPlug_Link,PyPlug,PyTypePlug,Plug)
// ---------------------------------------------------------------
// PyPlug Object Definitions.
PyTypeInheritedObjectDefinitions(Plug, Component)
# endif // End of Shared Library Code Part.
} // End of extern "C".
} // End of Isobar namespace.

View File

@ -0,0 +1,106 @@
// -*- 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é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: PyPlug.h,v 1.6 2006/05/03 14:00:04 jpc 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++ Header : "./PyPlug.h" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
# ifndef __PYPLUG__
# define __PYPLUG__
# include "PyComponent.h"
# include "Plug.h"
namespace Isobar {
extern "C" {
// -------------------------------------------------------------------
// Python Object : "PyPlug".
typedef struct {
PyComponent _baseObject;
} PyPlug;
// -------------------------------------------------------------------
// Functions & Types exported to "PyHurricane.ccp".
extern PyTypeObject PyTypePlug;
extern PyMethodDef PyPlug_Methods[];
extern PyObject* PyPlug_Link ( Hurricane::Plug* object );
extern void PyPlug_LinkPyType ();
# define IsPyPlug(v) ( (v)->ob_type == &PyTypePlug )
# define PYPLUG(v) ( (PyPlug*)(v) )
# define PYPLUG_O(v) ( PYPLUG(v)->_baseObject._baseObject._object )
} // End of extern "C".
} // End of Isobar namespace.
# endif

View File

@ -0,0 +1,146 @@
// -*- 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é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: PyPlugLocator.cpp,v 1.12 2006/09/22 11:27:32 tsunami 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 : "./PyPlugLocator.cpp" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
# include "PyPlugLocator.h"
# include "PyPlug.h"
namespace Isobar {
USING_NAMESPACE_HURRICANE
extern "C" {
# undef ACCESS_OBJECT
# define ACCESS_OBJECT _object
# define METHOD_HEAD(function) GENERIC_METHOD_HEAD(Locator<Plug*>,locator,function)
// x=================================================================x
// | "PyPlugLocator" Python Module Code Part |
// x=================================================================x
# if defined(__PYTHON_MODULE__)
// x-------------------------------------------------------------x
// | "PyPlugLocator" Attribute Methods |
// x-------------------------------------------------------------x
// Standart Accessors (Attributes).
// Standart Predicates (Attributes).
DirectGetBoolAttribute(PyPlugLocator_IsValid,IsValid,PyPlugLocator,Locator<Plug*>)
// Standart Locator Accessors (Attributes).
LocatorProgressAttribute(Plug)
LocatorGetElementAttribute(Plug)
LocatorGetCloneAttribute(Plug)
// ---------------------------------------------------------------
// PyPlugLocator Attribute Method table.
PyMethodDef PyPlugLocator_Methods[] =
{ { "IsValid" , (PyCFunction)PyPlugLocator_IsValid , METH_NOARGS , "Returns true while the walk has not exhausted the set of elements, else false." }
, { "Progress" , (PyCFunction)PyPlugLocator_Progress , METH_NOARGS , "Moves forward the locator to the following element." }
, { "GetElement" , (PyCFunction)PyPlugLocator_GetElement , METH_NOARGS , "Returns the current element (or the value Type() when the locator is not or no longer valid)." }
, { "GetClone" , (PyCFunction)PyPlugLocator_GetClone , METH_NOARGS , "This function allocates and returns a new locator that will have the same visiting course than the remaining one of the locator being cloned." }
, {NULL, NULL, 0, NULL} /* sentinel */
};
// x-------------------------------------------------------------x
// | "PyPlugLocator" Object Methods |
// x-------------------------------------------------------------x
DirectDeleteMethod(PyPlugLocator_DeAlloc,PyPlugLocator)
LocatorPyTypeObjectLinkPyType(Plug, Plug*)
# else // End of Python Module Code Part.
// x=================================================================x
// | "PyCell" Shared Library Code Part |
// x=================================================================x
// ---------------------------------------------------------------
// PyPlugLocator Object Definitions.
PyTypeRootObjectDefinitions(PlugLocator)
# endif // End of Shared Library Code Part.
} // End of extern "C".
} // End of Isobar namespace.

View File

@ -0,0 +1,107 @@
// -*- 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é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: PyPlugLocator.h,v 1.5 2006/05/03 14:00:04 jpc 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++ Header : "./PyPlugLocator.h" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
# ifndef __PYPLUGLOCATOR__
# define __PYPLUGLOCATOR__
# include "PyHurricane.h"
# include "Locator.h"
# include "Plug.h"
namespace Isobar {
extern "C" {
// -------------------------------------------------------------------
// Python Object : "PyPlugLocator".
typedef struct {
PyObject_HEAD
Hurricane::Locator<Hurricane::Plug*>* _object;
} PyPlugLocator;
// -------------------------------------------------------------------
// Functions & Types exported to "PyHurricane.ccp".
extern PyTypeObject PyTypePlugLocator;
extern PyMethodDef PyPlugLocator_Methods[];
extern void PyPlugLocator_LinkPyType ();
# define IsPyPlugLocator(v) ( (v)->ob_type == &PyTypePlugLocator )
# define PYPLUGLOCATOR(v) ( (PyPlugLocator*)(v) )
# define PYPLUGLOCATOR_O(v) ( PYPLUGLOCATOR(v)->_object )
} // End of extern "C".
} // End of Isobar namespace.
# endif

View File

@ -0,0 +1,203 @@
// -*- 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é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: PyPoint.cpp,v 1.17 2006/09/22 11:27:32 tsunami Exp $
//
// x-----------------------------------------------------------------x
// | |
// | 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@asim.lip6.fr |
// | =============================================================== |
// | C++ Module : "./PyPoint.cpp" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#include "PyPoint.h"
namespace Isobar {
USING_NAMESPACE_HURRICANE
extern "C" {
#define METHOD_HEAD(function) GENERIC_METHOD_HEAD(Point,point,function)
// x=================================================================x
// | "PyPoint" Python Module Code Part |
// x=================================================================x
#if defined(__PYTHON_MODULE__)
// x-------------------------------------------------------------x
// | "PyPoint" Attribute Methods |
// x-------------------------------------------------------------x
// ---------------------------------------------------------------
// Attribute Method : "PyPoint_Translate ()"
static PyObject* PyPoint_Translate ( PyPoint *self, PyObject* args )
{
trace << "PyPoint_Translate()" << endl;
HTRY
METHOD_HEAD ( "Box.Translate()" )
PyObject* arg0;
PyObject* arg1;
if ( ! ParseTwoArg ( "Box.Translate", args, INTS2_ARG, &arg0, &arg1 ) ) return ( NULL );
point->translate ( PyInt_AsLong(arg0), PyInt_AsLong(arg1) );
HCATCH
Py_RETURN_NONE;
}
// Standart Accessors (Attributes).
DirectGetLongAttribute(PyPoint_GetX,getX,PyPoint,Point)
DirectGetLongAttribute(PyPoint_GetY,getY,PyPoint,Point)
DirectSetLongAttribute(PyPoint_SetX,setX,"Point.setX",PyPoint,Point)
DirectSetLongAttribute(PyPoint_SetY,setY,"Point.setY",PyPoint,Point)
// Standart Delete (Attribute).
DirectDeleteAttribute(PyPoint_Delete,PyPoint)
// ---------------------------------------------------------------
// PyPoint Attribute Method table.
PyMethodDef PyPoint_Methods[] =
{ { "GetX" , (PyCFunction)PyPoint_GetX , METH_NOARGS , "Return the Point X value." }
, { "GetY" , (PyCFunction)PyPoint_GetY , METH_NOARGS , "Return the Point Y value." }
, { "SetX" , (PyCFunction)PyPoint_SetX , METH_VARARGS, "Modify the Point X value." }
, { "SetY" , (PyCFunction)PyPoint_SetY , METH_VARARGS, "Modify the Point Y value." }
, { "Translate", (PyCFunction)PyPoint_Translate, METH_VARARGS, "Translate the point of dx and dy." }
, { "Delete" , (PyCFunction)PyPoint_Delete , METH_NOARGS
, "Delete associated hurricane object The python object remains." }
, {NULL, NULL, 0, NULL} /* sentinel */
};
// x-------------------------------------------------------------x
// | "PyPoint" Object Methods |
// x-------------------------------------------------------------x
static PyObject* PyPoint_new(PyTypeObject *type, PyObject *args, PyObject *kwds) {
trace << "PyPoint_new()" << endl;
Point* point;
PyObject* arg0;
PyObject* arg1;
__cs.Init ("Point.Create");
if ( ! PyArg_ParseTuple(args,"|O&O&:Point.Create"
,Converter,&arg0
,Converter,&arg1
) ) return ( NULL );
if ( __cs.GetObjectIds() == NO_ARG ) { point = new Point (); }
else if ( __cs.GetObjectIds() == POINT_ARG ) { point = new Point ( *PYPOINT_O(arg0) ); }
else if ( __cs.GetObjectIds() == INTS2_ARG ) { point = new Point ( PyInt_AsLong(arg0)
, PyInt_AsLong(arg1) ); }
else {
PyErr_SetString ( ConstructorError, "invalid number of parameters for Point constructor." );
return ( NULL );
}
PyPoint* pyPoint = PyObject_NEW(PyPoint, &PyTypePoint);
if (pyPoint == NULL) { return NULL; }
HTRY
pyPoint->_object = point;
HCATCH
return ( (PyObject*)pyPoint );
}
DirectDeleteMethod(PyPoint_DeAlloc,PyPoint)
PyTypeObjectLinkPyType(Point)
PyTypeObjectConstructor(Point)
#else // End of Python Module Code Part.
// x=================================================================x
// | "PyPoint" Shared Library Code Part |
// x=================================================================x
// ---------------------------------------------------------------
// PyPoint Object Definitions.
PyTypeRootObjectDefinitions(Point)
#endif // End of Shared Library Code Part.
} // End of extern "C".
} // End of Isobar namespace.

View File

@ -0,0 +1,107 @@
// -*- 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é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: PyPoint.h,v 1.6 2006/05/03 14:00:04 jpc Exp $
//
// x-----------------------------------------------------------------x
// | |
// | 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@asim.lip6.fr |
// | =============================================================== |
// | C++ Header : "./PyPoint.h" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
# ifndef __PYPOINT__
# define __PYPOINT__
# include "PyHurricane.h"
# include "Point.h"
namespace Isobar {
extern "C" {
// -------------------------------------------------------------------
// Python Object : "PyPoint".
typedef struct {
PyObject_HEAD
Hurricane::Point* _object;
} PyPoint;
// -------------------------------------------------------------------
// Functions & Types exported to "PyHurricane.ccp".
extern PyTypeObject PyTypePoint;
extern PyMethodDef PyPoint_Methods[];
extern void PyPoint_LinkPyType();
extern void PyPoint_Constructor();
# define IsPyPoint(v) ( (v)->ob_type == &PyTypePoint )
# define PYPOINT(v) ( (PyPoint*)(v) )
# define PYPOINT_O(v) ( PYPOINT(v)->_object )
} // End of extern "C".
} // End of Isobar namespace.
# endif

View File

@ -0,0 +1,274 @@
// -*- 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é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: PyReference.cpp,v 1.8 2008/02/07 17:09:42 xtof Exp $
//
// x-----------------------------------------------------------------x
// | |
// | 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@asim.lip6.fr |
// | =============================================================== |
// | C++ Module : "./PyReference.cpp" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
# include "PyReference.h"
# include "PyPoint.h"
# include "PyName.h"
# include "PyCell.h"
# include "PyNet.h"
namespace Isobar {
USING_NAMESPACE_HURRICANE
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(Reference,reference,function)
// x=================================================================x
// | "PyReference" Python Module Code Part |
// x=================================================================x
# if defined(__PYTHON_MODULE__)
// x-------------------------------------------------------------x
// | "PyReference" Attribute Methods |
// x-------------------------------------------------------------x
// Standart Accessors (Attributes).
// Standart Delete (Attribute).
DBoDeleteAttribute(PyReference_Delete,PyReference)
// ---------------------------------------------------------------
// Attribute Method : "PyReference_GetName ()"
static PyObject* PyReference_GetName ( PyReference *self )
{
trace << "PyReference_GetName ()" << endl;
METHOD_HEAD ( "Reference.GetName()" )
PyName* pyName = PyObject_NEW ( PyName, &PyTypeName );
if ( pyName == NULL ) { return NULL; }
HTRY
trace_in ();
trace << "new PyName [" << hex << pyName << "]" << endl;
trace_out ();
pyName->_object = new Name ( reference->GetName() );
HCATCH
return ( (PyObject*)pyName );
}
// ---------------------------------------------------------------
// Attribute Method : "PyReference_GetPoint ()"
static PyObject* PyReference_GetPoint ( PyReference *self )
{
trace << "PyReference_GetPoint()" << endl;
METHOD_HEAD ( "Reference.GetPoint()" )
PyPoint* pyPoint = PyObject_NEW ( PyPoint, &PyTypePoint );
if (pyPoint == NULL) { return NULL; }
HTRY
pyPoint->_object = new Point ( reference->GetPoint() );
HCATCH
return ( (PyObject*)pyPoint );
}
// ---------------------------------------------------------------
// Attribute Method : "PyReference_Translate ()"
static PyObject* PyReference_Translate ( PyReference *self, PyObject* args )
{
trace << "PyReference_Translate ()" << endl;
METHOD_HEAD ( "Reference.Translate()" )
PyObject* arg0;
PyObject* arg1;
HTRY
if ( ! ParseTwoArg ( "Reference.Translate", args, INTS2_ARG, &arg0, &arg1 ) ) return ( NULL );
reference->Translate ( PyInt_AsLong(arg0), PyInt_AsLong(arg1) );
HCATCH
Py_RETURN_NONE;
}
// ---------------------------------------------------------------
// PyReference Attribute Method table.
PyMethodDef PyReference_Methods[] =
{ { "Delete" , (PyCFunction)PyReference_Delete , METH_NOARGS
, "Delete associated hurricane object, the python object remains." }
, { "GetName" , (PyCFunction)PyReference_GetName , METH_NOARGS , "Returns the name of the reference." }
, { "GetPoint" , (PyCFunction)PyReference_GetPoint , METH_NOARGS , "Return the reference point." }
, { "Translate" , (PyCFunction)PyReference_Translate , METH_VARARGS, "Translate the reference of dx and dy." }
, {NULL, NULL, 0, NULL} /* sentinel */
};
// x-------------------------------------------------------------x
// | "PyReference" Object Methods |
// x-------------------------------------------------------------x
// ---------------------------------------------------------------
// Attribute Method : "PyReference_new ()"
static PyObject* PyReference_new(PyTypeObject *type, PyObject *args, PyObject *kwds) {
trace << "PyReference_new()" << endl;
PyObject* arg0;
PyObject* arg1;
PyObject* arg2;
PyObject* arg3;
Reference* reference = NULL;
HTRY
__cs.Init ("Reference.new");
if ( ! PyArg_ParseTuple(args,"O&O&O&|O&:Reference.new"
,Converter,&arg0
,Converter,&arg1
,Converter,&arg2
,Converter,&arg3
) ) return ( NULL );
if ( __cs.GetObjectIds() == CELL_NAME_INTS2_ARG )
reference = Reference::Create ( PYCELL_O(arg0)
, *PYNAME_O(arg1)
, PyInt_AsLong(arg2)
, PyInt_AsLong(arg3) );
else if ( __cs.GetObjectIds() == CELL_NAME_POINT_ARG )
reference = Reference::Create ( PYCELL_O(arg0)
, *PYNAME_O(arg1)
, *PYPOINT_O(arg2) );
else {
PyErr_SetString ( ConstructorError, "invalid number of parameters for Reference constructor." );
return ( NULL );
}
if (reference == NULL) { printf("error of creation of reference \n"); return (NULL) ; }
HCATCH
return PyReference_Link ( reference );
}
DBoDeleteMethod(Reference)
PyTypeObjectLinkPyType(Reference)
PyTypeObjectConstructor(Reference)
# else // End of Python Module Code Part.
// x=================================================================x
// | "PyReference" Shared Library Code Part |
// x=================================================================x
// Link/Creation Method.
DBoLinkCreateMethod(PyReference_Link,PyReference,PyTypeReference,Reference)
// ---------------------------------------------------------------
// PyReference Object Definitions.
PyTypeInheritedObjectDefinitions(Reference, Entity)
# endif // End of Shared Library Code Part.
} // End of extern "C".
} // End of Isobar namespace.

View File

@ -0,0 +1,107 @@
// -*- 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é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: PyReference.h,v 1.2 2006/05/03 14:00:04 jpc Exp $
//
// x-----------------------------------------------------------------x
// | |
// | 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@asim.lip6.fr |
// | =============================================================== |
// | C++ Header : "./PyReference.h" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#ifndef __PYREFERENCE__
#define __PYREFERENCE__
#include "PyEntity.h"
#include "Reference.h"
namespace Isobar {
extern "C" {
// -------------------------------------------------------------------
// Python Object : "PyReference".
typedef struct {
PyEntity _baseObject;
} PyReference;
// -------------------------------------------------------------------
// Functions & Types exported to "PyHurricane.ccp".
extern PyTypeObject PyTypeReference;
extern PyMethodDef PyReference_Methods[];
extern PyObject* PyReference_Link ( Hurricane::Reference* object );
extern void PyReference_LinkPyType();
extern void PyReference_Constructor();
#define IsPyReference(v) ((v)->ob_type == &PyTypeReference )
#define PYREFERENCE(v) ((PyReference*)(v) )
#define PYREFERENCE_O(v) (PYREFERENCE(v)->_baseObject._object)
} // End of extern "C".
} // End of Isobar namespace.
#endif

View File

@ -0,0 +1,147 @@
// -*- 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é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
// ===================================================================
//
// 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 : "./PyReferenceLocator.cpp" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
# include "PyReferenceLocator.h"
# include "PyReference.h"
namespace Isobar {
USING_NAMESPACE_HURRICANE
extern "C" {
# define METHOD_HEAD(function) GENERIC_METHOD_HEAD(Locator<Reference*>,locator,function)
// x=================================================================x
// | "PyReferenceLocator" Python Module Code Part |
// x=================================================================x
# if defined(__PYTHON_MODULE__)
// x-------------------------------------------------------------x
// | "PyReferenceLocator" Attribute Methods |
// x-------------------------------------------------------------x
// Standart Accessors (Attributes).
// Standart Predicates (Attributes).
DirectGetBoolAttribute(PyReferenceLocator_IsValid,IsValid,PyReferenceLocator,Locator<Reference*>)
// Standart Locator Accessors (Attributes).
LocatorProgressAttribute(Reference)
LocatorGetElementAttribute(Reference)
LocatorGetCloneAttribute(Reference)
// Standart Delete (Attribute).
DirectDeleteAttribute(PyReferenceLocator_Delete,PyReferenceLocator)
// ---------------------------------------------------------------
// PyReferenceLocator Attribute Method table.
PyMethodDef PyReferenceLocator_Methods[] =
{ { "IsValid" , (PyCFunction)PyReferenceLocator_IsValid , METH_NOARGS , "Returns true while the walk has not exhausted the set of elements, else false." }
, { "Progress" , (PyCFunction)PyReferenceLocator_Progress , METH_NOARGS , "Moves forward the locator to the following element." }
, { "GetElement" , (PyCFunction)PyReferenceLocator_GetElement , METH_NOARGS , "Returns the current element (or the value Type() when the locator is not or no longer valid)." }
, { "GetClone" , (PyCFunction)PyReferenceLocator_GetClone , METH_NOARGS , "This function allocates and returns a new locator that will have the same visiting course than the remaining one of the locator being cloned." }
, { "Delete" , (PyCFunction)PyReferenceLocator_Delete , METH_NOARGS
, "Delete associated hurricane object, the python object remains." }
, {NULL, NULL, 0, NULL} /* sentinel */
};
// x-------------------------------------------------------------x
// | "PyReferenceLocator" Object Methods |
// x-------------------------------------------------------------x
DirectDeleteMethod(PyReferenceLocator_DeAlloc,PyReferenceLocator)
LocatorPyTypeObjectLinkPyType(Reference, Reference*)
# else // End of Python Module Code Part.
// x=================================================================x
// | "PyReferenceLocator" Shared Library Code Part |
// x=================================================================x
// ---------------------------------------------------------------
// PyReferenceLocator Object Definitions.
PyTypeRootObjectDefinitions(ReferenceLocator)
# endif // End of Shared Library Code Part.
} // End of extern "C".
} // End of Isobar namespace.

View File

@ -0,0 +1,100 @@
// -*- 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é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
// ===================================================================
//
// 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++ Header : "./PyReferenceLocator.h" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
# ifndef __PYREFERENCELOCATOR__
# define __PYREFERENCELOCATOR__
# include "PyHurricane.h"
# include "Locator.h"
# include "Reference.h"
namespace Isobar {
extern "C" {
// -------------------------------------------------------------------
// Python Object : "PyReferenceLocator".
typedef struct {
PyObject_HEAD
Hurricane::Locator<Hurricane::Reference*>* _object;
} PyReferenceLocator;
// -------------------------------------------------------------------
// Functions & Types exported to "PyHurricane.ccp".
extern PyTypeObject PyTypeReferenceLocator;
extern PyMethodDef PyReferenceLocator_Methods[];
extern void PyReferenceLocator_LinkPyType ();
# define IsPyReferenceLocator(v) ( (v)->ob_type == &PyTypeReferenceLocator )
# define PYREFERENCELOCATOR(v) ( (PyReferenceLocator*)(v) )
# define PYREFERENCELOCATOR_O(v) ( PYREFERENCELOCATOR(v)->_object )
} // End of extern "C".
} // End of Isobar namespace.
# endif

View File

@ -0,0 +1,191 @@
// -*- 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é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: PySegment.cpp,v 1.12 2008/02/07 17:09:42 xtof Exp $
//
// x-----------------------------------------------------------------x
// | |
// | 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@asim.lip6.fr |
// | =============================================================== |
// | C++ Module : "./PySegment.cpp" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
# include "PyNet.h"
# include "PyLayer.h"
# include "PySegment.h"
# include "PyHorizontal.h"
# include "PyVertical.h"
# include "PyPoint.h"
namespace Isobar {
USING_NAMESPACE_HURRICANE
extern "C" {
# undef ACCESS_OBJECT
# undef ACCESS_CLASS
# define ACCESS_OBJECT _baseObject._baseObject._object
# define ACCESS_CLASS(_pyObject) &(_pyObject->_baseObject._baseObject)
# define METHOD_HEAD(function) GENERIC_METHOD_HEAD(Segment,segment,function)
// x=================================================================x
// | "PySegment" Python Module Code Part |
// x=================================================================x
# if defined(__PYTHON_MODULE__)
// x-------------------------------------------------------------x
// | "PySegment" Attribute Methods |
// x-------------------------------------------------------------x
// Standart Accessors (Attributes).
DirectGetLongAttribute(PySegment_GetSourceX,GetSourceX,PySegment,Segment)
DirectGetLongAttribute(PySegment_GetSourceY,GetSourceY,PySegment,Segment)
DirectGetLongAttribute(PySegment_GetWidth ,GetWidth, PySegment,Segment)
// Standart Delete (Attribute).
DBoDeleteAttribute(PySegment_Delete,PySegment)
// ---------------------------------------------------------------
// Attribute Method : "PySegment_GetSourcePosition ()"
static PyObject* PySegment_GetSourcePosition ( PySegment *self )
{
trace << "PySegment_GetSourcePosition()" << endl;
METHOD_HEAD ( "Segment.SourcePosition()" )
PyPoint* pyPoint = PyObject_NEW ( PyPoint, &PyTypePoint );
if (pyPoint == NULL) { return NULL; }
HTRY
pyPoint->_object = new Point ( segment->GetSourcePosition() );
HCATCH
return ( (PyObject*)pyPoint );
}
// ---------------------------------------------------------------
// Attribute Method : "PySegment_GetTargetPosition ()"
static PyObject* PySegment_GetTargetPosition ( PySegment *self )
{
trace << "PySegment_GetTargetPosition()" << endl;
METHOD_HEAD ( "Segment.TargetPosition()" )
PyPoint* pyPoint = PyObject_NEW ( PyPoint, &PyTypePoint );
if (pyPoint == NULL) { return NULL; }
HTRY
pyPoint->_object = new Point ( segment->GetTargetPosition() );
HCATCH
return ( (PyObject*)pyPoint );
}
// ---------------------------------------------------------------
// PySegment Attribute Method table.
PyMethodDef PySegment_Methods[] =
{ { "GetSourceX" , (PyCFunction)PySegment_GetSourceX , METH_NOARGS , "Return the Segment source X value." }
, { "GetSourceY" , (PyCFunction)PySegment_GetSourceY , METH_NOARGS , "Return the Segment source Y value." }
, { "GetSourcePosition" , (PyCFunction)PySegment_GetSourcePosition, METH_NOARGS , "Return the Segment source point value." }
, { "GetTargetPosition" , (PyCFunction)PySegment_GetTargetPosition, METH_NOARGS , "Return the Segment target point value." }
, { "GetWidth" , (PyCFunction)PySegment_GetWidth , METH_NOARGS , "Return the segment width." }
, { "Delete" , (PyCFunction)PySegment_Delete , METH_NOARGS
, "Delete associated hurricane object, the python object remains." }
, {NULL, NULL, 0, NULL} /* sentinel */
};
// x-------------------------------------------------------------x
// | "PySegment" Object Methods |
// x-------------------------------------------------------------x
DBoDeleteMethod(Segment)
PyTypeObjectLinkPyType(Segment)
# else // End of Python Module Code Part.
// x=================================================================x
// | "PySegment" Shared Library Code Part |
// x=================================================================x
// ---------------------------------------------------------------
// PySegment Object Definitions.
PyTypeInheritedObjectDefinitions(Segment, Component)
# endif // End of Shared Library Code Part.
} // End of extern "C".
} // End of Isobar namespace.

View File

@ -0,0 +1,105 @@
// -*- 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é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: PySegment.h,v 1.5 2006/05/03 14:00:05 jpc Exp $
//
// x-----------------------------------------------------------------x
// | |
// | 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@asim.lip6.fr |
// | =============================================================== |
// | C++ Header : "./PySegment.h" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
# ifndef __PYSEGMENT__
# define __PYSEGMENT__
# include "PyComponent.h"
# include "Segment.h"
namespace Isobar {
extern "C" {
// -------------------------------------------------------------------
// Python Object : "PySegment".
typedef struct {
PyComponent _baseObject;
} PySegment;
// -------------------------------------------------------------------
// Functions & Types exported to "PyHurricane.ccp".
extern PyTypeObject PyTypeSegment;
extern PyMethodDef PySegment_Methods[];
extern void PySegment_LinkPyType ();
# define IsPySegment(v) ( (v)->ob_type == &PyTypeSegment )
# define PYSEGMENT(v) ( (PySegment*)(v) )
# define PYSEGMENT_O(v) ( PYSEGMENT(v)->_baseObject._baseObject._object )
} // End of extern "C".
} // End of Isobar namespace.
# endif

View File

@ -0,0 +1,152 @@
// -*- 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é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: PySegmentLocator.cpp,v 1.10 2006/09/22 11:27:32 tsunami 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 : "./PySegmentLocator.cpp" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
# include "PySegmentLocator.h"
# include "PySegment.h"
namespace Isobar {
USING_NAMESPACE_HURRICANE
extern "C" {
# define METHOD_HEAD(function) GENERIC_METHOD_HEAD(Locator<Segment*>,locator,function)
// x=================================================================x
// | "PySegmentLocator" Python Module Code Part |
// x=================================================================x
# if defined(__PYTHON_MODULE__)
// x-------------------------------------------------------------x
// | "PySegmentLocator" Attribute Methods |
// x-------------------------------------------------------------x
// Standart Accessors (Attributes).
// Standart Predicates (Attributes).
DirectGetBoolAttribute(PySegmentLocator_IsValid,IsValid,PySegmentLocator,Locator<Segment*>)
// Standart Locator Accessors (Attributes).
LocatorProgressAttribute(Segment)
LocatorGetElementEntityAttribute(Segment)
LocatorGetCloneAttribute(Segment)
// Standart Delete (Attribute).
DirectDeleteAttribute(PySegmentLocator_Delete,PySegmentLocator)
// ---------------------------------------------------------------
// PySegmentLocator Attribute Method table.
PyMethodDef PySegmentLocator_Methods[] =
{ { "IsValid" , (PyCFunction)PySegmentLocator_IsValid , METH_NOARGS , "Returns true while the walk has not exhausted the set of elements, else false." }
, { "Progress" , (PyCFunction)PySegmentLocator_Progress , METH_NOARGS , "Moves forward the locator to the following element." }
, { "GetElement" , (PyCFunction)PySegmentLocator_GetElement , METH_NOARGS , "Returns the current element (or the value Type() when the locator is not or no longer valid)." }
, { "GetClone" , (PyCFunction)PySegmentLocator_GetClone , METH_NOARGS , "This function allocates and returns a new locator that will have the same visiting course than the remaining one of the locator being cloned." }
, { "Delete" , (PyCFunction)PySegmentLocator_Delete , METH_NOARGS
, "Delete associated hurricane object, the python object remains." }
, {NULL, NULL, 0, NULL} /* sentinel */
};
// x-------------------------------------------------------------x
// | "PySegmentLocator" Object Methods |
// x-------------------------------------------------------------x
DirectDeleteMethod(PySegmentLocator_DeAlloc,PySegmentLocator)
LocatorPyTypeObjectLinkPyType(Segment, Segment*)
# else // End of Python Module Code Part.
// x=================================================================x
// | "PySegmentLocator" Shared Library Code Part |
// x=================================================================x
// ---------------------------------------------------------------
// PySegmentLocator Object Definitions.
PyTypeRootObjectDefinitions(SegmentLocator)
# endif // End of Shared Library Code Part.
} // End of extern "C".
} // End of Isobar namespace.

View File

@ -0,0 +1,107 @@
// -*- 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é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: PySegmentLocator.h,v 1.3 2006/05/03 14:00:05 jpc 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++ Header : "./PySegmentLocator.h" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
# ifndef __PYSEGMENTLOCATOR__
# define __PYSEGMENTLOCATOR__
# include "PyHurricane.h"
# include "Locator.h"
# include "Segment.h"
namespace Isobar {
extern "C" {
// -------------------------------------------------------------------
// Python Object : "PySegmentLocator".
typedef struct {
PyObject_HEAD
Hurricane::Locator<Hurricane::Segment*>* _object;
} PySegmentLocator;
// -------------------------------------------------------------------
// Functions & Types exported to "PyHurricane.ccp".
extern PyTypeObject PyTypeSegmentLocator;
extern PyMethodDef PySegmentLocator_Methods[];
extern void PySegmentLocator_LinkPyType ();
# define IsPySegmentLocator(v) ( (v)->ob_type == &PyTypeSegmentLocator )
# define PYSEGMENTLOCATOR(v) ( (PySegmentLocator*)(v) )
# define PYSEGMENTLOCATOR_O(v) ( PYSEGMENTLOCATOR(v)->_object )
} // End of extern "C".
} // End of Isobar namespace.
# endif

View File

@ -0,0 +1,206 @@
// -*- 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é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: PyTechnology.cpp,v 1.11 2006/09/22 11:27:32 tsunami 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@asim.lip6.fr |
// | =============================================================== |
// | C++ Module : "./PyTechnology.cpp" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#include "PyDataBase.h"
#include "PyName.h"
#include "PyLayer.h"
#include "PyTechnology.h"
namespace Isobar {
USING_NAMESPACE_HURRICANE
extern "C" {
#define METHOD_HEAD(function) GENERIC_METHOD_HEAD(Technology,techno,function)
// x=================================================================x
// | "PyTechnology" Python Module Code Part |
// x=================================================================x
#if defined(__PYTHON_MODULE__)
// x-------------------------------------------------------------x
// | "PyTechnology" Attribute Methods |
// x-------------------------------------------------------------x
// ---------------------------------------------------------------
// Attribute Method : "PyTechnology_GetName ()"
static PyObject* PyTechnology_GetName ( PyTechnology *self )
{
trace << "PyTechnology_GetName ()" << endl;
METHOD_HEAD ( "Technology.GetName()" )
PyName* pyName = PyObject_NEW ( PyName, &PyTypeName );
if ( pyName == NULL ) { return NULL; }
HTRY
pyName->_object = new Name ( techno->GetName() );
HCATCH
return ( (PyObject*)pyName );
}
// ---------------------------------------------------------------
// Attribute Method : "PyTechnology_SetName ()"
static PyObject* PyTechnology_SetName ( PyTechnology *self, PyObject* args )
{
trace << "Technology.SetName()" << endl;
METHOD_HEAD ( "Technology.SetName()" )
HTRY
PyName* name;
if ( ! ParseOneArg ( "Technology.SetName", args, NAME_ARG, (PyObject**)&name ) ) return ( NULL );
techno->SetName ( *PYNAME_O(name) );
HCATCH
Py_RETURN_NONE;
}
// ---------------------------------------------------------------
// Attribute Method : "PyTechnology_GetLayer ()"
static PyObject* PyTechnology_GetLayer ( PyTechnology *self, PyObject* args )
{
trace << "Technology.GetLayer()" << endl;
METHOD_HEAD ( "Technology.GetLayer()" )
Layer* layer = NULL;
HTRY
PyName* name;
if ( ! ParseOneArg ( "Technology.GetLayer", args,NAME_ARG, (PyObject**)&name ) ) return ( NULL );
layer = techno->GetLayer ( *PYNAME_O(name) );
HCATCH
return PyLayer_Link ( layer );
}
// Standart Accessors (Attributes).
// Standart Delete (Attribute).
DBoDeleteAttribute(PyTechnology_Delete,PyTechnology)
// ---------------------------------------------------------------
// PyTechnology Attribute Method table.
PyMethodDef PyTechnology_Methods[] =
{ { "GetName" , (PyCFunction)PyTechnology_GetName , METH_NOARGS , "Returns the name of the technology." }
, { "SetName" , (PyCFunction)PyTechnology_SetName , METH_VARARGS, "Allows to change the technology name." }
, { "GetLayer" , (PyCFunction)PyTechnology_GetLayer , METH_VARARGS, "Returns the layer named name." }
, { "Delete" , (PyCFunction)PyTechnology_Delete , METH_NOARGS
, "Delete associated hurricane object The python object remains." }
, {NULL, NULL, 0, NULL} /* sentinel */
};
// x-------------------------------------------------------------x
// | "PyTechnology" Object Methods |
// x-------------------------------------------------------------x
DBoDeleteMethod(Technology)
PyTypeObjectLinkPyType(Technology)
#else // End of Python Module Code Part.
// x=================================================================x
// | "PyTechnology" Shared Library Code Part |
// x=================================================================x
// Link/Creation Method.
DBoLinkCreateMethod(PyTechnology_Link,PyTechnology,PyTypeTechnology,Technology)
// ---------------------------------------------------------------
// PyTechnology Object Definitions.
PyTypeRootObjectDefinitions(Technology)
#endif // End of Shared Library Code Part.
} // End of extern "C".
} // End of Isobar namespace.

View File

@ -0,0 +1,91 @@
// -*- 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é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: PyTechnology.h,v 1.5 2006/05/03 14:00:05 jpc 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@asim.lip6.fr |
// | =============================================================== |
// | C++ Header : "./PyTechnology.h" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
# ifndef __PYTECHNOLOGY__
# define __PYTECHNOLOGY__
# include "PyHurricane.h"
# include "Technology.h"
namespace Isobar {
USING_NAMESPACE_HURRICANE
extern "C" {
// -------------------------------------------------------------------
// Python Object : "PyTechnology".
typedef struct {
PyObject_HEAD
Technology* _object;
} PyTechnology;
// -------------------------------------------------------------------
// Functions & Types exported to "PyHurricane.ccp".
extern PyTypeObject PyTypeTechnology;
extern PyMethodDef PyTechnology_Methods[];
extern PyObject* PyTechnology_Link ( Hurricane::Technology* object );
extern void PyTechnology_LinkPyType ();
# define IsPyTechnology(v) ( (v)->ob_type == &PyTypeTechnology )
# define PYTECHNOLOGY(v) ( (PyTechnology*)(v) )
# define PYTECHNOLOGY_O(v) ( PYTECHNOLOGY(v)->_object )
} // End of extern "C".
} // End of Isobar namespace.
# endif

View File

@ -0,0 +1,622 @@
// -*- 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é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: PyTransformation.cpp,v 1.17 2007/01/30 14:47:24 cobell Exp $
//
// x-----------------------------------------------------------------x
// | |
// | 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@asim.lip6.fr |
// | =============================================================== |
// | C++ Module : "./PyTransformation.cpp" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#include "PyPoint.h"
#include "PyBox.h"
#include "PyTransformation.h"
namespace Isobar {
USING_NAMESPACE_HURRICANE
extern "C" {
#define METHOD_HEAD(function) GENERIC_METHOD_HEAD(Transformation,transf,function)
// x=================================================================x
// | "PyTransformation" Python Module Code Part |
// x=================================================================x
#if defined(__PYTHON_MODULE__)
// x-------------------------------------------------------------x
// | Global Constants Loading |
// x-------------------------------------------------------------x
extern void TransformationLoadConstants ( PyObject* dictionnary )
{
PyObject* constant;
LOAD_CONSTANT ( Transformation::Orientation::ID, "OrientationID" )
LOAD_CONSTANT ( Transformation::Orientation::R1, "OrientationR1" )
LOAD_CONSTANT ( Transformation::Orientation::R2, "OrientationR2" )
LOAD_CONSTANT ( Transformation::Orientation::R3, "OrientationR3" )
LOAD_CONSTANT ( Transformation::Orientation::MX, "OrientationMX" )
LOAD_CONSTANT ( Transformation::Orientation::XR, "OrientationXR" )
LOAD_CONSTANT ( Transformation::Orientation::MY, "OrientationMY" )
LOAD_CONSTANT ( Transformation::Orientation::YR, "OrientationYR" )
}
// x-------------------------------------------------------------x
// | "PyTransformation" Attribute Methods |
// x-------------------------------------------------------------x
// Standart Accessors (Attributes).
DirectGetLongAttribute(PyTransformation_GetTx, getTx, PyTransformation, Transformation)
DirectGetLongAttribute(PyTransformation_GetTy, getTy, PyTransformation, Transformation)
// Standart Delete (Attribute).
DirectDeleteAttribute(PyTransformation_Delete, PyTransformation)
// ---------------------------------------------------------------
// Attribute Method : "PyBox_GetTranslation ()"
static PyObject* PyTransformation_GetTranslation ( PyTransformation *self )
{
trace << "PyBox_GetTranslation ()" << endl;
METHOD_HEAD ( "Translation.GetTranslation()" )
PyPoint* pyPoint = PyObject_NEW ( PyPoint, &PyTypePoint );
if (pyPoint == NULL) { return NULL; }
trace_in ();
trace << "new PyPoint [" << hex << pyPoint << "]" << endl;
trace_out ();
HTRY
pyPoint->_object = new Point ( transf->getTranslation() );
HCATCH
return ( (PyObject*)pyPoint );
}
// ---------------------------------------------------------------
// Attribute Method : "PyTransformation_GetOrientation ()"
static PyObject* PyTransformation_GetOrientation ( PyTransformation *self ) {
trace << "PyTransformation_GetOrientation ()" << endl;
METHOD_HEAD ( "Translation.GetOrientation()" )
return ( (PyObject*)Py_BuildValue("i",(long)transf->getOrientation().GetCode()) );
}
// ---------------------------------------------------------------
// Attribute Method : "PyTransformation_GetX ()"
static PyObject* PyTransformation_GetX ( PyTransformation *self, PyObject* args )
{
trace << "PyTransformation_GetX ()" << endl;
METHOD_HEAD ( "Transformation.GetX()" )
PyObject* arg0;
PyObject* arg1;
long result = 0;
HTRY
__cs.Init ("Transformation.GetX");
if ( ! PyArg_ParseTuple(args,"|O&O&:Transformation.GetX",Converter,&arg0,Converter,&arg1) )
return ( NULL );
if ( __cs.GetObjectIds() == POINT_ARG ) { result = transf->getX ( *PYPOINT_O(arg0) ); }
else if ( __cs.GetObjectIds() == INTS2_ARG ) { result = transf->getX ( PyInt_AsLong(arg0)
, PyInt_AsLong(arg1) ); }
else {
PyErr_SetString ( ConstructorError, "invalid number of parameters for Tranformation.GetX()." );
return ( NULL );
}
HCATCH
return ( (PyObject*)Py_BuildValue("i",result) );
}
// ---------------------------------------------------------------
// Attribute Method : "PyTransformation_GetY ()"
static PyObject* PyTransformation_GetY ( PyTransformation *self, PyObject* args )
{
trace << "PyTransformation_GetY ()" << endl;
METHOD_HEAD ( "Transformation.GetY()" )
PyObject* arg0;
PyObject* arg1;
long result = 0;
HTRY
__cs.Init ("Transformation.GetY");
if ( ! PyArg_ParseTuple(args,"|O&O&:Transformation.GetY",Converter,&arg0,Converter,&arg1) )
return ( NULL );
if ( __cs.GetObjectIds() == POINT_ARG ) { result = transf->getY ( *PYPOINT_O(arg0) ); }
else if ( __cs.GetObjectIds() == INTS2_ARG ) { result = transf->getY ( PyInt_AsLong(arg0)
, PyInt_AsLong(arg1) ); }
else {
PyErr_SetString ( ConstructorError, "invalid number of parameters for Tranformation.GetY()." );
return ( NULL );
}
HCATCH
return ( (PyObject*)Py_BuildValue("i",result) );
}
// ---------------------------------------------------------------
// Attribute Method : "PyTransformation_GetDx ()"
static PyObject* PyTransformation_GetDx ( PyTransformation *self, PyObject* args )
{
trace << "PyTransformation_GetDx ()" << endl;
METHOD_HEAD ( "Transformation.GetDx()" )
PyObject* arg0;
PyObject* arg1;
long result = 0;
HTRY
if ( ! ParseTwoArg ( "Transformation.GetDx", args, INTS2_ARG, &arg0, &arg1 ) ) return ( NULL );
result = transf->getDx ( PyInt_AsLong(arg0), PyInt_AsLong(arg1) );
HCATCH
return ( (PyObject*)Py_BuildValue("i",result) );
}
// ---------------------------------------------------------------
// Attribute Method : "PyTransformation_GetDy ()"
static PyObject* PyTransformation_GetDy ( PyTransformation *self, PyObject* args )
{
trace << "PyTransformation_GetDy ()" << endl;
METHOD_HEAD ( "Transformation.GetDy()" )
PyObject* arg0;
PyObject* arg1;
long result = 0;
HTRY
if ( ! ParseTwoArg ( "Transformation.GetDy", args, INTS2_ARG, &arg0, &arg1 ) ) return ( NULL );
result = transf->getDy ( PyInt_AsLong(arg0), PyInt_AsLong(arg1) );
HCATCH
return ( (PyObject*)Py_BuildValue("i",result) );
}
// ---------------------------------------------------------------
// Attribute Method : "PyTransformation_GetTransformation ()"
static PyObject* PyTransformation_GetTransformation ( PyTransformation *self, PyObject* args )
{
trace << "PyTransformation_GetTransformation ()" << endl;
METHOD_HEAD ( "Transformation.GetTransformation()" )
PyObject* arg0;
Transformation result;
if ( ! ParseOneArg ( "Transformation.GetTransformation", args, TRANS_ARG, &arg0 ) ) return ( NULL );
result = transf->getTransformation ( *PYTRANSFORMATION_O(arg0) );
PyTransformation* resultPyTransf = PyObject_NEW ( PyTransformation, &PyTypeTransformation );
if ( resultPyTransf == NULL ) { return NULL; }
trace_in ();
trace << "new PyTransformation [" << hex << resultPyTransf << "]" << endl;
trace_out ();
HTRY
resultPyTransf->_object = new Transformation ( result );
HCATCH
return ( (PyObject*)resultPyTransf );
}
// ---------------------------------------------------------------
// Attribute Method : "PyTransformation_GetPoint ()"
static PyObject* PyTransformation_GetPoint ( PyTransformation *self, PyObject* args )
{
trace << "PyTransformation_GetPoint ()" << endl;
METHOD_HEAD ( "Transformation.GetPoint()" )
PyObject* arg0;
PyObject* arg1;
Point result;
__cs.Init ("Transformation.GetPoint");
if ( ! PyArg_ParseTuple(args,"|O&O&:Transformation.GetPoint",Converter,&arg0,Converter,&arg1) )
return ( NULL );
if ( __cs.GetObjectIds() == POINT_ARG ) { result = transf->getPoint ( *PYPOINT_O(arg0) ); }
else if ( __cs.GetObjectIds() == INTS2_ARG ) { result = transf->getPoint ( PyInt_AsLong(arg0)
, PyInt_AsLong(arg1) ); }
else {
PyErr_SetString ( ConstructorError, "invalid number of parameters for Tranformation.GetPoint()." );
return ( NULL );
}
PyPoint* resultPyPoint = PyObject_NEW ( PyPoint, &PyTypePoint );
if ( resultPyPoint == NULL ) { return NULL; }
trace_in ();
trace << "new PyPoint [" << hex << resultPyPoint << "]" << endl;
trace_out ();
HTRY
resultPyPoint->_object = new Point ( result );
HCATCH
return ( (PyObject*)resultPyPoint );
}
// ---------------------------------------------------------------
// Attribute Method : "PyTransformation_GetBox ()"
static PyObject* PyTransformation_GetBox ( PyTransformation *self, PyObject* args )
{
trace << "PyTransformation_GetBox ()" << endl;
METHOD_HEAD ( "Transformation.GetBox()" )
PyObject* arg0;
PyObject* arg1;
PyObject* arg2;
PyObject* arg3;
Box result;
__cs.Init ("Transformation.GetBox");
if ( ! PyArg_ParseTuple(args,"|O&O&O&O&:Transformation.GetBox"
,Converter,&arg0
,Converter,&arg1
,Converter,&arg2
,Converter,&arg3) )
return ( NULL );
if ( __cs.GetObjectIds() == BOX_ARG ) { result = transf->getBox ( *PYBOX_O(arg0) ); }
else if ( __cs.GetObjectIds() == POINTS2_ARG ) { result = transf->getBox ( *PYPOINT_O(arg0)
, *PYPOINT_O(arg1) ); }
else if ( __cs.GetObjectIds() == INTS4_ARG ) { result = transf->getBox ( PyInt_AsLong(arg0)
, PyInt_AsLong(arg1)
, PyInt_AsLong(arg2)
, PyInt_AsLong(arg3) ); }
else {
PyErr_SetString ( ConstructorError, "invalid number of parameters for Tranformation.GetBox()." );
return ( NULL );
}
PyBox* resultPyBox = PyObject_NEW ( PyBox, &PyTypeBox );
if ( resultPyBox == NULL ) { return NULL; }
trace_in ();
trace << "new PyBox [" << hex << resultPyBox << "]" << endl;
trace_out ();
HTRY
resultPyBox->_object = new Box ( result );
HCATCH
return ( (PyObject*)resultPyBox );
}
// ---------------------------------------------------------------
// Attribute Method : "PyTransformation_GetInvert ()"
static PyObject* PyTransformation_GetInvert ( PyTransformation *self )
{
trace << "PyTransformation_GetInvert ()" << endl;
METHOD_HEAD ( "Transformation.GetInvert()" )
Transformation result = transf->getInvert ();
PyTransformation* resultPyTransf = PyObject_NEW ( PyTransformation, &PyTypeTransformation );
if ( resultPyTransf == NULL ) { return NULL; }
trace_in ();
trace << "new PyTransformation [" << hex << resultPyTransf << "]" << endl;
trace_out ();
HTRY
resultPyTransf->_object = new Transformation ( result );
HCATCH
return ( (PyObject*)resultPyTransf );
}
// ---------------------------------------------------------------
// Attribute Method : "PyTransformation_Invert ()"
static PyObject* PyTransformation_Invert ( PyTransformation *self )
{
trace << "PyTransformation_Invert ()" << endl;
METHOD_HEAD ( "Transformation.Invert()" )
HTRY
transf->invert ();
HCATCH
Py_INCREF ( self );
return ( (PyObject*)self );
}
// ---------------------------------------------------------------
// Attribute Method : "PyTransformation_ApplyOn ()"
static PyObject* PyTransformation_ApplyOn ( PyTransformation *self, PyObject* args )
{
trace << "PyTransformation_ApplyOn ()" << endl;
METHOD_HEAD ( "Transformation.ApplyOn()" )
PyObject* arg0;
PyObject* arg1;
HTRY
__cs.Init ("Transformation.ApplyOn");
if ( ! PyArg_ParseTuple(args,"|O&O&:Transformation.ApplyOn",Converter,&arg0,Converter,&arg1) )
return ( NULL );
if ( __cs.GetObjectIds() == POINT_ARG ) { transf->applyOn ( *PYPOINT_O(arg0) ); }
else if ( __cs.GetObjectIds() == BOX_ARG ) { transf->applyOn ( *PYBOX_O(arg0) ); }
else if ( __cs.GetObjectIds() == TRANS_ARG ) { transf->applyOn ( *PYTRANSFORMATION_O(arg0) ); }
else if ( __cs.GetObjectIds() == INTS2_ARG ) {
PyErr_SetString ( ConstructorError, "This set of ApplyOn() parameters has not been implemented." );
return ( NULL );
} else {
PyErr_SetString ( ConstructorError, "invalid number of parameters for Tranformation.ApplyOn()." );
return ( NULL );
}
HCATCH
Py_RETURN_NONE;
}
// ---------------------------------------------------------------
// PyTransformation Attribute Method table.
PyMethodDef PyTransformation_Methods[] =
{ { "GetTx" , (PyCFunction)PyTransformation_GetTx , METH_NOARGS, "Return the horizontal component of a Transformation." }
, { "GetTy" , (PyCFunction)PyTransformation_GetTy , METH_NOARGS, "Return the vertical component of a Transformation." }
, { "GetTranslation" , (PyCFunction)PyTransformation_GetTranslation , METH_NOARGS , "Return the translation component of a Transformation." }
, { "GetOrientation" , (PyCFunction)PyTransformation_GetOrientation , METH_NOARGS , "Return the orientation component of a Transformation." }
, { "GetX" , (PyCFunction)PyTransformation_GetX , METH_VARARGS, "Return X of transformed point <x,y>." }
, { "GetY" , (PyCFunction)PyTransformation_GetY , METH_VARARGS, "Return Y of transformed point <x,y>." }
, { "GetDx" , (PyCFunction)PyTransformation_GetDx , METH_VARARGS, "Return X of transformed point <x,y>." }
, { "GetDy" , (PyCFunction)PyTransformation_GetDy , METH_VARARGS, "Return Y of transformed point <x,y>." }
, { "GetTransformation", (PyCFunction)PyTransformation_GetTransformation, METH_VARARGS, "Return combined transformation." }
, { "GetPoint" , (PyCFunction)PyTransformation_GetPoint , METH_VARARGS, "Return transformed point <x,y>." }
, { "GetBox" , (PyCFunction)PyTransformation_GetBox , METH_VARARGS, "Return transformed box." }
, { "GetInvert" , (PyCFunction)PyTransformation_GetInvert , METH_NOARGS, "Return inverse transformation." }
, { "Invert" , (PyCFunction)PyTransformation_Invert , METH_NOARGS, "Inverse transformation." }
, { "ApplyOn" , (PyCFunction)PyTransformation_ApplyOn , METH_VARARGS, "Apply transformation to object." }
, { "Delete" , (PyCFunction)PyTransformation_Delete , METH_NOARGS
, "Delete associated hurricane object, the python object remains." }
, {NULL, NULL, 0, NULL} /* sentinel */
};
// x-------------------------------------------------------------x
// | "PyTransformation" Object Methods |
// x-------------------------------------------------------------x
static Transformation::Orientation PyInt_AsOrientation ( PyObject* object ) {
switch ( PyInt_AsLong(object) ) {
case Transformation::Orientation::ID : return ( Transformation::Orientation(Transformation::Orientation::ID) );
case Transformation::Orientation::R1 : return ( Transformation::Orientation(Transformation::Orientation::R1) );
case Transformation::Orientation::R2 : return ( Transformation::Orientation(Transformation::Orientation::R2) );
case Transformation::Orientation::R3 : return ( Transformation::Orientation(Transformation::Orientation::R3) );
case Transformation::Orientation::MX : return ( Transformation::Orientation(Transformation::Orientation::MX) );
case Transformation::Orientation::XR : return ( Transformation::Orientation(Transformation::Orientation::XR) );
case Transformation::Orientation::MY : return ( Transformation::Orientation(Transformation::Orientation::MY) );
case Transformation::Orientation::YR : return ( Transformation::Orientation(Transformation::Orientation::YR) );
}
return ( Transformation::Orientation(Transformation::Orientation::ID) );
}
// ---------------------------------------------------------------
// Attribute Method : "PyTransformation_new ()"
static PyObject* PyTransformation_new(PyTypeObject *type, PyObject *args, PyObject *kwds) {
trace << "PyTransformation_new()" << endl;
Transformation* transf;
PyObject* arg0;
PyObject* arg1;
PyObject* arg2;
__cs.Init ("Transformation.new");
if ( ! PyArg_ParseTuple(args,"|O&O&O&:Transformation.new"
,Converter,&arg0
,Converter,&arg1
,Converter,&arg2
) ) return ( NULL );
if ( __cs.GetObjectIds() == NO_ARG ) { transf = new Transformation (); }
else if ( __cs.GetObjectIds() == POINT_ARG ) { transf = new Transformation ( *PYPOINT_O(arg0) ); }
else if ( __cs.GetObjectIds() == TRANS_ARG ) { transf = new Transformation ( *PYTRANSFORMATION_O(arg0) ); }
else if ( __cs.GetObjectIds() == INTS2_ARG ) { transf = new Transformation ( PyInt_AsLong(arg0)
, PyInt_AsLong(arg1) ); }
else if ( __cs.GetObjectIds() == POINT_INT_ARG ) { transf = new Transformation ( *PYPOINT_O(arg0)
, PyInt_AsOrientation(arg1) ); }
else if ( __cs.GetObjectIds() == INTS3_ARG ) { transf = new Transformation ( PyInt_AsLong(arg0)
, PyInt_AsLong(arg1)
, PyInt_AsOrientation(arg2) ); }
else {
PyErr_SetString ( ConstructorError, "invalid number of parameters for Transformation constructor." );
return ( NULL );
}
PyTransformation* pyTransformation = PyObject_NEW(PyTransformation, &PyTypeTransformation);
if (pyTransformation == NULL) { ; return NULL; }
trace_in ();
trace << "new PyTransformation [" << hex << pyTransformation << "]" << endl;
trace_out ();
HTRY
pyTransformation->_object = transf;
HCATCH
return ( (PyObject*)pyTransformation );
}
DirectDeleteMethod(PyTransformation_DeAlloc,PyTransformation)
PyTypeObjectLinkPyType(Transformation)
PyTypeObjectConstructor(Transformation)
#else // End of Python Module Code Part.
// x=================================================================x
// | "PyTransformation" Shared Library Code Part |
// x=================================================================x
// x-------------------------------------------------------------x
// | "PyTransformation" Local Functions |
// x-------------------------------------------------------------x
// ---------------------------------------------------------------
// PyTransformation Object Definitions.
PyTypeRootObjectDefinitions(Transformation)
#endif // End of Shared Library Code Part.
} // End of extern "C".
} // End of Isobar namespace.

View File

@ -0,0 +1,102 @@
// -*- 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é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: PyTransformation.h,v 1.6 2006/05/03 14:00:05 jpc Exp $
//
// x-----------------------------------------------------------------x
// | |
// | 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@asim.lip6.fr |
// | =============================================================== |
// | C++ Header : "./PyTransformation.h" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#ifndef __PYTRANSFORMATION__
#define __PYTRANSFORMATION__
#include "PyHurricane.h"
#include "Transformation.h"
namespace Isobar {
extern "C" {
// -------------------------------------------------------------------
// Python Object : "PyTransformation".
typedef struct {
PyObject_HEAD
Hurricane::Transformation* _object;
} PyTransformation;
// -------------------------------------------------------------------
// Functions & Types exported to "PyHurricane.ccp".
extern PyTypeObject PyTypeTransformation;
extern PyMethodDef PyTransformation_Methods[];
extern void TransformationLoadConstants(PyObject* dictionnary);
extern void PyTransformation_LinkPyType();
extern void PyTransformation_Constructor();
# define IsPyTransformation(v) ( (v)->ob_type == &PyTypeTransformation )
# define PYTRANSFORMATION(v) ( (PyTransformation*)(v) )
# define PYTRANSFORMATION_O(v) ( PYTRANSFORMATION(v)->_object )
} // End of extern "C".
} // End of Isobar namespace.
#endif

View File

@ -0,0 +1,142 @@
// -*- 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é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: PyUnit.cpp,v 1.11 2006/05/03 14:00:05 jpc Exp $
//
// x-----------------------------------------------------------------x
// | |
// | 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@asim.lip6.fr |
// | =============================================================== |
// | C++ Module : "./PyUnit.cpp" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#include "PyUnit.h"
namespace Isobar {
USING_NAMESPACE_HURRICANE
extern "C" {
// x=================================================================x
// | "PyUnit" Python Module Code Part |
// x=================================================================x
#if defined(__PYTHON_MODULE__)
// x-------------------------------------------------------------x
// | "PyUnit" General Methods |
// x-------------------------------------------------------------x
// ---------------------------------------------------------------
// Attribute Method : "PyUnit_GetUnit ()"
extern PyObject* PyUnit_GetUnit ( PyObject* module, PyObject* args )
{
trace << "PyUnit_GetUnit ()" << endl;
PyObject* arg0;
Unit result = 0;
HTRY
__cs.Init ( "Unit.GetUnit" );
if ( ! PyArg_ParseTuple(args,"|O&:Unit.GetUnit",Converter,&arg0) )
return ( NULL );
if ( __cs.GetObjectIds() == INT_ARG ) { result = GetUnit ( PyInt_AsLong ( arg0 ) ); }
else if ( __cs.GetObjectIds() == FLOAT_ARG ) { result = GetUnit ( PyFloat_AsDouble ( arg0 ) ); }
else {
PyErr_SetString ( ConstructorError, "invalid number of parameters for Unit.GetUnit constructor." );
return ( NULL );
}
HCATCH
return ( Py_BuildValue ( "i", result ) );
}
// ---------------------------------------------------------------
// Attribute Method : "PyUnit_GetValue ()"
extern PyObject* PyUnit_GetValue ( PyObject* module, PyObject* args )
{
trace << "PyUnit_GetValue ()" << endl;
PyObject* arg0;
if ( ! ParseOneArg ( "GetValue", args,INT_ARG, &arg0 ) ) return ( NULL );
return ( Py_BuildValue("d",GetValue(PyInt_AsLong(arg0))) );
}
// ---------------------------------------------------------------
// Attribute Method : "PyUnit_GetResolution ()"
extern PyObject* PyUnit_GetResolution ( PyObject* module )
{
trace << "PyUnit_GetResolution ()" << endl;
return ( Py_BuildValue("d",GetResolution()) );
}
#endif // End of Python Module Code Part.
} // End of extern "C".
} // End of Isobar namespace.

View File

@ -0,0 +1,94 @@
// -*- 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é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: PyUnit.h,v 1.6 2006/04/24 14:11:48 jpc Exp $
//
// x-----------------------------------------------------------------x
// | |
// | 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@asim.lip6.fr |
// | =============================================================== |
// | C++ Header : "./PyUnit.h" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
# ifndef __PYUNIT__
# define __PYUNIT__
# include "PyHurricane.h"
# include "Unit.h"
namespace Isobar {
extern "C" {
// -------------------------------------------------------------------
// Python Object : "PyUnit".
// -------------------------------------------------------------------
// Functions & Types exported to "PyHurricane.ccp".
extern PyObject* PyUnit_GetUnit ( PyObject* module, PyObject* args );
extern PyObject* PyUnit_GetValue ( PyObject* module, PyObject* args );
} // End of extern "C".
} // End of Isobar namespace.
# endif

View File

@ -0,0 +1,124 @@
// -*- 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é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: PyUpdateSession.cpp,v 1.12 2006/07/19 14:00:05 xtof Exp $
//
// x-----------------------------------------------------------------x
// | |
// | 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@asim.lip6.fr |
// | =============================================================== |
// | C++ Module : "./PyUpdateSession.cpp" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#include "PyUpdateSession.h"
namespace Isobar {
USING_NAMESPACE_HURRICANE
extern "C" {
// x=================================================================x
// | "PyUpdateSession" Python Module Code Part |
// x=================================================================x
#if defined(__PYTHON_MODULE__)
// x-------------------------------------------------------------x
// | "PyUpdateSession" General Methods |
// x-------------------------------------------------------------x
// ---------------------------------------------------------------
// Attribute Method : "PyUpdateSession_OpenUpdateSession ()"
extern PyObject* PyUpdateSession_OpenUpdateSession ( PyObject* module )
{
trace << "PyUpdateSession_OpenUpdateSession ()" << endl;
HTRY
OpenUpdateSession ();
HCATCH
Py_RETURN_NONE;
}
// ---------------------------------------------------------------
// Attribute Method : "PyUpdateSession_CloseUpdateSession ()"
extern PyObject* PyUpdateSession_CloseUpdateSession ( PyObject* module )
{
trace << "PyUpdateSession_CloseUpdateSession ()" << endl;
HTRY
CloseUpdateSession ();
HCATCH
Py_RETURN_NONE;
}
#else // End of Python Module Code Part.
// x=================================================================x
// | "PyUpdateSession" Shared Library Code Part |
// x=================================================================x
#endif
} // End of extern "C".
} // End of Isobar namespace.

View File

@ -0,0 +1,94 @@
// -*- 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é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: PyUpdateSession.h,v 1.8 2006/05/03 14:00:05 jpc Exp $
//
// x-----------------------------------------------------------------x
// | |
// | 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@asim.lip6.fr |
// | =============================================================== |
// | C++ Header : "./PyUpdateSession.h" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
# ifndef __PYUPDATESESSION__
# define __PYUPDATESESSION__
# include "PyHurricane.h"
# include "UpdateSession.h"
namespace Isobar {
extern "C" {
// -------------------------------------------------------------------
// Python Object : "PyUpdateSession".
// -------------------------------------------------------------------
// Functions & Types exported to "PyHurricane.ccp".
extern PyObject* PyUpdateSession_OpenUpdateSession ( PyObject* module );
extern PyObject* PyUpdateSession_CloseUpdateSession ( PyObject* module );
} // End of extern "C".
} // End of Isobar namespace.
# endif

View File

@ -0,0 +1,227 @@
// -*- 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é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: PyVertical.cpp,v 1.18 2008/02/07 17:09:42 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 : "./PyVertical.cpp" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
# include "PyNet.h"
# include "PyLayer.h"
# include "PyVertical.h"
namespace Isobar {
USING_NAMESPACE_HURRICANE
extern "C" {
# undef ACCESS_OBJECT
# undef ACCESS_CLASS
# define ACCESS_OBJECT _baseObject._baseObject._baseObject._object
# define ACCESS_CLASS(_pyObject) &(_pyObject->_baseObject._baseObject._baseObject)
# define METHOD_HEAD(function) GENERIC_METHOD_HEAD(Vertical,vertical,function)
// x=================================================================x
// | "PyVertical" Python Module Code Part |
// x=================================================================x
# if defined(__PYTHON_MODULE__)
// x-------------------------------------------------------------x
// | "PyVertical" Attribute Methods |
// x-------------------------------------------------------------x
// Standart Delete (Attribute).
DBoDeleteAttribute(PyVertical_Delete,PyVertical)
// ---------------------------------------------------------------
// PyVertical Attribute Method table.
PyMethodDef PyVertical_Methods[] =
{ { "Delete" , (PyCFunction)PyVertical_Delete , METH_NOARGS
, "Delete associated hurricane object, the python object remains." }
, {NULL, NULL, 0, NULL} /* sentinel */
};
// x-------------------------------------------------------------x
// | "PyVertical" Object Methods |
// x-------------------------------------------------------------x
// ---------------------------------------------------------------
// Attribute Method : "PyVertical_new ()"
static PyObject* PyVertical_new(PyTypeObject *type, PyObject *args, PyObject *kwds) {
trace << "PyVertical_new()" << endl;
PyObject* arg0;
PyObject* arg1;
PyObject* arg2;
PyObject* arg3;
PyObject* arg4;
PyObject* arg5;
PyObject* arg6;
Vertical* vertical = NULL;
HTRY
__cs.Init ("Vertical.new");
if (!PyArg_ParseTuple(args,"O&O&O&|O&O&O&O&:Vertical.new"
,Converter,&arg0
,Converter,&arg1
,Converter,&arg2
,Converter,&arg3
,Converter,&arg4
,Converter,&arg5
,Converter,&arg6
) ) return ( NULL );
//cerr << "Format := " << __cs.GetObjectIds() << endl;
if ( __cs.GetObjectIds() == NET_LAYER_INT_ARG )
vertical = Vertical::Create ( PYNET_O(arg0)
, PYLAYER_O(arg1)
, PyInt_AsLong(arg2) );
else if ( __cs.GetObjectIds() == NET_LAYER_INTS2_ARG )
vertical = Vertical::Create ( PYNET_O(arg0)
, PYLAYER_O(arg1)
, PyInt_AsLong(arg2)
, PyInt_AsLong(arg3) );
else if ( __cs.GetObjectIds() == COMPS2_LAYER_INT_ARG )
vertical = Vertical::Create ( ComponentCast(arg0)
, ComponentCast(arg1)
, PYLAYER_O(arg2)
, PyInt_AsLong(arg3) );
else if ( __cs.GetObjectIds() == NET_LAYER_INTS3_ARG )
vertical = Vertical::Create ( PYNET_O(arg0)
, PYLAYER_O(arg1)
, PyInt_AsLong(arg2)
, PyInt_AsLong(arg3)
, PyInt_AsLong(arg4) );
else if ( __cs.GetObjectIds() == COMPS2_LAYER_INTS2_ARG )
vertical = Vertical::Create ( ComponentCast(arg0)
, ComponentCast(arg1)
, PYLAYER_O(arg2)
, PyInt_AsLong(arg3)
, PyInt_AsLong(arg4) );
else if ( __cs.GetObjectIds() == NET_LAYER_INTS4_ARG )
vertical = Vertical::Create ( PYNET_O(arg0)
, PYLAYER_O(arg1)
, PyInt_AsLong(arg2)
, PyInt_AsLong(arg3)
, PyInt_AsLong(arg4)
, PyInt_AsLong(arg5) );
else if ( __cs.GetObjectIds() == COMPS2_LAYER_INTS3_ARG )
vertical = Vertical::Create ( ComponentCast(arg0)
, ComponentCast(arg1)
, PYLAYER_O(arg2)
, PyInt_AsLong(arg3)
, PyInt_AsLong(arg4)
, PyInt_AsLong(arg5) );
else if ( __cs.GetObjectIds() == COMPS2_LAYER_INTS4_ARG )
vertical = Vertical::Create ( ComponentCast(arg0)
, ComponentCast(arg1)
, PYLAYER_O(arg2)
, PyInt_AsLong(arg3)
, PyInt_AsLong(arg4)
, PyInt_AsLong(arg5)
, PyInt_AsLong(arg6) );
else {
PyErr_SetString ( ConstructorError, "invalid number of parameters for Vertical constructor." );
return ( NULL );
}
HCATCH
return PyVertical_Link ( vertical );
}
DBoDeleteMethod(Vertical)
PyTypeObjectLinkPyType(Vertical)
PyTypeObjectConstructor(Vertical)
#else // End of Python Module Code Part.
// x=================================================================x
// | "PyVertical" Shared Library Code Part |
// x=================================================================x
// Link/Creation Method.
DBoLinkCreateMethod(PyVertical_Link,PyVertical,PyTypeVertical,Vertical)
// ---------------------------------------------------------------
// PyVertical Object Definitions.
PyTypeInheritedObjectDefinitions(Vertical, Segment)
# endif // End of Shared Library Code Part.
} // End of extern "C".
} // End of Isobar namespace.

View File

@ -0,0 +1,108 @@
// -*- 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é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: PyVertical.h,v 1.6 2007/01/30 14:47:25 cobell 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++ Header : "./PyVertical.h" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#ifndef __PYVERTICAL__
#define __PYVERTICAL__
#include "PySegment.h"
#include "Vertical.h"
namespace Isobar {
extern "C" {
// -------------------------------------------------------------------
// Python Object : "PyVertical".
typedef struct {
PySegment _baseObject;
} PyVertical;
// -------------------------------------------------------------------
// Functions & Types exported to "PyHurricane.ccp".
extern PyTypeObject PyTypeVertical;
extern PyMethodDef PyVertical_Methods[];
extern PyObject* PyVertical_Link ( Hurricane::Vertical* object );
extern void PyVertical_LinkPyType ();
extern void PyVertical_Constructor();
#define IsPyVertical(v) ((v)->ob_type == &PyTypeVertical)
#define PYVERTICAL(v) ((PyVertical*)(v))
#define PYVERTICAL_O(v) (PYVERTICAL(v)->_baseObject._baseObject._baseObject._object)
} // End of extern "C".
} // End of Isobar namespace.
#endif

69
hurricane/src/pyext/setup.py Executable file
View File

@ -0,0 +1,69 @@
import sys
class BuildConfigurationFileReader:
def __init__(self):
src_dir=""
self.sources = ""
self.include_dirs = ""
self.library_dirs = ""
def load(self):
f = open("PyExtensionBuild.conf")
try:
for line in f:
if (line == "\n"):
continue
args = line.split("=", 1)
if (len(args) > 0):
if (len(args) != 2):
print "Error in configuration file"
print args
sys.exit(55)
if (args[0]=="src_dir"):
self.src_dir = args[1].strip("\n")
if (args[0]=="sources"):
self.sources = args[1].strip("\n").split(";")
self.sources = map(lambda s : self.src_dir + "/" + s, self.sources)
elif (args[0]=="include_dirs"):
self.include_dirs=[args[1].strip("\n")]
print self.include_dirs
elif (args[0]=="library_dirs"):
self.library_dirs=args[1].strip("\n").split(":")
finally:
f.close()
if (len(self.sources)==0 or len(self.include_dirs)==0 or len(self.library_dirs)==0):
print "Error in configuration file"
print self.sources
print self.include_dirs
print self.library_dirs
sys.exit(55)
class PyBuilder:
def __init__(self, sources, library_dirs, include_dirs):
self.sources = sources
self.libraryDirs = library_dirs
self.libraries = ['isobar', 'hurricane']
self.includeDirs = include_dirs
def build(self, build=False):
from distutils.core import setup, Extension
hurricane = Extension('Hurricane',
include_dirs=self.includeDirs,
libraries=self.libraries,
library_dirs=self.libraryDirs,
sources=self.sources,
define_macros=[('__PYTHON_MODULE__', '1')])
build = ('build' in sys.argv)
if (build):
setup(name='Hurricane',
version='2.0',
description = "Python Module for Hurricane",
author='Coriolis Team',
ext_modules=[hurricane])
if (__name__=='__main__'):
r = BuildConfigurationFileReader()
r.load()
b = PyBuilder(r.sources, r.library_dirs, r.include_dirs)
build = ('build' in sys.argv)
b.build(build)