degate  0.1.2
LogicModelExporter.h
Go to the documentation of this file.
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 __LOGICMODELEXPORTER_H__
00023 #define __LOGICMODELEXPORTER_H__
00024 
00025 #include "globals.h"
00026 #include "LogicModel.h"
00027 #include "XMLExporter.h"
00028 #include "ObjectIDRewriter.h"
00029 #include "Layer.h"
00030 
00031 #include <stdexcept>
00032 
00033 namespace degate {
00034 
00035 /**
00036  * The LogicModelExporter exports a logic model. That is the file lmodel.xml from your degate project.
00037  *
00038  */
00039 
00040 class LogicModelExporter : public XMLExporter {
00041 
00042 private:
00043   typedef std::map<object_id_t /* net id */, xmlpp::Element *> net_element_map_type;
00044 
00045   void add_gate(xmlpp::Element* gates_elem, Gate_shptr gate, layer_position_t layer_pos);
00046   void add_wire(xmlpp::Element* wires_elem, Wire_shptr wire, layer_position_t layer_pos);
00047   void add_via(xmlpp::Element* vias_elem, Via_shptr via, layer_position_t layer_pos);
00048 
00049   void add_emarker(xmlpp::Element* emarkers_elem, EMarker_shptr emarker, layer_position_t layer_pos);
00050 
00051   void add_nets(xmlpp::Element* nets_elem, LogicModel_shptr lmodel);
00052 
00053   void add_annotation(xmlpp::Element* annotations_elem, Annotation_shptr annotation, layer_position_t layer_pos);
00054 
00055   void add_module(xmlpp::Element* modules_elem, LogicModel_shptr lmodel, Module_shptr module);
00056 
00057   ObjectIDRewriter_shptr oid_rewriter;
00058 
00059 public:
00060   LogicModelExporter(ObjectIDRewriter_shptr _oid_rewriter) : oid_rewriter(_oid_rewriter) {}
00061   ~LogicModelExporter() {}
00062 
00063   void export_data(std::string const& filename, LogicModel_shptr lmodel);
00064 
00065 };
00066 
00067 }
00068 
00069 #endif