00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include <fstream>
00020 #include "MarkExtracter.hpp"
00021 #include "torc/common/DirectoryTree.hpp"
00022 #include "torc/physical/XdlImporter.hpp"
00023 #include "torc/physical/XdlExporter.hpp"
00024
00025
00026 int main(int argc, char *argv[]) {
00027 typedef std::string string;
00028 torc::common::DirectoryTree directoryTree(argv[0]);
00029
00030 std::cout << "XDL Extracter: " << __DATE__ << " " << __TIME__ << std::endl;
00031
00032 if (argc != 4) {
00033 std::cout << "Usage: " << argv[0] << " <pattern> <xdlfile> <outxdlfile>" << std::endl;
00034 return 1;
00035 }
00036
00037 string argpattern = argv[1];
00038 string argxdl = argv[2];
00039 string argoutxdl = argv[3];
00040
00041
00042 boost::filesystem::path xdlPath = directoryTree.getExecutablePath() / argxdl;
00043 boost::filesystem::path xdlOutPath = directoryTree.getExecutablePath() / argoutxdl;
00044
00045 std::fstream xdlFile(xdlPath.string().c_str());
00046
00047
00048 torc::physical::XdlImporter importer;
00049
00050 importer(xdlFile, xdlPath.string());
00051 torc::physical::DesignSharedPtr designPtr = importer.getDesignPtr();
00052
00053
00054 torc::MarkExtracter extract(std::cout, designPtr, argpattern);
00055 torc::physical::DesignSharedPtr newDesignPtr = extract.extract();
00056
00057 std::fstream xdlOutFile(xdlOutPath.string().c_str(), std::ios_base::out);
00058 torc::physical::XdlExporter exporter(xdlOutFile);
00059
00060 exporter(newDesignPtr);
00061
00062 std::cout << "Output: " << xdlOutPath.string() << std::endl;
00063
00064 return 0;
00065 }
00066