]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | /* |
2 | Copyright 2010 Intel Corporation | |
3 | ||
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). | |
7 | */ | |
8 | ||
9 | //parse_layout.hpp | |
10 | #ifndef BOOST_POLYGON_TUTORIAL_PARSE_LAYOUT_HPP | |
11 | #define BOOST_POLYGON_TUTORIAL_PARSE_LAYOUT_HPP | |
12 | #include <string> | |
13 | #include <iostream> | |
14 | #include <fstream> | |
15 | #include <vector> | |
16 | #include "layout_rectangle.hpp" | |
17 | #include "layout_pin.hpp" | |
18 | ||
19 | //populates vectors of layout rectangles and pins | |
20 | inline void parse_layout(std::vector<layout_rectangle>& rects, std::vector<layout_pin>& pins, | |
21 | std::ifstream& sin) { | |
22 | while(!sin.eof()) { | |
23 | std::string type_id; | |
24 | sin >> type_id; | |
25 | if(type_id == "Rectangle") { | |
26 | layout_rectangle rect; | |
27 | sin >> rect; | |
28 | rects.push_back(rect); | |
29 | } else if (type_id == "Pin") { | |
30 | layout_pin pin; | |
31 | sin >> pin; | |
32 | pins.push_back(pin); | |
33 | } else if (type_id == "") { | |
34 | break; | |
35 | } | |
36 | } | |
37 | } | |
38 | ||
39 | #endif |