00001 /* 00002 Copyright 2010 Pierre SCHWARTZ 00003 00004 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 00005 documentation files (the "Software"), to deal in the Software without restriction, including without 00006 limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 00007 of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following 00008 conditions: The above copyright notice and this permission notice shall be included in all copies or 00009 substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 00010 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 00011 PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 00012 DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 00013 OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 00014 */ 00015 00016 #include "configurationloader.h" 00017 00018 ConfigurationLoader::ConfigurationLoader(){ 00019 00020 } 00021 00022 ConfigurationLoader::ConfigurationLoader(QString& filename){ 00023 QFile file(filename); 00024 file.open(QIODevice::ReadOnly); 00025 QDataStream stream( &file ); 00026 stream >> *this; 00027 } 00028 00029 long ConfigurationLoader::getIterations(){ 00030 return iterations; 00031 } 00032 00033 QRectF ConfigurationLoader::getWindow(){ 00034 return window; 00035 } 00036 00037 bool ConfigurationLoader::getUseRandom(){ 00038 return useRandom; 00039 } 00040 00041 long ConfigurationLoader::getRandomCount(){ 00042 return randomCount; 00043 } 00044 00045 void ConfigurationLoader::setUseRandom(bool b){ 00046 useRandom = b; 00047 } 00048 00049 void ConfigurationLoader::setRandomCount(long l){ 00050 randomCount = l; 00051 } 00052 00053 void ConfigurationLoader::setWindow(QRectF& w){ 00054 window = w; 00055 } 00056 00057 void ConfigurationLoader::setIterations(long i){ 00058 iterations = i; 00059 } 00060 00061 bool ConfigurationLoader::getUseNetwork(){ 00062 return useNetwork; 00063 } 00064 00065 void ConfigurationLoader::setUseNetwork(bool b){ 00066 useNetwork = b; 00067 } 00068 00069 void ConfigurationLoader::setNetworkAgents(QList<QString>& l){ 00070 networkAgents = l; 00071 } 00072 00073 QList<QString> ConfigurationLoader::getNetworkAgents(){ 00074 return networkAgents; 00075 } 00076 00077 void ConfigurationLoader::save(QString& filename){ 00078 QFile file(filename); 00079 file.open(QIODevice::WriteOnly); 00080 QDataStream stream( &file ); 00081 stream << (*this); 00082 } 00083