coriolis/hurricane/src/isobar/PyNetExternalComponents.cpp

153 lines
4.9 KiB
C++
Raw Normal View History

// -*- C++ -*-
//
// This file is part of the Coriolis Software.
Implementation of DataBase native save/restore in JSON (step 3). * Test: post-receive hook on server should send mail [1]. * New: In VLSISAPD, in Parameter, callback have now a tag, which the pointer to the caller. This allow for the callback removal when the caller is destroyed. * New: In VLSISAPD, in WidgetDescription, when associated to a parameter, the destructor must remove the associated callback function on the Parameter. * New: In Hurricane, added JSON support for Configuration, separated from vlsisapd, as the support is not available at this point. JSON support for Configuration, Parameter & LayoutDescription. * Change: In Hurricane, in JsonStack, the stack of JsonObjects has been displaced here from HurricaneHandler. This way, all JsonObject::toData() can access the JsonOjects in the context of the parser. * New: In Hurricane, in DBo::toJson() added support for Entity by reference (ids). * New: In Hurricane, added JSON support for all Layer sub-class types. * New: In Hurricane, in Technology, export the Layers, but must be sorted by increasing mask value. * New: In Hurricane, in Entity, added support for Entity by reference (ids). * New: In Hurricane, in DataBase, added technology full support. * New: In Hurricane, In JsonNet, move the ring rebuild management from JsonStack to JsonNet. * New: In Hurricane, added JSON support for NetAlias, NetExternalcomponents (not cleanly implemented as a Relation). * New: In Hurricane, new method Cell::fromJson() to load a cell from a JSON file. * New: In Hurricane, In Graphics, make it an observable, for when JSON fully reload the graphic state, it must be able to notify other objects (namely the Controller). * New: In Hurricane, in ControllerWidget, observe the Graphics to regenerate the palette as needed. New method ControllerTab::graphicsUpdated(). * New: In Hurricane, in RawDrawingStyle added a destructor to release the Qt pen/brush. Added JSON support for HSVr, DrawingStyle, DrawingGroup, & DisplayStyle. * New: In Hurricane, in GraphicsWidget, rewrite correctly the readGraphics() to erase the previous widgets and re-create the new ones. * New: In Hurricane, in PaletteWidget, correct re-creation of the layout/widgets in case of Graphics change. * New: In CRL Core, in System, register the parameters callbacks with the address of the object, for later deletion. * New: In CRL Core, in AllianceFramework, make it observable, to notify library changes. For the AllianceFramework creation, now allow to completly bypass the Python initialization system, when we expect to restore it from a full blob. Added methods to sets the default RoutingGauge & CellGauge. * New: In CRL Core, added JSON suppport for CellGauge, RoutingLayerGauge & RoutingGauge. * New: In CRL Core, in LibraryManager, oberver AllianceFramework, to update the list of libraries in case of change (for JSON full reload).
2016-02-20 14:24:44 -06:00
// Copyright (c) UPMC 2008-2016, All Rights Reserved
//
// +-----------------------------------------------------------------+
// | C O R I O L I S |
// | I s o b a r - Hurricane / Python Interface |
// | |
// | Author : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
// | =============================================================== |
// | C++ Module : "./PyNetExternalComponents.cpp" |
// +-----------------------------------------------------------------+
#include "hurricane/isobar/PyNet.h"
#include "hurricane/isobar/PyComponent.h"
#include "hurricane/isobar/PyComponentCollection.h"
#include "hurricane/isobar/PyNetExternalComponents.h"
namespace Isobar {
using namespace Hurricane;
extern "C" {
#define METHOD_HEAD(function) GENERIC_METHOD_HEAD(NetExternalComponents,property,function)
// x=================================================================x
// | "PyNetExternalComponents" Python Module Code Part |
// x=================================================================x
#if defined(__PYTHON_MODULE__)
static void PyNetExternalComponents_DeAlloc ( PyNetExternalComponents* self )
{
cdebug_log(20,0) << "PySingletonObject_DeAlloc(" << hex << self << ")" << endl;
}
static PyObject* PyNetExternalComponents_isExternal ( PyObject*, PyObject *args )
{
cdebug_log(20,0) << "PyNetExternalComponents_isExternal()" << endl;
bool isExternal = false;
HTRY
PyObject* arg0;
if ( not ParseOneArg ( "NetExternalComponents.isExternal()", args, COMP_ARG, &arg0) ) return NULL;
isExternal = NetExternalComponents::isExternal(PYCOMPONENT_O(arg0));
HCATCH
if ( isExternal ) Py_RETURN_TRUE;
Py_RETURN_FALSE;
}
static PyObject* PyNetExternalComponents_setExternal ( PyObject*, PyObject *args )
{
cdebug_log(20,0) << "PyNetExternalComponents_setExternal()" << endl;
HTRY
PyObject* pyComponent;
if (PyArg_ParseTuple( args, "O", &pyComponent )) {
if (not PyObject_IsInstance(pyComponent,(PyObject*)&PyTypeComponent)) {
PyErr_SetString( ConstructorError, "NetExternalComponents.setExternal(): First argument is not of type Component." );
return NULL;
}
NetExternalComponents::setExternal( PYCOMPONENT_O(pyComponent) );
} else {
PyErr_SetString( ConstructorError, "Bad parameters given to NetExternalComponents.setExternal()." );
return NULL;
}
HCATCH
Py_RETURN_NONE;
}
static PyObject* PyNetExternalComponents_get ( PyObject*, PyObject* args )
{
cdebug_log(20,0) << "PyNetExternalComponents_getExternalComponents()" << endl;
PyObject* arg0;
PyComponentCollection* pyComponentCollection = NULL;
HTRY
if ( not ParseOneArg ( "getExternalComponents", args, ":ent", &arg0) ) return NULL;
Components* components = new Components(NetExternalComponents::get(PYNET_O(arg0)));
pyComponentCollection = PyObject_NEW(PyComponentCollection, &PyTypeComponentCollection);
if (pyComponentCollection == NULL) { return NULL; }
pyComponentCollection->_object = components;
HCATCH
return (PyObject*)pyComponentCollection;
}
PyMethodDef PyNetExternalComponents_Methods[] =
{ { "isExternal" , (PyCFunction)PyNetExternalComponents_isExternal , METH_VARARGS|METH_CLASS
, "Tells if Component belong to the externals of the Net." }
, { "setExternal", (PyCFunction)PyNetExternalComponents_setExternal, METH_VARARGS|METH_CLASS
, "Flag the Component as belonging to to the external part of it's Net." }
, { "get" , (PyCFunction)PyNetExternalComponents_get , METH_VARARGS|METH_CLASS
, "Returns the Collection of external components of the Net." }
, {NULL, NULL, 0, NULL} /* sentinel */
};
PyTypeObjectLinkPyTypeWithoutObject(NetExternalComponents,NetExternalComponents)
// extern void PyNetExternalComponents_LinkPyType()
// {
// cdebug_log(20,0) << "PyNetExternalComponents_LinkType()" << endl;
// PyTypeNetExternalComponents.tp_new = (newfunc) PyType_GenericNew;
// PyTypeNetExternalComponents.tp_dealloc = (destructor)PyNetExternalComponents_DeAlloc;
// PyTypeNetExternalComponents.tp_methods = PyNetExternalComponents_Methods;
// }
#else // End of Python Module Code Part.
// x=================================================================x
// | "PyNetExternalComponents" Shared Library Code Part |
// x=================================================================x
PyTypeObjectDefinitions(NetExternalComponents)
# endif // End of Shared Library Code Part.
} // End of extern "C".
Implementation of DataBase native save/restore in JSON (step 3). * Test: post-receive hook on server should send mail [1]. * New: In VLSISAPD, in Parameter, callback have now a tag, which the pointer to the caller. This allow for the callback removal when the caller is destroyed. * New: In VLSISAPD, in WidgetDescription, when associated to a parameter, the destructor must remove the associated callback function on the Parameter. * New: In Hurricane, added JSON support for Configuration, separated from vlsisapd, as the support is not available at this point. JSON support for Configuration, Parameter & LayoutDescription. * Change: In Hurricane, in JsonStack, the stack of JsonObjects has been displaced here from HurricaneHandler. This way, all JsonObject::toData() can access the JsonOjects in the context of the parser. * New: In Hurricane, in DBo::toJson() added support for Entity by reference (ids). * New: In Hurricane, added JSON support for all Layer sub-class types. * New: In Hurricane, in Technology, export the Layers, but must be sorted by increasing mask value. * New: In Hurricane, in Entity, added support for Entity by reference (ids). * New: In Hurricane, in DataBase, added technology full support. * New: In Hurricane, In JsonNet, move the ring rebuild management from JsonStack to JsonNet. * New: In Hurricane, added JSON support for NetAlias, NetExternalcomponents (not cleanly implemented as a Relation). * New: In Hurricane, new method Cell::fromJson() to load a cell from a JSON file. * New: In Hurricane, In Graphics, make it an observable, for when JSON fully reload the graphic state, it must be able to notify other objects (namely the Controller). * New: In Hurricane, in ControllerWidget, observe the Graphics to regenerate the palette as needed. New method ControllerTab::graphicsUpdated(). * New: In Hurricane, in RawDrawingStyle added a destructor to release the Qt pen/brush. Added JSON support for HSVr, DrawingStyle, DrawingGroup, & DisplayStyle. * New: In Hurricane, in GraphicsWidget, rewrite correctly the readGraphics() to erase the previous widgets and re-create the new ones. * New: In Hurricane, in PaletteWidget, correct re-creation of the layout/widgets in case of Graphics change. * New: In CRL Core, in System, register the parameters callbacks with the address of the object, for later deletion. * New: In CRL Core, in AllianceFramework, make it observable, to notify library changes. For the AllianceFramework creation, now allow to completly bypass the Python initialization system, when we expect to restore it from a full blob. Added methods to sets the default RoutingGauge & CellGauge. * New: In CRL Core, added JSON suppport for CellGauge, RoutingLayerGauge & RoutingGauge. * New: In CRL Core, in LibraryManager, oberver AllianceFramework, to update the list of libraries in case of change (for JSON full reload).
2016-02-20 14:24:44 -06:00
} // Isobar namespace.