|
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 __GATELIBRARY_H__ 00023 #define __GATELIBRARY_H__ 00024 00025 #include <degate.h> 00026 #include <set> 00027 #include <map> 00028 #include <sstream> 00029 00030 namespace degate { 00031 00032 /** 00033 * This class represents a library of template cells. 00034 * 00035 * @todo There is no way to deal with gate libraries, which 00036 * have different image sizes for the gate templates then the 00037 * current project. There should be a way to scale the template 00038 * images, but it is unknown how to derive the scaling factor without pain. 00039 */ 00040 class GateLibrary { 00041 00042 public: 00043 00044 typedef std::map<object_id_t, GateTemplate_shptr> gate_lib_collection_t; 00045 typedef gate_lib_collection_t::iterator template_iterator; 00046 typedef gate_lib_collection_t::const_iterator const_template_iterator; 00047 00048 private: 00049 00050 gate_lib_collection_t templates; 00051 00052 public: 00053 00054 /** 00055 * Constructor for the gate library. 00056 */ 00057 00058 GateLibrary(); 00059 00060 /** 00061 * The dtor. 00062 */ 00063 00064 virtual ~GateLibrary(); 00065 00066 /** 00067 * Remove a template from the gate library. 00068 */ 00069 00070 void remove_template(GateTemplate_shptr gate_template); 00071 00072 /** 00073 * Add a template to the library. 00074 * @exception InvalidObjectIDException This exception is thrown if the 00075 * template has no object ID. 00076 * @exception InvalidPointerException 00077 */ 00078 00079 void add_template(GateTemplate_shptr gate_template); 00080 00081 /** 00082 * Get a gate template from the library. 00083 * @exception CollectionLookupException This exception is thrown if 00084 * there is no gate template that has ID \p id. 00085 * @exception InvalidObjectIDException This exception is thrown if the 00086 * object ID is invalid. 00087 * @return Returns a shared pointer to the template. The 00088 * pointer value is NULL, if a template with the \p id 00089 * was not found. 00090 */ 00091 00092 GateTemplate_shptr get_template(object_id_t id); 00093 00094 00095 /** 00096 * Check if a template for a given \p id exists. 00097 */ 00098 bool exists_template(object_id_t id) const; 00099 00100 /** 00101 * Check for a name in the gate library. 00102 * @return Returns true, if a template name is already used for a template. 00103 */ 00104 00105 bool is_name_in_use(std::string const & name) const; 00106 00107 00108 /** 00109 * Check if there is a template port in the gate library with the specified object ID. 00110 */ 00111 00112 bool exists_template_port(object_id_t port_id); 00113 00114 /** 00115 * Lookup a template port in the gate library. 00116 * @throws CollectionLookupException Throws this exception, if the port was nout found. 00117 */ 00118 00119 GateTemplatePort_shptr get_template_port(object_id_t port_id); 00120 00121 00122 /** 00123 * Get an iterator in order to iterate over gate templates. 00124 */ 00125 00126 template_iterator begin(); 00127 00128 /** 00129 * Get the end marker for the iteration. 00130 */ 00131 00132 template_iterator end(); 00133 00134 /** 00135 * Get an iterator in order to iterate over gate templates. 00136 */ 00137 00138 const_template_iterator begin() const; 00139 00140 /** 00141 * Get the end marker for the iteration. 00142 */ 00143 00144 const_template_iterator end() const; 00145 00146 /** 00147 * print the gate library. 00148 */ 00149 00150 void print(std::ostream & os); 00151 00152 }; 00153 00154 00155 00156 } 00157 00158 #endif 00159
1.7.4