Biomechanical Joint Model
 Author: Anderson Maciel

jointBuilder/main.cpp

Go to the documentation of this file.
00001 
00002 /***************************************************************************
00003  *   Copyright (C) 2005 by Anderson Maciel                                 *
00004  *   andi.maciel@gmail.com                                                   *
00005  *                                                                         *
00006  *   This program is free software; you can redistribute it and/or modify  *
00007  *   it under the terms of the GNU General Public License as published by  *
00008  *   the Free Software Foundation; either version 2 of the License, or     *
00009  *   (at your option) any later version.                                   *
00010  *                                                                         *
00011  *   This program is distributed in the hope that it will be useful,       *
00012  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00014  *   GNU General Public License for more details.                          *
00015  *                                                                         *
00016  *   You should have received a copy of the GNU General Public License     *
00017  *   along with this program; if not, write to the                         *
00018  *   Free Software Foundation, Inc.,                                       *
00019  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00020  ***************************************************************************/
00021 
00022 #include        <general/comesimulator.h>
00023 #include        <general/comescenario.h>
00024 #include        <general/comexml.h>
00025 #include        <string>
00026 
00027 using namespace std;
00028 
00029 COME_Scenario *scene;
00030 COME_Simulator *simulator;
00031 
00032 int loadData( string file_name );
00033 int exportData( string file_name );
00034 
00035 int
00036 main( int argc, char ** argv ) {
00037 
00038         if( ( argc > 1 ) && ( argc < 3 ) ){
00039                 printf("Usage: jointBuilder [input_file] [output_file]\n" );
00040         } else if( argc == 3 ){
00041                 string output_file = argv[2];
00042                 string input_file = argv[1];
00043 
00044                 if( !loadData( input_file ) ){
00045                         printf( "Input file %s could not be properly loaded. %s has NOT been created.\n", input_file.c_str(), output_file.c_str());
00046                         return 0;
00047                 }
00048                 if( !exportData( output_file ) ){
00049                         printf( "Error exporting %s. The file has NOT been created.\n", output_file.c_str());
00050                         return 0;
00051                 }
00052         }
00053         
00054         return 1;
00055 }
00056 
00057 int
00058 loadData( string file_name ){
00059 
00060         scene = new COME_Scenario();
00061         simulator = new COME_Simulator();
00062         simulator->setScene( scene );
00063 
00064         COME_Xml doc;
00065         return ( doc.loadIntegrationFile( file_name, *(scene->getPatientList()), simulator, scene ) );
00066 }
00067 
00068 int
00069 exportData( string file_name ){
00070 
00071         COME_Xml doc;
00072         return doc.exportIntegrationFile( file_name, *(scene->getPatientList()), simulator );
00073 }

Generated on Thu Dec 1 10:13:38 2005 for COME - Biomechanical Joint Model by  doxygen 1.4.5