degate  0.1.2
GateLibraryExporter.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 __GATELIBRARYEXPORTER_H__
00023 #define __GATELIBRARYEXPORTER_H__
00024 
00025 #include "globals.h"
00026 #include "GateLibrary.h"
00027 #include "XMLExporter.h"
00028 #include "ObjectIDRewriter.h"
00029 
00030 #include <stdexcept>
00031 
00032 namespace degate {
00033 
00034 /**
00035  * The GateLibraryExporter exports a gate library. That is the file
00036  * gate_library.xml from your degate project.
00037  */
00038 
00039 class GateLibraryExporter : public XMLExporter {
00040 
00041 private:
00042 
00043   void add_gates(xmlpp::Element* templates_elem, GateLibrary_shptr gate_lib,
00044                  std::string const& directory);
00045 
00046   void add_images(xmlpp::Element* gate_elem, GateTemplate_shptr gate_tmpl,
00047                   std::string const& directory);
00048 
00049   void add_implementations(xmlpp::Element* gate_elem, GateTemplate_shptr gate_tmpl,
00050                            std::string const& directory);
00051 
00052   void add_ports(xmlpp::Element* gate_elem, GateTemplate_shptr gate_tmpl);
00053 
00054   ObjectIDRewriter_shptr oid_rewriter;
00055 
00056 public:
00057   GateLibraryExporter(ObjectIDRewriter_shptr _oid_rewriter) : oid_rewriter(_oid_rewriter) {}
00058   ~GateLibraryExporter() {}
00059 
00060   /**
00061    * @exception InvalidPathException
00062    * @exception InvalidPointerException
00063    * @exception std::runtime_error
00064    */
00065   void export_data(std::string const& filename, GateLibrary_shptr gate_lib);
00066 
00067 };
00068 
00069 }
00070 
00071 #endif