2 Copyright 2010 Intel Corporation
4 Use, modification and distribution are subject to the Boost Software License,
5 Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
6 http://www.boost.org/LICENSE_1_0.txt).
9 //schematic_database.hpp
10 #ifndef BOOST_POLYGON_TUTORIAL_SCHEMATIC_DATABASE_HPP
11 #define BOOST_POLYGON_TUTORIAL_SCHEMATIC_DATABASE_HPP
18 struct schematic_database{
19 std::vector<device> devices;
20 std::map<std::string, std::set<std::size_t> > nets;
23 //given a vector of devices populate the map of net name to set of device index
24 inline void extract_netlist(std::map<std::string, std::set<std::size_t> >& nets,
25 std::vector<device>& devices) {
26 for(std::size_t i = 0; i < devices.size(); ++i) {
27 for(std::size_t j = 0; j < devices[i].terminals.size(); ++j) {
28 //create association between net name and device id
29 nets[devices[i].terminals[j]].insert(nets[devices[i].terminals[j]].end(), i);
34 inline void parse_schematic_database(schematic_database& schematic,
36 std::vector<device>& devices = schematic.devices;
40 if(type_id == "Device") {
44 } else if (type_id == "Pin") {
49 d.terminals.push_back(net);
51 } else if (type_id == "") {
55 extract_netlist(schematic.nets, devices);