From: <dhu...@us...> - 2006-12-15 09:57:55
|
Revision: 67 http://svn.sourceforge.net/qcell/?rev=67&view=rev Author: dhubleizh Date: 2006-12-15 01:57:50 -0800 (Fri, 15 Dec 2006) Log Message: ----------- - added storage maps - the way of storing Worlds and their changes throughout the experiment needs to be rethinked Modified Paths: -------------- trunk/qcell/baseheaders/StorageInterface.h trunk/qcell/storage/Storage.cpp trunk/qcell/storage/Storage.h Modified: trunk/qcell/baseheaders/StorageInterface.h =================================================================== --- trunk/qcell/baseheaders/StorageInterface.h 2006-12-15 09:23:43 UTC (rev 66) +++ trunk/qcell/baseheaders/StorageInterface.h 2006-12-15 09:57:50 UTC (rev 67) @@ -58,6 +58,12 @@ * @return Neighbourhood */ virtual Neighbourhood loadNeighbourhood(QString request) = 0; + /** + * @brief Saves given in XML Neighbourhood to the storage + * + * @param node XML representing Neighoburhood + */ + virtual void saveNeighbourhood(QDomNode node) = 0; /** Modified: trunk/qcell/storage/Storage.cpp =================================================================== --- trunk/qcell/storage/Storage.cpp 2006-12-15 09:23:43 UTC (rev 66) +++ trunk/qcell/storage/Storage.cpp 2006-12-15 09:57:50 UTC (rev 67) @@ -32,7 +32,20 @@ { } +void Storage::saveNeighbourhood(QDomNode node) +{ + if(node.nodeName != "Neighbourhood") + { + qDebug(tr("The XML sent to save isn't of Neighbourhood, but of %1 !") + .attr(node.nodeName()) + ); + return; + } + + +} + LocalFunction Storage::loadLocalFunction(QString request) { Modified: trunk/qcell/storage/Storage.h =================================================================== --- trunk/qcell/storage/Storage.h 2006-12-15 09:23:43 UTC (rev 66) +++ trunk/qcell/storage/Storage.h 2006-12-15 09:57:50 UTC (rev 67) @@ -11,17 +11,36 @@ #include "StorageInterface.h" #include <QByteArray> +#include <QDomNode> class Storage : public QObject, public StorageInterface { Q_OBJECT Q_INTERFACES(StorageInterface) - +protected: + /// Holds Neighbourhoods in XML indexed by filename + QMap<QString, QDomNode> Neighbourhoods; + /// Holds LocalFunctions in XML indexed by filename + QMap<QString, QDomNode> LocalFunctions; + /// + /** + * @brief Hodls Worlds indexed by random number + * + * As Worlds are the only things, that really get changed during + * an experiment, we need to store each world seperately, thus the + * indexing by a random number, to ensure, that even two worlds loaded + * from the same file are distinguishable, as experiments change worlds. + */ + /// @todo Find a way of keeping world changes + QMap<qint, QDomNode> Worlds; + +public: QByteArray loadData(QString request); QByteArray loadWholeData(); void saveData(QString request, QByteArray data); void saveWholeWhole(QByteArray data); Neighbourhood loadNeighbourhood(QString request); + void saveNeighbourhood(QDomNode node); LocalFunction loadLocalFunction(QString request); }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |