TARIS-TreesDistance.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2007 by Universidad Nacional de Colombia                *
00003  *   http://www.unal.edu.co                                                *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00019  ***************************************************************************/
00020 #ifdef HAVE_CONFIG_H
00021 #include <config.h>
00022 #endif
00023 
00024 #include <iostream>
00025 #include <cstdlib>
00026 using namespace std;
00027 
00028 #include <HyperSurface.h>
00029 #include <Surface.h>
00030 #include <TarisApplication.h>
00031 #include <Tree.h>
00032 #include <vector>
00033 
00034 namespace Programs{
00035 
00043 class TARIS_TreesDistance{
00044         public:
00045                 static string usage()
00046                 {
00047                         system("clear") ;
00048                         return
00049                         "=================================\n"
00050                         "TARIS-TreesDistance (" __DATE__ ")\n"
00051                         "=================================\n"
00052                         "\n"
00053                         "Returns the distance between two trees that have been previously generated\n"
00054                         "with the TARIS-BuildTree program\n"
00055                         "\n"
00056                         "Syntax:\n"
00057                         "   $ TARIS-TreesDistance file1 file2\n"
00058                         "\n"
00059                         "Required parameters:\n"
00060                         "   file1\n"
00061                         "      This is the name of the first tree in gml format\n"
00062                         "   file2\n"
00063                         "      This is the name of the second tree in gml format\n"
00064                         "\n"
00065                         "For example:\n"
00066                         "\n"
00067                         "   $ TARIS-BuildTree -c file1.cube -o file1.gml\n"
00068                         "   $ TARIS-BuildTree -c file2.cube -o file2.gml\n"
00069                         "   $ TARIS-TreesDistance file1.gml file2.gml\n"
00070                         "\n"
00071                         "Authors:\n"
00072                         "   Nestor F. Aguirre, Ray M. Marin and Edgar E. Daza\n"
00073                         "   Universidad Nacional de Colombia\n"
00074                         ;
00075                 }
00076                 
00077                 static int main( int argc, char **argv )
00078                 {
00079                         
00080                         if( argc == 3 ){
00081                                 
00082                                 string gmlFileName1 = argv[1] ;
00083                                 string gmlFileName2 = argv[2] ;
00084                                 
00085                                 Tree tree1 ;
00086                                 tree1.load( gmlFileName1 ) ;
00087                                 
00088                                 Tree tree2 ;
00089                                 tree2.load( gmlFileName2 ) ;
00090                                 
00091                                 cout << "DISTANCE IS: " << Tree::distance( tree1, tree2 ) << endl ;
00092                                 
00093                         }else{
00094                                 cout << usage() << endl ;
00095                         }
00096                         
00097                         return EXIT_SUCCESS;
00098                 }
00099 };
00100 
00101 }
00102 
00103 int main( int argc, char **argv )
00104 {
00105         return Programs::TARIS_TreesDistance::main( argc, argv ) ;
00106 }

Generated on Mon May 26 20:29:46 2008 for TARIS by  doxygen 1.5.4