00001 #include "SIGEL_GP/SIG_GPPVMHost.h" 00002 00003 #include <qtextstream.h> 00004 00005 namespace SIGEL_GP 00006 { 00007 00008 SIG_GPPVMHost::SIG_GPPVMHost() 00009 : name(), 00010 maxSlaves( 1 ), 00011 enabled( false ), 00012 executableDir() 00013 { }; 00014 00015 SIG_GPPVMHost::SIG_GPPVMHost( QString name, 00016 int maxSlaves, 00017 bool enabled, 00018 QDir executableDir ) 00019 : name( name ), 00020 maxSlaves( maxSlaves ), 00021 enabled( enabled ), 00022 executableDir( executableDir ) 00023 { }; 00024 00025 SIG_GPPVMHost::SIG_GPPVMHost( QString input ) 00026 { 00027 QTextStream inputStream( &input, IO_ReadOnly ); 00028 00029 int enabledInt = 0; 00030 00031 char buffer = 0; 00032 00033 inputStream >> name 00034 >> maxSlaves 00035 >> enabledInt 00036 >> buffer 00037 >> buffer; 00038 00039 QString dirString; 00040 00041 while (buffer != '\"') 00042 { 00043 dirString.append( buffer ); 00044 inputStream >> buffer; 00045 }; 00046 00047 enabled = enabledInt; 00048 executableDir.setPath( dirString ); 00049 }; 00050 00051 QString SIG_GPPVMHost::print() const 00052 { 00053 QString result; 00054 00055 QTextStream resultStream( &result, IO_WriteOnly ); 00056 00057 resultStream << name 00058 << " " 00059 << maxSlaves 00060 << " " 00061 << enabled 00062 << " " 00063 << "\"" 00064 << executableDir.path() 00065 << "\"" 00066 << "\n"; 00067 00068 return result; 00069 }; 00070 00071 }