parse_layout.hpp 999 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*
  2. Copyright 2010 Intel Corporation
  3. Use, modification and distribution are subject to the Boost Software License,
  4. Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  5. http://www.boost.org/LICENSE_1_0.txt).
  6. */
  7. //parse_layout.hpp
  8. #ifndef BOOST_POLYGON_TUTORIAL_PARSE_LAYOUT_HPP
  9. #define BOOST_POLYGON_TUTORIAL_PARSE_LAYOUT_HPP
  10. #include <string>
  11. #include <iostream>
  12. #include <fstream>
  13. #include <vector>
  14. #include "layout_rectangle.hpp"
  15. #include "layout_pin.hpp"
  16. //populates vectors of layout rectangles and pins
  17. inline void parse_layout(std::vector<layout_rectangle>& rects, std::vector<layout_pin>& pins,
  18. std::ifstream& sin) {
  19. while(!sin.eof()) {
  20. std::string type_id;
  21. sin >> type_id;
  22. if(type_id == "Rectangle") {
  23. layout_rectangle rect;
  24. sin >> rect;
  25. rects.push_back(rect);
  26. } else if (type_id == "Pin") {
  27. layout_pin pin;
  28. sin >> pin;
  29. pins.push_back(pin);
  30. } else if (type_id == "") {
  31. break;
  32. }
  33. }
  34. }
  35. #endif