Thanks to the help of Jean-Paul may python installation is alive !

- Updated Boost.Python port for OpenChams

  - Updated drive & aprse examples in Python
This commit is contained in:
Damien Dupuis 2010-11-22 14:44:17 +00:00
parent 501ac35b2b
commit ec97d7f369
1 changed files with 27 additions and 16 deletions

View File

@ -8,6 +8,7 @@ using namespace boost::python;
#include "vlsisapd/openChams/Parameters.h" #include "vlsisapd/openChams/Parameters.h"
#include "vlsisapd/openChams/Transistor.h" #include "vlsisapd/openChams/Transistor.h"
#include "vlsisapd/openChams/Instance.h" #include "vlsisapd/openChams/Instance.h"
#include "vlsisapd/openChams/Device.h"
#include "vlsisapd/openChams/Net.h" #include "vlsisapd/openChams/Net.h"
#include "vlsisapd/openChams/Netlist.h" #include "vlsisapd/openChams/Netlist.h"
#include "vlsisapd/openChams/Schematic.h" #include "vlsisapd/openChams/Schematic.h"
@ -97,33 +98,42 @@ BOOST_PYTHON_MODULE(OPENCHAMS) {
// map wrapping and vector_indexing for OpenChams::Instance // map wrapping and vector_indexing for OpenChams::Instance
STL_MAP_WRAPPING_PTR(Name, Net*, "ConnectorsMap") STL_MAP_WRAPPING_PTR(Name, Net*, "ConnectorsMap")
class_<std::vector<Transistor*> >("TransistorsVector")
.def(vector_indexing_suite<std::vector<Transistor*>, true>())
;
// class OpenChams::Instance // class OpenChams::Instance
class_<Instance, Instance*>("Instance", init<Name, Name, Netlist*>()) class_<Instance, Instance*>("Instance", init<Name, Name, Netlist*>())
// properties // properties
.add_property("name" , &Instance::getName ) .add_property("name" , &Instance::getName )
.add_property("model" , &Instance::getModel ) .add_property("model" , &Instance::getModel )
// .add_property("mosType" , &Instance::getMosType )
// .add_property("sourceBulkConnected", &Instance::isSourceBulkConnected)
.add_property("parameters" , &Instance::getParameters ) .add_property("parameters" , &Instance::getParameters )
.add_property("netlist" , make_function(&Instance::getNetlist ,return_value_policy<reference_existing_object>())) //make_function since we need to specify a return value policy .add_property("netlist" , make_function(&Instance::getNetlist ,return_value_policy<reference_existing_object>())) //make_function since we need to specify a return value policy
// accessors // accessors
.def("hasNoConnectors" , &Instance::hasNoConnectors ) .def("hasNoConnectors" , &Instance::hasNoConnectors )
// .def("hasNoTransistors", &Instance::hasNoTransistors)
// modifiers // modifiers
.def("addConnector" , &Instance::addConnector ) .def("addConnector" , &Instance::addConnector )
.def("connect" , &Instance::connect ) .def("connect" , &Instance::connect )
// .def("addTransistor", &Instance::addTransistor, return_value_policy<reference_existing_object>())
.def("addParameter" , static_cast<void(Transistor::*)(Name, double )>(&Transistor::addParameter)) .def("addParameter" , static_cast<void(Transistor::*)(Name, double )>(&Transistor::addParameter))
.def("addParameter" , static_cast<void(Transistor::*)(Name, std::string)>(&Transistor::addParameter)) .def("addParameter" , static_cast<void(Transistor::*)(Name, std::string)>(&Transistor::addParameter))
// stl containers // stl containers
.def("getConnectors" , &Instance::getConnectors , return_internal_reference<>()) .def("getConnectors" , &Instance::getConnectors , return_internal_reference<>())
// .def("getTransistors", &Instance::getTransistors, return_internal_reference<>())
; ;
// vector_indexing for OpenChams::Device
class_<std::vector<Transistor*> >("TransistorsVector")
.def(vector_indexing_suite<std::vector<Transistor*>, true>())
;
// class OpenChams::Device
class_<Device, bases<Instance> >("Device", init<Name, Name, Name, bool, Netlist*>())
// properties
.add_property("mosType" , &Device::getMosType )
.add_property("sourceBulkConnected", &Device::isSourceBulkConnected)
// accessors
.def("hasNoTransistors", &Device::hasNoTransistors)
// modifiers
.def("addTransistor", &Device::addTransistor, return_value_policy<reference_existing_object>())
// stl containers
.def("getTransistors", &Device::getTransistors, return_internal_reference<>())
;
// vector_indexing for OpenChams::Net // vector_indexing for OpenChams::Net
class_<std::vector<Net::Connection*> >("ConnectionsVector") class_<std::vector<Net::Connection*> >("ConnectionsVector")
.def(vector_indexing_suite<std::vector<Net::Connection*>, true>()) .def(vector_indexing_suite<std::vector<Net::Connection*>, true>())
@ -167,6 +177,7 @@ BOOST_PYTHON_MODULE(OPENCHAMS) {
.def("getNet" , make_function(&Netlist::getNet , return_value_policy<reference_existing_object>())) .def("getNet" , make_function(&Netlist::getNet , return_value_policy<reference_existing_object>()))
// modifiers // modifiers
.def("addInstance" , &Netlist::addInstance, return_value_policy<reference_existing_object>()) .def("addInstance" , &Netlist::addInstance, return_value_policy<reference_existing_object>())
.def("addDevice" , &Netlist::addDevice , return_value_policy<reference_existing_object>())
.def("addNet" , &Netlist::addNet , return_value_policy<reference_existing_object>()) .def("addNet" , &Netlist::addNet , return_value_policy<reference_existing_object>())
// stl containers // stl containers
.def("getInstances" , &Netlist::getInstances, return_internal_reference<>()) .def("getInstances" , &Netlist::getInstances, return_internal_reference<>())