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 #ifndef H__configurationloader__ 00017 #define H__configurationloader__ 00018 00019 #include <QtCore> 00020 00021 class ConfigurationLoader{ 00022 00023 public : 00024 ConfigurationLoader(); 00025 ConfigurationLoader(QString&); 00026 long getIterations(); 00027 QRectF getWindow(); 00028 bool getUseRandom(); 00029 long getRandomCount(); 00030 bool getUseNetwork(); 00031 QList<QString> getNetworkAgents(); 00032 00033 void setUseRandom(bool); 00034 void setRandomCount(long); 00035 void setWindow(QRectF&); 00036 void setIterations(long); 00037 void setUseNetwork(bool); 00038 void setNetworkAgents(QList<QString>&); 00039 00040 void save(QString&); 00041 00042 00043 protected: 00044 bool useRandom; 00045 quint32 randomCount; 00046 quint32 iterations; 00047 QRectF window; 00048 QList<QString> networkAgents; 00049 bool useNetwork; 00050 00051 friend QDataStream &operator<<(QDataStream &out, const ConfigurationLoader &myObj); 00052 friend QDataStream &operator>>(QDataStream &in, ConfigurationLoader &myObj); 00053 }; 00054 00055 inline QDataStream &operator<<(QDataStream &out, const ConfigurationLoader &obj){ 00056 return( out << obj.iterations << obj.randomCount << obj.useRandom << obj.window << obj.networkAgents << obj.useNetwork); 00057 } 00058 inline QDataStream &operator>>(QDataStream &in, ConfigurationLoader &obj){ 00059 return( in >> obj.iterations >> obj.randomCount >> obj.useRandom >> obj.window >> obj.networkAgents >> obj.useNetwork); 00060 } 00061 00062 #endif 00063