|
degate 0.1.1
|
00001 /* -*-c++-*- 00002 00003 This file is part of the IC reverse engineering tool degate. 00004 00005 Copyright 2008, 2009, 2010 by Martin Schobert 00006 00007 Degate is free software: you can redistribute it and/or modify 00008 it under the terms of the GNU General Public License as published by 00009 the Free Software Foundation, either version 3 of the License, or 00010 any later version. 00011 00012 Degate is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 GNU General Public License for more details. 00016 00017 You should have received a copy of the GNU General Public License 00018 along with degate. If not, see <http://www.gnu.org/licenses/>. 00019 00020 */ 00021 00022 #ifndef __EXTERNALMATCHING_H__ 00023 #define __EXTERNALMATCHING_H__ 00024 00025 #include <Image.h> 00026 #include <Project.h> 00027 #include <TemplateMatching.h> 00028 00029 namespace degate { 00030 00031 /** 00032 * Run an external program, that analyzes images. 00033 * The program extracts wires and vias and writes 00034 * the results into a file. The file is parsed 00035 * bu this class and the object are added into 00036 * the logic model. 00037 * 00038 * Here is a brief decription of the result file: 00039 * 00040 * Comment lines are starting with a hash mark ('#') 00041 * 00042 * Wire: 00043 * 00044 * Format: "wire" x1 y1 x2 y2 diameter 00045 * Example: wire 10 23 100 23 5 00046 * 00047 * Via: 00048 * 00049 * Format: "via" x y diameter direction 00050 * Example: via 42 23 5 up 00051 * 00052 * The direction is either "up" or "down" 00053 * 00054 * Strings are case sensitive. 00055 */ 00056 class ExternalMatching : public Matching { 00057 00058 private: 00059 00060 Layer_shptr layer; 00061 LogicModel_shptr lmodel; 00062 BackgroundImage_shptr img; 00063 BoundingBox bounding_box; 00064 00065 std::string cmd; 00066 int exit_code; 00067 00068 private: 00069 00070 std::list<PlacedLogicModelObject_shptr> parse_file(std::string const& filename) const; 00071 00072 /** 00073 * Parse a line, that describes an object. 00074 * @exception DegateRuntimeExcpetion This expetion is thrown 00075 * if a line cannot be parsed. 00076 * @return Returns a shared pointer to an object, that can be added 00077 * to the logic model. It returns a NULL pointer equivalent, if the 00078 * line does not represent a command. 00079 */ 00080 00081 PlacedLogicModelObject_shptr parse_line(std::string const& line) const; 00082 00083 00084 public: 00085 00086 ExternalMatching(); 00087 00088 /** 00089 * 00090 * @exception InvalidPointerException 00091 * @exception DegateRuntimeException 00092 */ 00093 virtual void init(BoundingBox const& bounding_box, Project_shptr project); 00094 00095 virtual void run(); 00096 00097 void set_command(std::string const& cmd); 00098 std::string get_command() const; 00099 00100 int get_exit_code() const; 00101 }; 00102 00103 typedef std::tr1::shared_ptr<ExternalMatching> ExternalMatching_shptr; 00104 } 00105 00106 #endif
1.7.4