00001
00030 #include "OSResult.h"
00031 #include "OSiLReader.h"
00032 #include "OSiLWriter.h"
00033 #include "OSrLReader.h"
00034 #include "OSrLWriter.h"
00035 #include "OSInstance.h"
00036 #include "OSnLNode.h"
00037 #include "FileUtil.h"
00038 #include "ErrorClass.h"
00039 #include "WSUtil.h"
00040 #include "OSSolverAgent.h"
00041 #include "CoinHelperFunctions.hpp"
00042
00043
00044 #ifdef HAVE_CTIME
00045 # include <ctime>
00046 #else
00047 # ifdef HAVE_TIME_H
00048 # include <time.h>
00049 # else
00050 # error "don't have header file for time"
00051 # endif
00052 #endif
00053
00054
00055 #include <sstream>
00056 #include <vector>
00057
00058
00059 int main(int argC, char* argV[])
00060 {
00061 try{
00062 if( argC != 2) throw ErrorClass( "there must be exactly one command line argument which should be the file name");
00063 FileUtil *fileUtil = NULL;
00064 fileUtil = new FileUtil();
00065 time_t start, finish, tmp;
00066 std::string osilFileNameWithPath;
00067 std::string osilFileName;
00068 std::string osil;
00069 std::string uploadResult;
00070 const char dirsep = CoinFindDirSeparator();
00071 osilFileNameWithPath = argV[ 1];
00072 std::cout << "FILE NAME = " << argV[1] << std::endl;
00073 std::cout << "Read the file into a string" << std::endl;
00074 osil = fileUtil->getFileAsString( &osilFileNameWithPath[ 0]);
00075 OSSolverAgent* osagent = NULL;
00076 osagent = new OSSolverAgent("http://gsbkip.chicagogsb.edu/os/servlet/OSFileUpload");
00077
00078
00079 int index = osilFileNameWithPath.find_last_of( dirsep);
00080 int slength = osilFileNameWithPath.size();
00081 osilFileName = osilFileNameWithPath.substr( index + 1, slength - 1) ;
00082 std::cout << std::endl << std::endl;
00083 std::cout << "Place remote synchronous call" << std::endl;
00084
00085
00086 start = time( &tmp);
00087 uploadResult = osagent->fileUpload(osilFileName, osil);
00088 finish = time( &tmp);
00089 std::cout << "File Upload took (seconds): "<< difftime(finish, start) << std::endl;
00090 std::cout << uploadResult << std::endl;
00091
00092
00093
00094
00095
00096
00097
00098
00099 return 0;
00100 }
00101 catch( const ErrorClass& eclass){
00102 std::cout << eclass.errormsg << std::endl;
00103 return 0;
00104 }
00105 }
00106