From ec97d7f36939ed2740e4bfe9542a146b91f0c31e Mon Sep 17 00:00:00 2001 From: Damien Dupuis Date: Mon, 22 Nov 2010 14:44:17 +0000 Subject: [PATCH] Thanks to the help of Jean-Paul may python installation is alive ! - Updated Boost.Python port for OpenChams - Updated drive & aprse examples in Python --- vlsisapd/src/openChams/src/PyOpenChams.cpp | 43 ++++++++++++++-------- 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/vlsisapd/src/openChams/src/PyOpenChams.cpp b/vlsisapd/src/openChams/src/PyOpenChams.cpp index 80eff154..de214639 100644 --- a/vlsisapd/src/openChams/src/PyOpenChams.cpp +++ b/vlsisapd/src/openChams/src/PyOpenChams.cpp @@ -8,6 +8,7 @@ using namespace boost::python; #include "vlsisapd/openChams/Parameters.h" #include "vlsisapd/openChams/Transistor.h" #include "vlsisapd/openChams/Instance.h" +#include "vlsisapd/openChams/Device.h" #include "vlsisapd/openChams/Net.h" #include "vlsisapd/openChams/Netlist.h" #include "vlsisapd/openChams/Schematic.h" @@ -97,33 +98,42 @@ BOOST_PYTHON_MODULE(OPENCHAMS) { // map wrapping and vector_indexing for OpenChams::Instance STL_MAP_WRAPPING_PTR(Name, Net*, "ConnectorsMap") - - class_ >("TransistorsVector") - .def(vector_indexing_suite, true>()) - ; // class OpenChams::Instance class_("Instance", init()) // properties .add_property("name" , &Instance::getName ) .add_property("model" , &Instance::getModel ) -// .add_property("mosType" , &Instance::getMosType ) -// .add_property("sourceBulkConnected", &Instance::isSourceBulkConnected) .add_property("parameters" , &Instance::getParameters ) .add_property("netlist" , make_function(&Instance::getNetlist ,return_value_policy())) //make_function since we need to specify a return value policy // accessors .def("hasNoConnectors" , &Instance::hasNoConnectors ) -// .def("hasNoTransistors", &Instance::hasNoTransistors) // modifiers .def("addConnector" , &Instance::addConnector ) .def("connect" , &Instance::connect ) -// .def("addTransistor", &Instance::addTransistor, return_value_policy()) .def("addParameter" , static_cast(&Transistor::addParameter)) .def("addParameter" , static_cast(&Transistor::addParameter)) // stl containers .def("getConnectors" , &Instance::getConnectors , return_internal_reference<>()) -// .def("getTransistors", &Instance::getTransistors, return_internal_reference<>()) ; + // vector_indexing for OpenChams::Device + class_ >("TransistorsVector") + .def(vector_indexing_suite, true>()) + ; + // class OpenChams::Device + class_ >("Device", init()) + // properties + .add_property("mosType" , &Device::getMosType ) + .add_property("sourceBulkConnected", &Device::isSourceBulkConnected) + // accessors + .def("hasNoTransistors", &Device::hasNoTransistors) + // modifiers + .def("addTransistor", &Device::addTransistor, return_value_policy()) + // stl containers + .def("getTransistors", &Device::getTransistors, return_internal_reference<>()) + ; + + // vector_indexing for OpenChams::Net class_ >("ConnectionsVector") .def(vector_indexing_suite, true>()) @@ -166,11 +176,12 @@ BOOST_PYTHON_MODULE(OPENCHAMS) { .def("getInstance" , make_function(&Netlist::getInstance , return_value_policy())) .def("getNet" , make_function(&Netlist::getNet , return_value_policy())) // modifiers - .def("addInstance", &Netlist::addInstance, return_value_policy()) - .def("addNet" , &Netlist::addNet , return_value_policy()) + .def("addInstance" , &Netlist::addInstance, return_value_policy()) + .def("addDevice" , &Netlist::addDevice , return_value_policy()) + .def("addNet" , &Netlist::addNet , return_value_policy()) // stl containers - .def("getInstances", &Netlist::getInstances, return_internal_reference<>()) - .def("getNets" , &Netlist::getNets , return_internal_reference<>()) + .def("getInstances" , &Netlist::getInstances, return_internal_reference<>()) + .def("getNets" , &Netlist::getNets , return_internal_reference<>()) ; // map wrapping for OpenChams::Schematic @@ -179,13 +190,13 @@ BOOST_PYTHON_MODULE(OPENCHAMS) { // class OpenChams::Schematic scope schematicScope = class_("Schematic", init()) // properties - .add_property("zoom", &Schematic::getZoom) + .add_property("zoom" , &Schematic::getZoom) // accessors .def("hasNoInstances", &Schematic::hasNoInstances) // modifiers - .def("addInstance", &Schematic::addInstance) + .def("addInstance" , &Schematic::addInstance) // stl containers - .def("getInstances", &Schematic::getInstances, return_internal_reference<>()) + .def("getInstances" , &Schematic::getInstances, return_internal_reference<>()) ; // class OpenChams::Schematic::Infos