00001 // Torc - Copyright 2011 University of Southern California. All Rights Reserved. 00002 // $HeadURL: https://torc-isi.svn.sourceforge.net/svnroot/torc-isi/branches/staging/0.9/src/torc/physical/XdlExporter.hpp $ 00003 // $Id: XdlExporter.hpp 10 2011-10-12 18:40:16Z nsteiner $ 00004 00005 // This program is free software: you can redistribute it and/or modify it under the terms of the 00006 // GNU General Public License as published by the Free Software Foundation, either version 3 of the 00007 // License, or (at your option) any later version. 00008 // 00009 // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 00010 // without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 00011 // the GNU General Public License for more details. 00012 // 00013 // You should have received a copy of the GNU General Public License along with this program. If 00014 // not, see <http://www.gnu.org/licenses/>. 00015 00016 /// \file 00017 /// \brief Header for the XdlExport class. 00018 00019 #ifndef TORC_PHYSICAL_XDLEXPORTER_HPP 00020 #define TORC_PHYSICAL_XDLEXPORTER_HPP 00021 00022 #include "torc/physical/Design.hpp" 00023 #include <boost/smart_ptr.hpp> 00024 #include <iostream> 00025 #include <string> 00026 00027 namespace torc { 00028 namespace physical { 00029 00030 /// \brief Physical design exporter for XDL. 00031 class XdlExporter { 00032 // members 00033 /// \brief The output stream. 00034 std::ostream& mStream; 00035 /// \brief The indent count. 00036 int mIndentCount; 00037 /// \brief The indent string. 00038 std::string mIndentString; 00039 // functions 00040 /// \brief Indent the current line. 00041 void indent(void) const 00042 { int count = mIndentCount; while(count--) mStream << mIndentString; } 00043 public: 00044 // constructors 00045 /// \brief Public constructor. 00046 /// \param inStream The output stream. 00047 /// \param inIndentString The indent string. The default parameter uses a single tab. 00048 XdlExporter(std::ostream& inStream, const std::string& inIndentString = "\t") 00049 : mStream(inStream), mIndentCount(0), mIndentString(inIndentString) {} 00050 // operators 00051 /// \brief Top level design exporter operator. 00052 void operator() (const DesignSharedPtr& inDesignPtr); 00053 // functions 00054 /// \brief Writes the given Circuit. 00055 void write(const Circuit& circuit); 00056 /// \brief Writes the given Design. 00057 void write(const Design& design); 00058 /// \brief Writes the given Module. 00059 void write(const Module& module); 00060 /// \brief Writes the given Port. 00061 void write(const Port& port); 00062 /// \brief Writes the given Instance. 00063 void write(const Instance& instance); 00064 /// \brief Writes the given Net. 00065 void write(const Net& net); 00066 /// \brief Writes the given InstancePin, with an optional trailing comma. 00067 void write(const InstancePin& instancePin, EPinDirection pinDirection, bool comma); 00068 /// \brief Writes the given pip, with an options trailing comma. 00069 void write(const Pip& pip, bool comma); 00070 /// \brief Writes the given Routethrough. 00071 void write(const Routethrough& routethrough); 00072 /// \brief Writes the given ConfigMap. 00073 void write(const ConfigMap& configMap); 00074 }; 00075 00076 } // namespace physical 00077 } // namespace torc 00078 00079 #endif // TORC_PHYSICAL_XDLEXPORTER_HPP