Allow to demote Net external component to "internal", export to Python.
This commit is contained in:
parent
21c269a855
commit
07b51b10c7
|
@ -67,6 +67,10 @@ namespace Hurricane {
|
|||
}
|
||||
|
||||
|
||||
void NetExternalComponents::setInternal ( Component* component )
|
||||
{ component->removeProperty( _name ); }
|
||||
|
||||
|
||||
void NetExternalComponents::setExternal ( Component* component )
|
||||
{
|
||||
Net* net = component->getNet();
|
||||
|
|
|
@ -29,9 +29,7 @@
|
|||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
#ifndef HURRICANE_NET_EXTERNAL_COMPONENTS_H
|
||||
#define HURRICANE_NET_EXTERNAL_COMPONENTS_H
|
||||
|
||||
#pragma once
|
||||
#include "hurricane/Component.h"
|
||||
#include "hurricane/Relation.h"
|
||||
|
||||
|
@ -44,6 +42,7 @@ namespace Hurricane {
|
|||
class NetExternalComponents {
|
||||
public:
|
||||
static Components get ( const Net* );
|
||||
static void setInternal ( Component* );
|
||||
static void setExternal ( Component* );
|
||||
static bool isExternal ( Component* );
|
||||
static void toJson ( JsonWriter*, const Net* );
|
||||
|
@ -69,5 +68,3 @@ namespace Hurricane {
|
|||
|
||||
|
||||
} // Hurricane namespace.
|
||||
|
||||
#endif // HURRICANE_NET_EXTERNAL_COMPONENTS_H
|
||||
|
|
|
@ -61,6 +61,26 @@ extern "C" {
|
|||
}
|
||||
|
||||
|
||||
static PyObject* PyNetInternalComponents_setInternal ( PyObject*, PyObject *args )
|
||||
{
|
||||
cdebug_log(20,0) << "PyNetInternalComponents_setInternal()" << endl;
|
||||
HTRY
|
||||
PyObject* pyComponent;
|
||||
if (PyArg_ParseTuple( args, "O", &pyComponent )) {
|
||||
if (not PyObject_IsInstance(pyComponent,(PyObject*)&PyTypeComponent)) {
|
||||
PyErr_SetString( ConstructorError, "NetInternalComponents.setInternal(): First argument is not of type Component." );
|
||||
return NULL;
|
||||
}
|
||||
NetExternalComponents::setInternal( PYCOMPONENT_O(pyComponent) );
|
||||
} else {
|
||||
PyErr_SetString( ConstructorError, "Bad parameters given to NetInternalComponents.setInternal()." );
|
||||
return NULL;
|
||||
}
|
||||
HCATCH
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
|
||||
static PyObject* PyNetExternalComponents_setExternal ( PyObject*, PyObject *args )
|
||||
{
|
||||
cdebug_log(20,0) << "PyNetExternalComponents_setExternal()" << endl;
|
||||
|
@ -110,6 +130,8 @@ extern "C" {
|
|||
PyMethodDef PyNetExternalComponents_Methods[] =
|
||||
{ { "isExternal" , (PyCFunction)PyNetExternalComponents_isExternal , METH_VARARGS|METH_CLASS
|
||||
, "Tells if Component belong to the externals of the Net." }
|
||||
, { "setInternal", (PyCFunction)PyNetInternalComponents_setInternal, METH_VARARGS|METH_CLASS
|
||||
, "Remove the Component from the external part of it's 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
|
||||
|
|
Loading…
Reference in New Issue