|
From: <dhu...@us...> - 2006-11-28 19:29:17
|
Revision: 14
http://svn.sourceforge.net/qcell/?rev=14&view=rev
Author: dhubleizh
Date: 2006-11-28 11:29:15 -0800 (Tue, 28 Nov 2006)
Log Message:
-----------
- newlines anti-warnings
- parsers stuff
Modified Paths:
--------------
trunk/qcell/baseheaders/ClientInfo.h
trunk/qcell/basesources/Client.cpp
Added Paths:
-----------
trunk/qcell/libs/
trunk/qcell/parsers/
trunk/qcell/parsers/parsers.pro
Modified: trunk/qcell/baseheaders/ClientInfo.h
===================================================================
--- trunk/qcell/baseheaders/ClientInfo.h 2006-11-28 16:59:04 UTC (rev 13)
+++ trunk/qcell/baseheaders/ClientInfo.h 2006-11-28 19:29:15 UTC (rev 14)
@@ -51,4 +51,5 @@
};
-#endif
\ No newline at end of file
+#endif
+
Modified: trunk/qcell/basesources/Client.cpp
===================================================================
--- trunk/qcell/basesources/Client.cpp 2006-11-28 16:59:04 UTC (rev 13)
+++ trunk/qcell/basesources/Client.cpp 2006-11-28 19:29:15 UTC (rev 14)
@@ -359,4 +359,5 @@
else
++pingTry;
-}
\ No newline at end of file
+}
+
Added: trunk/qcell/parsers/parsers.pro
===================================================================
--- trunk/qcell/parsers/parsers.pro (rev 0)
+++ trunk/qcell/parsers/parsers.pro 2006-11-28 19:29:15 UTC (rev 14)
@@ -0,0 +1,2 @@
+TEMPLATE = subdirs
+SUBDIRS += N
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <le...@us...> - 2006-11-29 12:02:36
|
Revision: 18
http://svn.sourceforge.net/qcell/?rev=18&view=rev
Author: lessm
Date: 2006-11-29 04:02:27 -0800 (Wed, 29 Nov 2006)
Log Message:
-----------
- Neighbourhood class add
- New methods in Client class and MasterServer class for future use
Modified Paths:
--------------
trunk/qcell/baseheaders/Client.h
trunk/qcell/baseheaders/MasterServer.h
trunk/qcell/basesources/Client.cpp
trunk/qcell/basesources/MasterServer.cpp
trunk/qcell/client/GeneratedFiles/Debug/moc_Client.cpp
trunk/qcell/messages/GeneratedFiles/Debug/moc_MasterServerInterface.cpp
trunk/qcell/messages/GeneratedFiles/Debug/moc_MasterServerPlugin.cpp
trunk/qcell/messages/GeneratedFiles/Debug/moc_messages.cpp
trunk/qcell/requests/GeneratedFiles/Debug/moc_MasterServerInterface.cpp
trunk/qcell/requests/GeneratedFiles/Debug/moc_MasterServerPlugin.cpp
trunk/qcell/requests/GeneratedFiles/Debug/moc_requests.cpp
trunk/qcell/server/GeneratedFiles/Debug/moc_MasterServer.cpp
trunk/qcell/server/GeneratedFiles/Debug/moc_MasterServerInterface.cpp
trunk/qcell/server/GeneratedFiles/Debug/moc_MasterServerPlugin.cpp
trunk/qcell/server/main.cpp
Added Paths:
-----------
trunk/qcell/baseheaders/Neighbourhood.h
trunk/qcell/basesources/Neighbourhood.cpp
Modified: trunk/qcell/baseheaders/Client.h
===================================================================
--- trunk/qcell/baseheaders/Client.h 2006-11-28 20:58:14 UTC (rev 17)
+++ trunk/qcell/baseheaders/Client.h 2006-11-29 12:02:27 UTC (rev 18)
@@ -17,10 +17,6 @@
#include <iostream>
-//#define REGISTER_TIME_WAIT 1000
-//#define MAX_REGISTER_FAIL 10
-//#define MAX_PING_FAIL 5
-
class Client : public QThread
{
Q_OBJECT
@@ -39,6 +35,7 @@
bool reportToServer(void);
void parseServerMessage(QByteArray message);
bool loadClientConfig(QString file);
+ bool parseClientConfig(QDomElement *xmlConfig);
public:
Client();
Modified: trunk/qcell/baseheaders/MasterServer.h
===================================================================
--- trunk/qcell/baseheaders/MasterServer.h 2006-11-28 20:58:14 UTC (rev 17)
+++ trunk/qcell/baseheaders/MasterServer.h 2006-11-29 12:02:27 UTC (rev 18)
@@ -52,6 +52,7 @@
MasterServerPlugin *loadPlugin(QString listFileName);
void killClients();
bool loadServerConfig(QString file);
+ bool parseServerConfig(QDomElement *xmlConfig);
protected slots:
@@ -65,6 +66,7 @@
~MasterServer();
bool initServer(QString file="./ServerConfig.xml");
+ bool initServer(QDomElement *xmlConfig);
bool initServer(short listeningPort);
bool initServer(QHostAddress serverAdress, short listeningPort);
bool registerClient(ClientInfo client);
Added: trunk/qcell/baseheaders/Neighbourhood.h
===================================================================
--- trunk/qcell/baseheaders/Neighbourhood.h (rev 0)
+++ trunk/qcell/baseheaders/Neighbourhood.h 2006-11-29 12:02:27 UTC (rev 18)
@@ -0,0 +1,54 @@
+#ifndef _NEIGHBOURHOOD_H
+#define _NEIGHBOURHOOD_H
+
+#include <QString>
+#include <QVector>
+#include <QDomElement>
+#include <QDomDocument>
+
+struct NContainer
+{
+ int x, y, z, t;
+ double dValue;
+ int iValue;
+ bool bValue;
+};
+
+
+class Neighbourhood
+{
+private:
+ int dimension;
+ QVector<NContainer> neighbourVector;
+
+protected:
+public:
+ Neighbourhood();
+ ~Neighbourhood();
+
+ void addNeighbour(int x);
+ void addNeighbour(int x, int y);
+ void addNeighbour(int x, int y, int z);
+ void addNeighbour(int x, int y, int z, int t);
+
+ void setNeighbourAt(int index, int x);
+ void setNeighbourAt(int index, int x, int y);
+ void setNeighbourAt(int index, int x, int y, int z);
+ void setNeighbourAt(int index, int x, int y, int z, int t);
+
+ void clearNeighbourhood(void);
+ int getDimension(void);
+
+ bool fromXmlString(QString *xmlString);
+ bool fromDomElement(QDomElement *xmlElement);
+ QString toXmlString();
+ int getNeighbourNumber(void);
+ bool getBoolValueOf(int index);
+ int getInValueOf(int index);
+ double getDoubleValueOf(int index);
+
+};
+
+
+
+#endif
\ No newline at end of file
Modified: trunk/qcell/basesources/Client.cpp
===================================================================
--- trunk/qcell/basesources/Client.cpp 2006-11-28 20:58:14 UTC (rev 17)
+++ trunk/qcell/basesources/Client.cpp 2006-11-29 12:02:27 UTC (rev 18)
@@ -86,6 +86,7 @@
{
xmlData.setContent(&configFile);
root = xmlData.documentElement();
+ /*
if(root.tagName()=="ClientConfiguration")
{
xmlNode = root.firstChild();
@@ -123,12 +124,58 @@
xmlNode = xmlNode.nextSibling();
}
}
- return 1;
+ return 1;*/
+ return parseClientConfig(&root);
}
addErrorToLog("Can't load configuration");
return 0;
}
+bool Client::parseClientConfig(QDomElement *xmlConfig)
+{
+ QDomElement xmlElement, extendedAtributes;
+ QDomNode xmlNode, extendedNode;
+ if(xmlConfig->tagName()=="ClientConfiguration")
+ {
+ xmlNode = xmlConfig->firstChild();
+ while(!xmlNode.isNull())
+ {
+ xmlElement = xmlNode.toElement();
+ if(xmlElement.tagName()=="ClientSetings")
+ {
+ setClientAddress(xmlElement.attribute("Address"));
+ setClientPort(xmlElement.attribute("Port").toInt());
+ setClientType(xmlElement.attribute("Type"));
+ extendedNode = xmlElement.firstChild();
+ while(!extendedNode.isNull())
+ {
+ extendedAtributes = extendedNode.toElement();
+ registerWaitTime = extendedAtributes.attribute("RegisterWaitTime").toInt();
+ maxRegisterTry = extendedAtributes.attribute("MaxRegisterTry").toInt();
+ maxPingTry = extendedAtributes.attribute("MaxPingTry").toInt();
+ extendedNode = extendedNode.nextSibling();
+
+ }
+ }
+ else
+ {
+ if(xmlElement.tagName()=="ServerSetings")
+ {
+ setMasterServerAddress(xmlElement.attribute("Address"));
+ setMasterServerPort(xmlElement.attribute("Port").toInt());
+ }
+ else
+ {
+ customClientConfig(&xmlElement);
+ }
+ }
+ xmlNode = xmlNode.nextSibling();
+ }
+ return 1;
+ }
+ return 0;
+}
+
// public
Client::Client()
{
Modified: trunk/qcell/basesources/MasterServer.cpp
===================================================================
--- trunk/qcell/basesources/MasterServer.cpp 2006-11-28 20:58:14 UTC (rev 17)
+++ trunk/qcell/basesources/MasterServer.cpp 2006-11-29 12:02:27 UTC (rev 18)
@@ -90,69 +90,79 @@
{
xmlData.setContent(&configFile);
root = xmlData.documentElement();
- if(root.tagName()=="ServerConfiguration")
+ return parseServerConfig(&root);
+ }
+ serverInterface->addErrorToLog("Can't find configuration file");
+ return 0;
+}
+
+bool MasterServer::parseServerConfig(QDomElement *xmlConfig)
+{
+ QDomElement xmlElement;
+ QDomNode xmlNode;
+ QHostAddress serverAddress;
+
+ if(xmlConfig->tagName()=="ServerConfiguration")
+ {
+ xmlNode = xmlConfig->firstChild();
+ while(!xmlNode.isNull())
{
- xmlNode = root.firstChild();
- while(!xmlNode.isNull())
+ xmlElement = xmlNode.toElement();
+ if(xmlElement.tagName()=="UDPSetings")
{
- xmlElement = xmlNode.toElement();
- if(xmlElement.tagName()=="UDPSetings")
+ if(xmlElement.hasAttribute("Address"))
{
- if(xmlElement.hasAttribute("Address"))
+ serverAddress.setAddress(xmlElement.attribute("Address"));
+ if(!initServer(serverAddress, xmlElement.attribute("Port").toInt()))
{
- serverAddress.setAddress(xmlElement.attribute("Address"));
- if(!initServer(serverAddress, xmlElement.attribute("Port").toInt()))
- {
- serverInterface->addErrorToLog("Can't listen on port" + xmlElement.attribute("Port"));
- return 0;
- }
+ serverInterface->addErrorToLog("Can't listen on port" + xmlElement.attribute("Port"));
+ return 0;
}
- else
- if(!initServer(xmlElement.attribute("Port").toInt()))
- {
- serverInterface->addErrorToLog("Can't listen on port" + xmlElement.attribute("Port"));
- return 0;
- }
- serverInterface->addInfoToLog("Server start listen: " + serverAddress.toString() + ":" + xmlElement.attribute("Port"));
- if(xmlElement.hasAttribute("RepingTime"))
+ }
+ else
+ if(!initServer(xmlElement.attribute("Port").toInt()))
{
- serverPingTime = xmlElement.attribute("RepingTime").toInt();
+ serverInterface->addErrorToLog("Can't listen on port" + xmlElement.attribute("Port"));
+ return 0;
}
+ serverInterface->addInfoToLog("Server start listen: " + serverAddress.toString() + ":" + xmlElement.attribute("Port"));
+ if(xmlElement.hasAttribute("RepingTime"))
+ {
+ serverPingTime = xmlElement.attribute("RepingTime").toInt();
}
- if(xmlElement.tagName()=="TCPSetings")
+ }
+ if(xmlElement.tagName()=="TCPSetings")
+ {
+ if(xmlElement.hasAttribute("Address"))
{
- if(xmlElement.hasAttribute("Address"))
+ serverAddress.setAddress(xmlElement.attribute("Address"));
+ if(!tcpServer->listen(serverAddress, xmlElement.attribute("Port").toInt()))
{
- serverAddress.setAddress(xmlElement.attribute("Address"));
- if(!tcpServer->listen(serverAddress, xmlElement.attribute("Port").toInt()))
- {
- serverInterface->addErrorToLog("Can't establish TCP server");
- return 0;
- }
+ serverInterface->addErrorToLog("Can't establish TCP server");
+ return 0;
}
- else
+ }
+ else
+ {
+ if(!tcpServer->listen(QHostAddress::Any, xmlElement.attribute("Port").toInt()))
{
- if(!tcpServer->listen(QHostAddress::Any, xmlElement.attribute("Port").toInt()))
- {
- serverInterface->addErrorToLog("Can't establish TCP server");
- return 0;
- }
+ serverInterface->addErrorToLog("Can't establish TCP server");
+ return 0;
}
- connect(tcpServer, SIGNAL(newConnection()), SLOT(TcpConnection()));
- serverInterface->addInfoToLog("Tcp server established: " + tcpServer->serverAddress().toString() + ":" + xmlElement.attribute("Port"));
-
}
- if(xmlElement.tagName()=="PluginList")
- {
- initPlugins(xmlElement);
- }
+ connect(tcpServer, SIGNAL(newConnection()), SLOT(TcpConnection()));
+ serverInterface->addInfoToLog("Tcp server established: " + tcpServer->serverAddress().toString() + ":" + xmlElement.attribute("Port"));
+
+ }
+ if(xmlElement.tagName()=="PluginList")
+ {
+ initPlugins(xmlElement);
+ }
- xmlNode = xmlNode.nextSibling();
- }
+ xmlNode = xmlNode.nextSibling();
}
return 1;
}
- serverInterface->addErrorToLog("Can't find configuration file");
return 0;
}
@@ -297,12 +307,26 @@
bool MasterServer::initServer(QString file)
{
- bool out = loadServerConfig(file);
- pingTimer.setInterval(serverPingTime);
- pingTimer.start();
- return out;
+ if(loadServerConfig(file))
+ {
+ pingTimer.setInterval(serverPingTime);
+ pingTimer.start();
+ return 1;
+ }
+ return 0;
}
+bool MasterServer::initServer(QDomElement *xmlConfig)
+{
+ if(parseServerConfig(xmlConfig))
+ {
+ pingTimer.setInterval(serverPingTime);
+ pingTimer.start();
+ return 1;
+ }
+ return 0;
+}
+
bool MasterServer::initServer(short listeningPort)
{
if(serverRecive->bind(listeningPort))
Added: trunk/qcell/basesources/Neighbourhood.cpp
===================================================================
--- trunk/qcell/basesources/Neighbourhood.cpp (rev 0)
+++ trunk/qcell/basesources/Neighbourhood.cpp 2006-11-29 12:02:27 UTC (rev 18)
@@ -0,0 +1,228 @@
+#include "../baseheaders/Neighbourhood.h"
+
+Neighbourhood::Neighbourhood()
+{
+ dimension = 666;
+}
+
+Neighbourhood::~Neighbourhood()
+{
+
+}
+
+void Neighbourhood::addNeighbour(int x)
+{
+ NContainer temp;
+ temp.x = x;
+ neighbourVector << temp;
+ dimension = 1;
+}
+
+void Neighbourhood::addNeighbour(int x, int y)
+{
+ NContainer temp;
+ temp.x = x;
+ temp.y = y;
+ neighbourVector << temp;
+ if(dimension>2)
+ dimension = 2;
+}
+void Neighbourhood::addNeighbour(int x, int y, int z)
+{
+ NContainer temp;
+ temp.x = x;
+ temp.y = y;
+ temp.z = z;
+ neighbourVector << temp;
+ if(dimension>3)
+ dimension = 3;
+}
+
+void Neighbourhood::addNeighbour(int x, int y, int z, int t)
+{
+ NContainer temp;
+ temp.x = x;
+ temp.y = y;
+ temp.z = z;
+ temp.t = t;
+ neighbourVector << temp;
+ if(dimension>4)
+ dimension = 4;
+}
+
+void Neighbourhood::setNeighbourAt(int index, int x)
+{
+ if(neighbourVector.size()>index)
+ neighbourVector[index].x = x;
+}
+
+void Neighbourhood::setNeighbourAt(int index, int x, int y)
+{
+ if(neighbourVector.size()>index)
+ {
+ neighbourVector[index].x = x;
+ neighbourVector[index].y = y;
+ }
+}
+
+void Neighbourhood::setNeighbourAt(int index, int x, int y, int z)
+{
+ if(neighbourVector.size()>index)
+ {
+ neighbourVector[index].x = x;
+ neighbourVector[index].y = y;
+ neighbourVector[index].z = z;
+ }
+}
+
+void Neighbourhood::setNeighbourAt(int index, int x, int y, int z, int t)
+{
+ if(neighbourVector.size()>index)
+ {
+ neighbourVector[index].x = x;
+ neighbourVector[index].y = y;
+ neighbourVector[index].z = z;
+ neighbourVector[index].t = t;
+ }
+}
+
+void Neighbourhood::clearNeighbourhood(void)
+{
+ dimension = 666;
+ neighbourVector.clear();
+}
+
+int Neighbourhood::getDimension(void)
+{
+ return dimension;
+}
+
+bool Neighbourhood::fromXmlString(QString *xmlString)
+{
+ QDomDocument doc;
+ QDomElement root;
+ doc.setContent(*xmlString);
+ root = doc.documentElement();
+ return fromDomElement(&root);
+}
+
+bool Neighbourhood::fromDomElement(QDomElement *xmlElement)
+{
+ QDomNode node;
+ QDomElement element;
+ NContainer container;
+ if(xmlElement->tagName()=="Neighbourhood")
+ {
+ node = xmlElement->firstChild();
+ if(!node.isNull())
+ {
+ clearNeighbourhood();
+ while(!node.isNull())
+ {
+ element = node.toElement();
+ if(element.tagName()=="Neighbour")
+ {
+ if(element.hasAttribute("t"))
+ {
+ container.x = element.attribute("x").toInt();
+ container.y = element.attribute("y").toInt();
+ container.z = element.attribute("z").toInt();
+ container.t = element.attribute("t").toInt();
+ if(dimension>4)
+ dimension = 4;
+ }
+ else
+ {
+ if(element.hasAttribute("z"))
+ {
+ container.x = element.attribute("x").toInt();
+ container.y = element.attribute("y").toInt();
+ container.z = element.attribute("z").toInt();
+ if(dimension>3)
+ dimension = 3;
+ }
+ else
+ {
+ if(element.hasAttribute("y"))
+ {
+ container.x = element.attribute("x").toInt();
+ container.y = element.attribute("y").toInt();
+ if(dimension>2)
+ dimension = 2;
+
+ }
+ else
+ {
+ if(element.hasAttribute("x"))
+ {
+ container.x = element.attribute("x").toInt();
+ dimension = 1;
+ }
+ }
+ }
+ }
+ neighbourVector<<container;
+ }
+ node = node.nextSibling();
+ }
+ return 1;
+ }
+ }
+ return 0;
+}
+
+QString Neighbourhood::toXmlString()
+{
+ QDomDocument doc;
+ QDomElement root, element;
+ NContainer temp;
+ root = doc.createElement("Neighbourhood");
+ doc.appendChild(root);
+ foreach(temp, neighbourVector)
+ {
+ element = doc.createElement("Neighbour");
+ switch(dimension)
+ {
+ case 1:
+ element.setAttribute("x", temp.x);
+ break;
+ case 2:
+ element.setAttribute("x", temp.x);
+ element.setAttribute("y", temp.y);
+ break;
+ case 3:
+ element.setAttribute("x", temp.x);
+ element.setAttribute("y", temp.y);
+ element.setAttribute("z", temp.z);
+ break;
+ case 4:
+ element.setAttribute("x", temp.x);
+ element.setAttribute("y", temp.y);
+ element.setAttribute("z", temp.z);
+ element.setAttribute("t", temp.t);
+ break;
+ }
+ root.appendChild(element);
+ }
+ return doc.toString();
+}
+
+int Neighbourhood::getNeighbourNumber(void)
+{
+ return neighbourVector.size();
+}
+
+bool Neighbourhood::getBoolValueOf(int index)
+{
+ return neighbourVector[index].bValue;
+}
+
+int Neighbourhood::getInValueOf(int index)
+{
+ return neighbourVector[index].iValue;
+}
+
+double Neighbourhood::getDoubleValueOf(int index)
+{
+ return neighbourVector[index].dValue;
+}
\ No newline at end of file
Modified: trunk/qcell/client/GeneratedFiles/Debug/moc_Client.cpp
===================================================================
--- trunk/qcell/client/GeneratedFiles/Debug/moc_Client.cpp 2006-11-28 20:58:14 UTC (rev 17)
+++ trunk/qcell/client/GeneratedFiles/Debug/moc_Client.cpp 2006-11-29 12:02:27 UTC (rev 18)
@@ -1,13 +1,13 @@
/****************************************************************************
** Meta object code from reading C++ file 'Client.h'
**
-** Created: Thu 26. Oct 20:23:39 2006
+** Created: Sun 29. Oct 11:57:31 2006
** by: The Qt Meta Object Compiler version 59 (Qt 4.2.1)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
-#include "../../../headers/Client.h"
+#include "../../../baseheaders/Client.h"
#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file 'Client.h' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 59
Modified: trunk/qcell/messages/GeneratedFiles/Debug/moc_MasterServerInterface.cpp
===================================================================
--- trunk/qcell/messages/GeneratedFiles/Debug/moc_MasterServerInterface.cpp 2006-11-28 20:58:14 UTC (rev 17)
+++ trunk/qcell/messages/GeneratedFiles/Debug/moc_MasterServerInterface.cpp 2006-11-29 12:02:27 UTC (rev 18)
@@ -1,13 +1,13 @@
/****************************************************************************
** Meta object code from reading C++ file 'MasterServerInterface.h'
**
-** Created: Thu 26. Oct 20:23:42 2006
+** Created: Sun 29. Oct 11:57:33 2006
** by: The Qt Meta Object Compiler version 59 (Qt 4.2.1)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
-#include "../../../headers/MasterServerInterface.h"
+#include "../../../baseheaders/MasterServerInterface.h"
#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file 'MasterServerInterface.h' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 59
Modified: trunk/qcell/messages/GeneratedFiles/Debug/moc_MasterServerPlugin.cpp
===================================================================
--- trunk/qcell/messages/GeneratedFiles/Debug/moc_MasterServerPlugin.cpp 2006-11-28 20:58:14 UTC (rev 17)
+++ trunk/qcell/messages/GeneratedFiles/Debug/moc_MasterServerPlugin.cpp 2006-11-29 12:02:27 UTC (rev 18)
@@ -1,13 +1,13 @@
/****************************************************************************
** Meta object code from reading C++ file 'MasterServerPlugin.h'
**
-** Created: Thu 26. Oct 20:23:42 2006
+** Created: Sun 29. Oct 11:57:33 2006
** by: The Qt Meta Object Compiler version 59 (Qt 4.2.1)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
-#include "../../../headers/MasterServerPlugin.h"
+#include "../../../baseheaders/MasterServerPlugin.h"
#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file 'MasterServerPlugin.h' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 59
Modified: trunk/qcell/messages/GeneratedFiles/Debug/moc_messages.cpp
===================================================================
--- trunk/qcell/messages/GeneratedFiles/Debug/moc_messages.cpp 2006-11-28 20:58:14 UTC (rev 17)
+++ trunk/qcell/messages/GeneratedFiles/Debug/moc_messages.cpp 2006-11-29 12:02:27 UTC (rev 18)
@@ -1,7 +1,7 @@
/****************************************************************************
** Meta object code from reading C++ file 'messages.h'
**
-** Created: Thu 26. Oct 20:23:41 2006
+** Created: Sun 29. Oct 11:57:33 2006
** by: The Qt Meta Object Compiler version 59 (Qt 4.2.1)
**
** WARNING! All changes made in this file will be lost!
Modified: trunk/qcell/requests/GeneratedFiles/Debug/moc_MasterServerInterface.cpp
===================================================================
--- trunk/qcell/requests/GeneratedFiles/Debug/moc_MasterServerInterface.cpp 2006-11-28 20:58:14 UTC (rev 17)
+++ trunk/qcell/requests/GeneratedFiles/Debug/moc_MasterServerInterface.cpp 2006-11-29 12:02:27 UTC (rev 18)
@@ -1,13 +1,13 @@
/****************************************************************************
** Meta object code from reading C++ file 'MasterServerInterface.h'
**
-** Created: Thu 26. Oct 20:23:50 2006
+** Created: Sun 29. Oct 11:57:29 2006
** by: The Qt Meta Object Compiler version 59 (Qt 4.2.1)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
-#include "../../../headers/MasterServerInterface.h"
+#include "../../../baseheaders/MasterServerInterface.h"
#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file 'MasterServerInterface.h' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 59
Modified: trunk/qcell/requests/GeneratedFiles/Debug/moc_MasterServerPlugin.cpp
===================================================================
--- trunk/qcell/requests/GeneratedFiles/Debug/moc_MasterServerPlugin.cpp 2006-11-28 20:58:14 UTC (rev 17)
+++ trunk/qcell/requests/GeneratedFiles/Debug/moc_MasterServerPlugin.cpp 2006-11-29 12:02:27 UTC (rev 18)
@@ -1,13 +1,13 @@
/****************************************************************************
** Meta object code from reading C++ file 'MasterServerPlugin.h'
**
-** Created: Thu 26. Oct 20:23:50 2006
+** Created: Sun 29. Oct 11:57:29 2006
** by: The Qt Meta Object Compiler version 59 (Qt 4.2.1)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
-#include "../../../headers/MasterServerPlugin.h"
+#include "../../../baseheaders/MasterServerPlugin.h"
#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file 'MasterServerPlugin.h' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 59
Modified: trunk/qcell/requests/GeneratedFiles/Debug/moc_requests.cpp
===================================================================
--- trunk/qcell/requests/GeneratedFiles/Debug/moc_requests.cpp 2006-11-28 20:58:14 UTC (rev 17)
+++ trunk/qcell/requests/GeneratedFiles/Debug/moc_requests.cpp 2006-11-29 12:02:27 UTC (rev 18)
@@ -1,7 +1,7 @@
/****************************************************************************
** Meta object code from reading C++ file 'requests.h'
**
-** Created: Thu 26. Oct 20:23:49 2006
+** Created: Sun 29. Oct 11:57:28 2006
** by: The Qt Meta Object Compiler version 59 (Qt 4.2.1)
**
** WARNING! All changes made in this file will be lost!
Modified: trunk/qcell/server/GeneratedFiles/Debug/moc_MasterServer.cpp
===================================================================
--- trunk/qcell/server/GeneratedFiles/Debug/moc_MasterServer.cpp 2006-11-28 20:58:14 UTC (rev 17)
+++ trunk/qcell/server/GeneratedFiles/Debug/moc_MasterServer.cpp 2006-11-29 12:02:27 UTC (rev 18)
@@ -1,13 +1,13 @@
/****************************************************************************
** Meta object code from reading C++ file 'MasterServer.h'
**
-** Created: Thu 26. Oct 20:23:45 2006
+** Created: Sun 29. Oct 11:57:35 2006
** by: The Qt Meta Object Compiler version 59 (Qt 4.2.1)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
-#include "../../../headers/MasterServer.h"
+#include "../../../baseheaders/MasterServer.h"
#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file 'MasterServer.h' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 59
Modified: trunk/qcell/server/GeneratedFiles/Debug/moc_MasterServerInterface.cpp
===================================================================
--- trunk/qcell/server/GeneratedFiles/Debug/moc_MasterServerInterface.cpp 2006-11-28 20:58:14 UTC (rev 17)
+++ trunk/qcell/server/GeneratedFiles/Debug/moc_MasterServerInterface.cpp 2006-11-29 12:02:27 UTC (rev 18)
@@ -1,13 +1,13 @@
/****************************************************************************
** Meta object code from reading C++ file 'MasterServerInterface.h'
**
-** Created: Thu 26. Oct 20:23:45 2006
+** Created: Sun 29. Oct 11:57:35 2006
** by: The Qt Meta Object Compiler version 59 (Qt 4.2.1)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
-#include "../../../headers/MasterServerInterface.h"
+#include "../../../baseheaders/MasterServerInterface.h"
#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file 'MasterServerInterface.h' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 59
Modified: trunk/qcell/server/GeneratedFiles/Debug/moc_MasterServerPlugin.cpp
===================================================================
--- trunk/qcell/server/GeneratedFiles/Debug/moc_MasterServerPlugin.cpp 2006-11-28 20:58:14 UTC (rev 17)
+++ trunk/qcell/server/GeneratedFiles/Debug/moc_MasterServerPlugin.cpp 2006-11-29 12:02:27 UTC (rev 18)
@@ -1,13 +1,13 @@
/****************************************************************************
** Meta object code from reading C++ file 'MasterServerPlugin.h'
**
-** Created: Thu 26. Oct 20:23:45 2006
+** Created: Sun 29. Oct 11:57:35 2006
** by: The Qt Meta Object Compiler version 59 (Qt 4.2.1)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
-#include "../../../headers/MasterServerPlugin.h"
+#include "../../../baseheaders/MasterServerPlugin.h"
#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file 'MasterServerPlugin.h' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 59
Modified: trunk/qcell/server/main.cpp
===================================================================
--- trunk/qcell/server/main.cpp 2006-11-28 20:58:14 UTC (rev 17)
+++ trunk/qcell/server/main.cpp 2006-11-29 12:02:27 UTC (rev 18)
@@ -1,10 +1,8 @@
-//#include <QtCore/QCoreApplication>
#include <QApplication>
#include "../baseheaders/MasterServer.h"
int main(int argc, char *argv[])
{
- //QCoreApplication a(argc, argv);
QApplication a(argc, argv);
MasterServer m;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dhu...@us...> - 2006-11-29 12:44:09
|
Revision: 19
http://svn.sourceforge.net/qcell/?rev=19&view=rev
Author: dhubleizh
Date: 2006-11-29 04:44:00 -0800 (Wed, 29 Nov 2006)
Log Message:
-----------
- no more output files!
- no more moc files!
Removed Paths:
-------------
trunk/qcell/client/GeneratedFiles/Debug/moc_Client.cpp
trunk/qcell/client/GeneratedFiles/Release/moc_Client.cpp
trunk/qcell/messages/GeneratedFiles/Debug/moc_MasterServer.cpp
trunk/qcell/messages/GeneratedFiles/Debug/moc_MasterServerInterface.cpp
trunk/qcell/messages/GeneratedFiles/Debug/moc_MasterServerPlugin.cpp
trunk/qcell/messages/GeneratedFiles/Debug/moc_messages.cpp
trunk/qcell/messages/GeneratedFiles/Release/moc_MasterServer.cpp
trunk/qcell/messages/GeneratedFiles/Release/moc_MasterServerInterface.cpp
trunk/qcell/messages/GeneratedFiles/Release/moc_MasterServerPlugin.cpp
trunk/qcell/messages/GeneratedFiles/Release/moc_messages.cpp
trunk/qcell/requests/GeneratedFiles/Debug/moc_MasterServerInterface.cpp
trunk/qcell/requests/GeneratedFiles/Debug/moc_MasterServerPlugin.cpp
trunk/qcell/requests/GeneratedFiles/Debug/moc_requests.cpp
trunk/qcell/requests/GeneratedFiles/Release/moc_MasterServerInterface.cpp
trunk/qcell/requests/GeneratedFiles/Release/moc_MasterServerPlugin.cpp
trunk/qcell/requests/GeneratedFiles/Release/moc_requests.cpp
trunk/qcell/server/GeneratedFiles/Debug/moc_MasterServer.cpp
trunk/qcell/server/GeneratedFiles/Debug/moc_MasterServerInterface.cpp
trunk/qcell/server/GeneratedFiles/Debug/moc_MasterServerPlugin.cpp
trunk/qcell/server/GeneratedFiles/Release/moc_MasterServer.cpp
trunk/qcell/server/GeneratedFiles/Release/moc_MasterServerInterface.cpp
trunk/qcell/server/GeneratedFiles/Release/moc_MasterServerPlugin.cpp
Deleted: trunk/qcell/client/GeneratedFiles/Debug/moc_Client.cpp
===================================================================
--- trunk/qcell/client/GeneratedFiles/Debug/moc_Client.cpp 2006-11-29 12:02:27 UTC (rev 18)
+++ trunk/qcell/client/GeneratedFiles/Debug/moc_Client.cpp 2006-11-29 12:44:00 UTC (rev 19)
@@ -1,117 +0,0 @@
-/****************************************************************************
-** Meta object code from reading C++ file 'Client.h'
-**
-** Created: Sun 29. Oct 11:57:31 2006
-** by: The Qt Meta Object Compiler version 59 (Qt 4.2.1)
-**
-** WARNING! All changes made in this file will be lost!
-*****************************************************************************/
-
-#include "../../../baseheaders/Client.h"
-#if !defined(Q_MOC_OUTPUT_REVISION)
-#error "The header file 'Client.h' doesn't include <QObject>."
-#elif Q_MOC_OUTPUT_REVISION != 59
-#error "This file was generated using the moc from 4.2.1. It"
-#error "cannot be used with the include files from this version of Qt."
-#error "(The moc has changed too much.)"
-#endif
-
-static const uint qt_meta_data_Client[] = {
-
- // content:
- 1, // revision
- 0, // classname
- 0, 0, // classinfo
- 8, 10, // methods
- 0, 0, // properties
- 0, 0, // enums/sets
-
- // signals: signature, parameters, type, tag, flags
- 8, 7, 7, 7, 0x05,
- 15, 7, 7, 7, 0x05,
- 34, 7, 7, 7, 0x05,
- 52, 7, 7, 7, 0x05,
- 74, 7, 7, 7, 0x05,
-
- // slots: signature, parameters, type, tag, flags
- 93, 7, 7, 7, 0x09,
- 111, 7, 7, 7, 0x09,
- 130, 7, 7, 7, 0x09,
-
- 0 // eod
-};
-
-static const char qt_meta_stringdata_Client[] = {
- "Client\0\0kill()\0serverRegistered()\0serverNoRespond()\0"
- "serverRegisterFaild()\0serverUpdateInfo()\0processMessages()\0"
- "registerTimePass()\0pingTimePass()\0"
-};
-
-const QMetaObject Client::staticMetaObject = {
- { &QThread::staticMetaObject, qt_meta_stringdata_Client,
- qt_meta_data_Client, 0 }
-};
-
-const QMetaObject *Client::metaObject() const
-{
- return &staticMetaObject;
-}
-
-void *Client::qt_metacast(const char *_clname)
-{
- if (!_clname) return 0;
- if (!strcmp(_clname, qt_meta_stringdata_Client))
- return static_cast<void*>(const_cast<Client*>(this));
- return QThread::qt_metacast(_clname);
-}
-
-int Client::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
-{
- _id = QThread::qt_metacall(_c, _id, _a);
- if (_id < 0)
- return _id;
- if (_c == QMetaObject::InvokeMetaMethod) {
- switch (_id) {
- case 0: kill(); break;
- case 1: serverRegistered(); break;
- case 2: serverNoRespond(); break;
- case 3: serverRegisterFaild(); break;
- case 4: serverUpdateInfo(); break;
- case 5: processMessages(); break;
- case 6: registerTimePass(); break;
- case 7: pingTimePass(); break;
- }
- _id -= 8;
- }
- return _id;
-}
-
-// SIGNAL 0
-void Client::kill()
-{
- QMetaObject::activate(this, &staticMetaObject, 0, 0);
-}
-
-// SIGNAL 1
-void Client::serverRegistered()
-{
- QMetaObject::activate(this, &staticMetaObject, 1, 0);
-}
-
-// SIGNAL 2
-void Client::serverNoRespond()
-{
- QMetaObject::activate(this, &staticMetaObject, 2, 0);
-}
-
-// SIGNAL 3
-void Client::serverRegisterFaild()
-{
- QMetaObject::activate(this, &staticMetaObject, 3, 0);
-}
-
-// SIGNAL 4
-void Client::serverUpdateInfo()
-{
- QMetaObject::activate(this, &staticMetaObject, 4, 0);
-}
Deleted: trunk/qcell/client/GeneratedFiles/Release/moc_Client.cpp
===================================================================
--- trunk/qcell/client/GeneratedFiles/Release/moc_Client.cpp 2006-11-29 12:02:27 UTC (rev 18)
+++ trunk/qcell/client/GeneratedFiles/Release/moc_Client.cpp 2006-11-29 12:44:00 UTC (rev 19)
@@ -1,117 +0,0 @@
-/****************************************************************************
-** Meta object code from reading C++ file 'Client.h'
-**
-** Created: Thu 26. Oct 20:07:23 2006
-** by: The Qt Meta Object Compiler version 59 (Qt 4.2.1)
-**
-** WARNING! All changes made in this file will be lost!
-*****************************************************************************/
-
-#include "../../../headers/Client.h"
-#if !defined(Q_MOC_OUTPUT_REVISION)
-#error "The header file 'Client.h' doesn't include <QObject>."
-#elif Q_MOC_OUTPUT_REVISION != 59
-#error "This file was generated using the moc from 4.2.1. It"
-#error "cannot be used with the include files from this version of Qt."
-#error "(The moc has changed too much.)"
-#endif
-
-static const uint qt_meta_data_Client[] = {
-
- // content:
- 1, // revision
- 0, // classname
- 0, 0, // classinfo
- 8, 10, // methods
- 0, 0, // properties
- 0, 0, // enums/sets
-
- // signals: signature, parameters, type, tag, flags
- 8, 7, 7, 7, 0x05,
- 15, 7, 7, 7, 0x05,
- 34, 7, 7, 7, 0x05,
- 52, 7, 7, 7, 0x05,
- 74, 7, 7, 7, 0x05,
-
- // slots: signature, parameters, type, tag, flags
- 93, 7, 7, 7, 0x09,
- 111, 7, 7, 7, 0x09,
- 130, 7, 7, 7, 0x09,
-
- 0 // eod
-};
-
-static const char qt_meta_stringdata_Client[] = {
- "Client\0\0kill()\0serverRegistered()\0serverNoRespond()\0"
- "serverRegisterFaild()\0serverUpdateInfo()\0processMessages()\0"
- "registerTimePass()\0pingTimePass()\0"
-};
-
-const QMetaObject Client::staticMetaObject = {
- { &QThread::staticMetaObject, qt_meta_stringdata_Client,
- qt_meta_data_Client, 0 }
-};
-
-const QMetaObject *Client::metaObject() const
-{
- return &staticMetaObject;
-}
-
-void *Client::qt_metacast(const char *_clname)
-{
- if (!_clname) return 0;
- if (!strcmp(_clname, qt_meta_stringdata_Client))
- return static_cast<void*>(const_cast<Client*>(this));
- return QThread::qt_metacast(_clname);
-}
-
-int Client::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
-{
- _id = QThread::qt_metacall(_c, _id, _a);
- if (_id < 0)
- return _id;
- if (_c == QMetaObject::InvokeMetaMethod) {
- switch (_id) {
- case 0: kill(); break;
- case 1: serverRegistered(); break;
- case 2: serverNoRespond(); break;
- case 3: serverRegisterFaild(); break;
- case 4: serverUpdateInfo(); break;
- case 5: processMessages(); break;
- case 6: registerTimePass(); break;
- case 7: pingTimePass(); break;
- }
- _id -= 8;
- }
- return _id;
-}
-
-// SIGNAL 0
-void Client::kill()
-{
- QMetaObject::activate(this, &staticMetaObject, 0, 0);
-}
-
-// SIGNAL 1
-void Client::serverRegistered()
-{
- QMetaObject::activate(this, &staticMetaObject, 1, 0);
-}
-
-// SIGNAL 2
-void Client::serverNoRespond()
-{
- QMetaObject::activate(this, &staticMetaObject, 2, 0);
-}
-
-// SIGNAL 3
-void Client::serverRegisterFaild()
-{
- QMetaObject::activate(this, &staticMetaObject, 3, 0);
-}
-
-// SIGNAL 4
-void Client::serverUpdateInfo()
-{
- QMetaObject::activate(this, &staticMetaObject, 4, 0);
-}
Deleted: trunk/qcell/messages/GeneratedFiles/Debug/moc_MasterServer.cpp
===================================================================
--- trunk/qcell/messages/GeneratedFiles/Debug/moc_MasterServer.cpp 2006-11-29 12:02:27 UTC (rev 18)
+++ trunk/qcell/messages/GeneratedFiles/Debug/moc_MasterServer.cpp 2006-11-29 12:44:00 UTC (rev 19)
@@ -1,139 +0,0 @@
-/****************************************************************************
-** Meta object code from reading C++ file 'MasterServer.h'
-**
-** Created: Tue 24. Oct 13:56:51 2006
-** by: The Qt Meta Object Compiler version 59 (Qt 4.2.1)
-**
-** WARNING! All changes made in this file will be lost!
-*****************************************************************************/
-
-#include "../../../headers/MasterServer.h"
-#if !defined(Q_MOC_OUTPUT_REVISION)
-#error "The header file 'MasterServer.h' doesn't include <QObject>."
-#elif Q_MOC_OUTPUT_REVISION != 59
-#error "This file was generated using the moc from 4.2.1. It"
-#error "cannot be used with the include files from this version of Qt."
-#error "(The moc has changed too much.)"
-#endif
-
-static const uint qt_meta_data_MasterServer[] = {
-
- // content:
- 1, // revision
- 0, // classname
- 0, 0, // classinfo
- 6, 10, // methods
- 0, 0, // properties
- 0, 0, // enums/sets
-
- // signals: signature, parameters, type, tag, flags
- 19, 14, 13, 13, 0x05,
- 48, 14, 13, 13, 0x05,
-
- // slots: signature, parameters, type, tag, flags
- 74, 13, 13, 13, 0x09,
- 101, 92, 13, 13, 0x09,
- 127, 13, 13, 13, 0x09,
- 141, 13, 13, 13, 0x0a,
-
- 0 // eod
-};
-
-static const char qt_meta_stringdata_MasterServer[] = {
- "MasterServer\0\0info\0clientRegistered(ClientInfo)\0"
- "clientRemoved(ClientInfo)\0datagramRecived()\0datagram\0"
- "parseDatagram(QByteArray)\0pingClients()\0serverKill()\0"
-};
-
-const QMetaObject MasterServer::staticMetaObject = {
- { &QThread::staticMetaObject, qt_meta_stringdata_MasterServer,
- qt_meta_data_MasterServer, 0 }
-};
-
-const QMetaObject *MasterServer::metaObject() const
-{
- return &staticMetaObject;
-}
-
-void *MasterServer::qt_metacast(const char *_clname)
-{
- if (!_clname) return 0;
- if (!strcmp(_clname, qt_meta_stringdata_MasterServer))
- return static_cast<void*>(const_cast<MasterServer*>(this));
- return QThread::qt_metacast(_clname);
-}
-
-int MasterServer::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
-{
- _id = QThread::qt_metacall(_c, _id, _a);
- if (_id < 0)
- return _id;
- if (_c == QMetaObject::InvokeMetaMethod) {
- switch (_id) {
- case 0: clientRegistered((*reinterpret_cast< ClientInfo(*)>(_a[1]))); break;
- case 1: clientRemoved((*reinterpret_cast< ClientInfo(*)>(_a[1]))); break;
- case 2: datagramRecived(); break;
- case 3: parseDatagram((*reinterpret_cast< QByteArray(*)>(_a[1]))); break;
- case 4: pingClients(); break;
- case 5: serverKill(); break;
- }
- _id -= 6;
- }
- return _id;
-}
-
-// SIGNAL 0
-void MasterServer::clientRegistered(ClientInfo _t1)
-{
- void *_a[] = { 0, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) };
- QMetaObject::activate(this, &staticMetaObject, 0, _a);
-}
-
-// SIGNAL 1
-void MasterServer::clientRemoved(ClientInfo _t1)
-{
- void *_a[] = { 0, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) };
- QMetaObject::activate(this, &staticMetaObject, 1, _a);
-}
-static const uint qt_meta_data_ServerInterface[] = {
-
- // content:
- 1, // revision
- 0, // classname
- 0, 0, // classinfo
- 0, 0, // methods
- 0, 0, // properties
- 0, 0, // enums/sets
-
- 0 // eod
-};
-
-static const char qt_meta_stringdata_ServerInterface[] = {
- "ServerInterface\0"
-};
-
-const QMetaObject ServerInterface::staticMetaObject = {
- { &MasterServerInterface::staticMetaObject, qt_meta_stringdata_ServerInterface,
- qt_meta_data_ServerInterface, 0 }
-};
-
-const QMetaObject *ServerInterface::metaObject() const
-{
- return &staticMetaObject;
-}
-
-void *ServerInterface::qt_metacast(const char *_clname)
-{
- if (!_clname) return 0;
- if (!strcmp(_clname, qt_meta_stringdata_ServerInterface))
- return static_cast<void*>(const_cast<ServerInterface*>(this));
- return MasterServerInterface::qt_metacast(_clname);
-}
-
-int ServerInterface::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
-{
- _id = MasterServerInterface::qt_metacall(_c, _id, _a);
- if (_id < 0)
- return _id;
- return _id;
-}
Deleted: trunk/qcell/messages/GeneratedFiles/Debug/moc_MasterServerInterface.cpp
===================================================================
--- trunk/qcell/messages/GeneratedFiles/Debug/moc_MasterServerInterface.cpp 2006-11-29 12:02:27 UTC (rev 18)
+++ trunk/qcell/messages/GeneratedFiles/Debug/moc_MasterServerInterface.cpp 2006-11-29 12:44:00 UTC (rev 19)
@@ -1,76 +0,0 @@
-/****************************************************************************
-** Meta object code from reading C++ file 'MasterServerInterface.h'
-**
-** Created: Sun 29. Oct 11:57:33 2006
-** by: The Qt Meta Object Compiler version 59 (Qt 4.2.1)
-**
-** WARNING! All changes made in this file will be lost!
-*****************************************************************************/
-
-#include "../../../baseheaders/MasterServerInterface.h"
-#if !defined(Q_MOC_OUTPUT_REVISION)
-#error "The header file 'MasterServerInterface.h' doesn't include <QObject>."
-#elif Q_MOC_OUTPUT_REVISION != 59
-#error "This file was generated using the moc from 4.2.1. It"
-#error "cannot be used with the include files from this version of Qt."
-#error "(The moc has changed too much.)"
-#endif
-
-static const uint qt_meta_data_MasterServerInterface[] = {
-
- // content:
- 1, // revision
- 0, // classname
- 0, 0, // classinfo
- 1, 10, // methods
- 0, 0, // properties
- 0, 0, // enums/sets
-
- // signals: signature, parameters, type, tag, flags
- 35, 23, 22, 22, 0x05,
-
- 0 // eod
-};
-
-static const char qt_meta_stringdata_MasterServerInterface[] = {
- "MasterServerInterface\0\0type,client\0clientListChange(int,ClientInfo)\0"
-};
-
-const QMetaObject MasterServerInterface::staticMetaObject = {
- { &QObject::staticMetaObject, qt_meta_stringdata_MasterServerInterface,
- qt_meta_data_MasterServerInterface, 0 }
-};
-
-const QMetaObject *MasterServerInterface::metaObject() const
-{
- return &staticMetaObject;
-}
-
-void *MasterServerInterface::qt_metacast(const char *_clname)
-{
- if (!_clname) return 0;
- if (!strcmp(_clname, qt_meta_stringdata_MasterServerInterface))
- return static_cast<void*>(const_cast<MasterServerInterface*>(this));
- return QObject::qt_metacast(_clname);
-}
-
-int MasterServerInterface::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
-{
- _id = QObject::qt_metacall(_c, _id, _a);
- if (_id < 0)
- return _id;
- if (_c == QMetaObject::InvokeMetaMethod) {
- switch (_id) {
- case 0: clientListChange((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< ClientInfo(*)>(_a[2]))); break;
- }
- _id -= 1;
- }
- return _id;
-}
-
-// SIGNAL 0
-void MasterServerInterface::clientListChange(int _t1, ClientInfo _t2)
-{
- void *_a[] = { 0, const_cast<void*>(reinterpret_cast<const void*>(&_t1)), const_cast<void*>(reinterpret_cast<const void*>(&_t2)) };
- QMetaObject::activate(this, &staticMetaObject, 0, _a);
-}
Deleted: trunk/qcell/messages/GeneratedFiles/Debug/moc_MasterServerPlugin.cpp
===================================================================
--- trunk/qcell/messages/GeneratedFiles/Debug/moc_MasterServerPlugin.cpp 2006-11-29 12:02:27 UTC (rev 18)
+++ trunk/qcell/messages/GeneratedFiles/Debug/moc_MasterServerPlugin.cpp 2006-11-29 12:44:00 UTC (rev 19)
@@ -1,60 +0,0 @@
-/****************************************************************************
-** Meta object code from reading C++ file 'MasterServerPlugin.h'
-**
-** Created: Sun 29. Oct 11:57:33 2006
-** by: The Qt Meta Object Compiler version 59 (Qt 4.2.1)
-**
-** WARNING! All changes made in this file will be lost!
-*****************************************************************************/
-
-#include "../../../baseheaders/MasterServerPlugin.h"
-#if !defined(Q_MOC_OUTPUT_REVISION)
-#error "The header file 'MasterServerPlugin.h' doesn't include <QObject>."
-#elif Q_MOC_OUTPUT_REVISION != 59
-#error "This file was generated using the moc from 4.2.1. It"
-#error "cannot be used with the include files from this version of Qt."
-#error "(The moc has changed too much.)"
-#endif
-
-static const uint qt_meta_data_MasterServerPlugin[] = {
-
- // content:
- 1, // revision
- 0, // classname
- 0, 0, // classinfo
- 0, 0, // methods
- 0, 0, // properties
- 0, 0, // enums/sets
-
- 0 // eod
-};
-
-static const char qt_meta_stringdata_MasterServerPlugin[] = {
- "MasterServerPlugin\0"
-};
-
-const QMetaObject MasterServerPlugin::staticMetaObject = {
- { &QObject::staticMetaObject, qt_meta_stringdata_MasterServerPlugin,
- qt_meta_data_MasterServerPlugin, 0 }
-};
-
-const QMetaObject *MasterServerPlugin::metaObject() const
-{
- return &staticMetaObject;
-}
-
-void *MasterServerPlugin::qt_metacast(const char *_clname)
-{
- if (!_clname) return 0;
- if (!strcmp(_clname, qt_meta_stringdata_MasterServerPlugin))
- return static_cast<void*>(const_cast<MasterServerPlugin*>(this));
- return QObject::qt_metacast(_clname);
-}
-
-int MasterServerPlugin::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
-{
- _id = QObject::qt_metacall(_c, _id, _a);
- if (_id < 0)
- return _id;
- return _id;
-}
Deleted: trunk/qcell/messages/GeneratedFiles/Debug/moc_messages.cpp
===================================================================
--- trunk/qcell/messages/GeneratedFiles/Debug/moc_messages.cpp 2006-11-29 12:02:27 UTC (rev 18)
+++ trunk/qcell/messages/GeneratedFiles/Debug/moc_messages.cpp 2006-11-29 12:44:00 UTC (rev 19)
@@ -1,60 +0,0 @@
-/****************************************************************************
-** Meta object code from reading C++ file 'messages.h'
-**
-** Created: Sun 29. Oct 11:57:33 2006
-** by: The Qt Meta Object Compiler version 59 (Qt 4.2.1)
-**
-** WARNING! All changes made in this file will be lost!
-*****************************************************************************/
-
-#include "../../messages.h"
-#if !defined(Q_MOC_OUTPUT_REVISION)
-#error "The header file 'messages.h' doesn't include <QObject>."
-#elif Q_MOC_OUTPUT_REVISION != 59
-#error "This file was generated using the moc from 4.2.1. It"
-#error "cannot be used with the include files from this version of Qt."
-#error "(The moc has changed too much.)"
-#endif
-
-static const uint qt_meta_data_messages[] = {
-
- // content:
- 1, // revision
- 0, // classname
- 0, 0, // classinfo
- 0, 0, // methods
- 0, 0, // properties
- 0, 0, // enums/sets
-
- 0 // eod
-};
-
-static const char qt_meta_stringdata_messages[] = {
- "messages\0"
-};
-
-const QMetaObject messages::staticMetaObject = {
- { &MasterServerPlugin::staticMetaObject, qt_meta_stringdata_messages,
- qt_meta_data_messages, 0 }
-};
-
-const QMetaObject *messages::metaObject() const
-{
- return &staticMetaObject;
-}
-
-void *messages::qt_metacast(const char *_clname)
-{
- if (!_clname) return 0;
- if (!strcmp(_clname, qt_meta_stringdata_messages))
- return static_cast<void*>(const_cast<messages*>(this));
- return MasterServerPlugin::qt_metacast(_clname);
-}
-
-int messages::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
-{
- _id = MasterServerPlugin::qt_metacall(_c, _id, _a);
- if (_id < 0)
- return _id;
- return _id;
-}
Deleted: trunk/qcell/messages/GeneratedFiles/Release/moc_MasterServer.cpp
===================================================================
--- trunk/qcell/messages/GeneratedFiles/Release/moc_MasterServer.cpp 2006-11-29 12:02:27 UTC (rev 18)
+++ trunk/qcell/messages/GeneratedFiles/Release/moc_MasterServer.cpp 2006-11-29 12:44:00 UTC (rev 19)
@@ -1,139 +0,0 @@
-/****************************************************************************
-** Meta object code from reading C++ file 'MasterServer.h'
-**
-** Created: Mon 23. Oct 23:12:18 2006
-** by: The Qt Meta Object Compiler version 59 (Qt 4.2.1)
-**
-** WARNING! All changes made in this file will be lost!
-*****************************************************************************/
-
-#include "../../../headers/MasterServer.h"
-#if !defined(Q_MOC_OUTPUT_REVISION)
-#error "The header file 'MasterServer.h' doesn't include <QObject>."
-#elif Q_MOC_OUTPUT_REVISION != 59
-#error "This file was generated using the moc from 4.2.1. It"
-#error "cannot be used with the include files from this version of Qt."
-#error "(The moc has changed too much.)"
-#endif
-
-static const uint qt_meta_data_MasterServer[] = {
-
- // content:
- 1, // revision
- 0, // classname
- 0, 0, // classinfo
- 6, 10, // methods
- 0, 0, // properties
- 0, 0, // enums/sets
-
- // signals: signature, parameters, type, tag, flags
- 19, 14, 13, 13, 0x05,
- 48, 14, 13, 13, 0x05,
-
- // slots: signature, parameters, type, tag, flags
- 74, 13, 13, 13, 0x09,
- 101, 92, 13, 13, 0x09,
- 127, 13, 13, 13, 0x09,
- 141, 13, 13, 13, 0x0a,
-
- 0 // eod
-};
-
-static const char qt_meta_stringdata_MasterServer[] = {
- "MasterServer\0\0info\0clientRegistered(ClientInfo)\0"
- "clientRemoved(ClientInfo)\0datagramRecived()\0datagram\0"
- "parseDatagram(QByteArray)\0pingClients()\0serverKill()\0"
-};
-
-const QMetaObject MasterServer::staticMetaObject = {
- { &QThread::staticMetaObject, qt_meta_stringdata_MasterServer,
- qt_meta_data_MasterServer, 0 }
-};
-
-const QMetaObject *MasterServer::metaObject() const
-{
- return &staticMetaObject;
-}
-
-void *MasterServer::qt_metacast(const char *_clname)
-{
- if (!_clname) return 0;
- if (!strcmp(_clname, qt_meta_stringdata_MasterServer))
- return static_cast<void*>(const_cast<MasterServer*>(this));
- return QThread::qt_metacast(_clname);
-}
-
-int MasterServer::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
-{
- _id = QThread::qt_metacall(_c, _id, _a);
- if (_id < 0)
- return _id;
- if (_c == QMetaObject::InvokeMetaMethod) {
- switch (_id) {
- case 0: clientRegistered((*reinterpret_cast< ClientInfo(*)>(_a[1]))); break;
- case 1: clientRemoved((*reinterpret_cast< ClientInfo(*)>(_a[1]))); break;
- case 2: datagramRecived(); break;
- case 3: parseDatagram((*reinterpret_cast< QByteArray(*)>(_a[1]))); break;
- case 4: pingClients(); break;
- case 5: serverKill(); break;
- }
- _id -= 6;
- }
- return _id;
-}
-
-// SIGNAL 0
-void MasterServer::clientRegistered(ClientInfo _t1)
-{
- void *_a[] = { 0, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) };
- QMetaObject::activate(this, &staticMetaObject, 0, _a);
-}
-
-// SIGNAL 1
-void MasterServer::clientRemoved(ClientInfo _t1)
-{
- void *_a[] = { 0, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) };
- QMetaObject::activate(this, &staticMetaObject, 1, _a);
-}
-static const uint qt_meta_data_ServerInterface[] = {
-
- // content:
- 1, // revision
- 0, // classname
- 0, 0, // classinfo
- 0, 0, // methods
- 0, 0, // properties
- 0, 0, // enums/sets
-
- 0 // eod
-};
-
-static const char qt_meta_stringdata_ServerInterface[] = {
- "ServerInterface\0"
-};
-
-const QMetaObject ServerInterface::staticMetaObject = {
- { &MasterServerInterface::staticMetaObject, qt_meta_stringdata_ServerInterface,
- qt_meta_data_ServerInterface, 0 }
-};
-
-const QMetaObject *ServerInterface::metaObject() const
-{
- return &staticMetaObject;
-}
-
-void *ServerInterface::qt_metacast(const char *_clname)
-{
- if (!_clname) return 0;
- if (!strcmp(_clname, qt_meta_stringdata_ServerInterface))
- return static_cast<void*>(const_cast<ServerInterface*>(this));
- return MasterServerInterface::qt_metacast(_clname);
-}
-
-int ServerInterface::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
-{
- _id = MasterServerInterface::qt_metacall(_c, _id, _a);
- if (_id < 0)
- return _id;
- return _id;
-}
Deleted: trunk/qcell/messages/GeneratedFiles/Release/moc_MasterServerInterface.cpp
===================================================================
--- trunk/qcell/messages/GeneratedFiles/Release/moc_MasterServerInterface.cpp 2006-11-29 12:02:27 UTC (rev 18)
+++ trunk/qcell/messages/GeneratedFiles/Release/moc_MasterServerInterface.cpp 2006-11-29 12:44:00 UTC (rev 19)
@@ -1,76 +0,0 @@
-/****************************************************************************
-** Meta object code from reading C++ file 'MasterServerInterface.h'
-**
-** Created: Thu 26. Oct 20:07:25 2006
-** by: The Qt Meta Object Compiler version 59 (Qt 4.2.1)
-**
-** WARNING! All changes made in this file will be lost!
-*****************************************************************************/
-
-#include "../../../headers/MasterServerInterface.h"
-#if !defined(Q_MOC_OUTPUT_REVISION)
-#error "The header file 'MasterServerInterface.h' doesn't include <QObject>."
-#elif Q_MOC_OUTPUT_REVISION != 59
-#error "This file was generated using the moc from 4.2.1. It"
-#error "cannot be used with the include files from this version of Qt."
-#error "(The moc has changed too much.)"
-#endif
-
-static const uint qt_meta_data_MasterServerInterface[] = {
-
- // content:
- 1, // revision
- 0, // classname
- 0, 0, // classinfo
- 1, 10, // methods
- 0, 0, // properties
- 0, 0, // enums/sets
-
- // signals: signature, parameters, type, tag, flags
- 35, 23, 22, 22, 0x05,
-
- 0 // eod
-};
-
-static const char qt_meta_stringdata_MasterServerInterface[] = {
- "MasterServerInterface\0\0type,client\0clientListChange(int,ClientInfo)\0"
-};
-
-const QMetaObject MasterServerInterface::staticMetaObject = {
- { &QObject::staticMetaObject, qt_meta_stringdata_MasterServerInterface,
- qt_meta_data_MasterServerInterface, 0 }
-};
-
-const QMetaObject *MasterServerInterface::metaObject() const
-{
- return &staticMetaObject;
-}
-
-void *MasterServerInterface::qt_metacast(const char *_clname)
-{
- if (!_clname) return 0;
- if (!strcmp(_clname, qt_meta_stringdata_MasterServerInterface))
- return static_cast<void*>(const_cast<MasterServerInterface*>(this));
- return QObject::qt_metacast(_clname);
-}
-
-int MasterServerInterface::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
-{
- _id = QObject::qt_metacall(_c, _id, _a);
- if (_id < 0)
- return _id;
- if (_c == QMetaObject::InvokeMetaMethod) {
- switch (_id) {
- case 0: clientListChange((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< ClientInfo(*)>(_a[2]))); break;
- }
- _id -= 1;
- }
- return _id;
-}
-
-// SIGNAL 0
-void MasterServerInterface::clientListChange(int _t1, ClientInfo _t2)
-{
- void *_a[] = { 0, const_cast<void*>(reinterpret_cast<const void*>(&_t1)), const_cast<void*>(reinterpret_cast<const void*>(&_t2)) };
- QMetaObject::activate(this, &staticMetaObject, 0, _a);
-}
Deleted: trunk/qcell/messages/GeneratedFiles/Release/moc_MasterServerPlugin.cpp
===================================================================
--- trunk/qcell/messages/GeneratedFiles/Release/moc_MasterServerPlugin.cpp 2006-11-29 12:02:27 UTC (rev 18)
+++ trunk/qcell/messages/GeneratedFiles/Release/moc_MasterServerPlugin.cpp 2006-11-29 12:44:00 UTC (rev 19)
@@ -1,60 +0,0 @@
-/****************************************************************************
-** Meta object code from reading C++ file 'MasterServerPlugin.h'
-**
-** Created: Thu 26. Oct 20:07:25 2006
-** by: The Qt Meta Object Compiler version 59 (Qt 4.2.1)
-**
-** WARNING! All changes made in this file will be lost!
-*****************************************************************************/
-
-#include "../../../headers/MasterServerPlugin.h"
-#if !defined(Q_MOC_OUTPUT_REVISION)
-#error "The header file 'MasterServerPlugin.h' doesn't include <QObject>."
-#elif Q_MOC_OUTPUT_REVISION != 59
-#error "This file was generated using the moc from 4.2.1. It"
-#error "cannot be used with the include files from this version of Qt."
-#error "(The moc has changed too much.)"
-#endif
-
-static const uint qt_meta_data_MasterServerPlugin[] = {
-
- // content:
- 1, // revision
- 0, // classname
- 0, 0, // classinfo
- 0, 0, // methods
- 0, 0, // properties
- 0, 0, // enums/sets
-
- 0 // eod
-};
-
-static const char qt_meta_stringdata...
[truncated message content] |
|
From: <dhu...@us...> - 2006-11-29 14:30:27
|
Revision: 21
http://svn.sourceforge.net/qcell/?rev=21&view=rev
Author: dhubleizh
Date: 2006-11-29 06:30:22 -0800 (Wed, 29 Nov 2006)
Log Message:
-----------
- typos (pluar + int)
- set dimensions function (needed by my parsing)
Modified Paths:
--------------
trunk/qcell/baseheaders/Neighbourhood.h
trunk/qcell/basesources/Neighbourhood.cpp
Modified: trunk/qcell/baseheaders/Neighbourhood.h
===================================================================
--- trunk/qcell/baseheaders/Neighbourhood.h 2006-11-29 13:05:00 UTC (rev 20)
+++ trunk/qcell/baseheaders/Neighbourhood.h 2006-11-29 14:30:22 UTC (rev 21)
@@ -18,7 +18,7 @@
class Neighbourhood
{
private:
- int dimension;
+ int dimensions;
QVector<NContainer> neighbourVector;
protected:
@@ -37,14 +37,15 @@
void setNeighbourAt(int index, int x, int y, int z, int t);
void clearNeighbourhood(void);
- int getDimension(void);
+ int getDimensions(void);
+ void setDimensions(int dimensions);
bool fromXmlString(QString *xmlString);
bool fromDomElement(QDomElement *xmlElement);
QString toXmlString();
int getNeighbourNumber(void);
bool getBoolValueOf(int index);
- int getInValueOf(int index);
+ int getIntValueOf(int index);
double getDoubleValueOf(int index);
};
Modified: trunk/qcell/basesources/Neighbourhood.cpp
===================================================================
--- trunk/qcell/basesources/Neighbourhood.cpp 2006-11-29 13:05:00 UTC (rev 20)
+++ trunk/qcell/basesources/Neighbourhood.cpp 2006-11-29 14:30:22 UTC (rev 21)
@@ -92,11 +92,16 @@
neighbourVector.clear();
}
-int Neighbourhood::getDimension(void)
+int Neighbourhood::getDimensions(void)
{
- return dimension;
+ return dimensions;
}
+void Neighbourhood::setDimensions(int dimensions)
+{
+ this.dimensions = dimensions;
+}
+
bool Neighbourhood::fromXmlString(QString *xmlString)
{
QDomDocument doc;
@@ -217,7 +222,7 @@
return neighbourVector[index].bValue;
}
-int Neighbourhood::getInValueOf(int index)
+int Neighbourhood::getIntValueOf(int index)
{
return neighbourVector[index].iValue;
}
@@ -225,4 +230,4 @@
double Neighbourhood::getDoubleValueOf(int index)
{
return neighbourVector[index].dValue;
-}
\ No newline at end of file
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <le...@us...> - 2006-11-29 20:13:09
|
Revision: 25
http://svn.sourceforge.net/qcell/?rev=25&view=rev
Author: lessm
Date: 2006-11-29 12:12:56 -0800 (Wed, 29 Nov 2006)
Log Message:
-----------
- Neighbourhood class new method add
- CalculationData class added
- binary data type not supported yet
Modified Paths:
--------------
trunk/qcell/baseheaders/Neighbourhood.h
trunk/qcell/basesources/Neighbourhood.cpp
Added Paths:
-----------
trunk/qcell/baseheaders/CalculationData.h
trunk/qcell/basesources/CalculationData.cpp
Added: trunk/qcell/baseheaders/CalculationData.h
===================================================================
--- trunk/qcell/baseheaders/CalculationData.h (rev 0)
+++ trunk/qcell/baseheaders/CalculationData.h 2006-11-29 20:12:56 UTC (rev 25)
@@ -0,0 +1,74 @@
+#ifndef _CALCULATION_DATA
+#define _CALCULATION_DATA
+
+#include <string.h>
+#include <QString>
+#include <QByteArray>
+
+class CalculationData
+{
+public:
+ enum DATA_TYPES
+ {
+ BOOL,
+ CHAR,
+ SHORT,
+ INT,
+ FLOAT,
+ DOUBLE,
+ NONE
+ };
+
+private:
+ DATA_TYPES dataType;
+ int sizeX, sizeY, sizeZ, sizeT;
+ int dimension, size;
+ char *data;
+
+protected:
+ bool resize(const char *dataPointer=NULL);
+ void * getAddressAt(int x, int y, int z, int t);
+
+public:
+
+ CalculationData();
+ ~CalculationData();
+
+ int getValueAt_i(int x);
+ int getValueAt_i(int x, int y);
+ int getValueAt_i(int x, int y, int z);
+ int getValueAt_i(int x, int y, int z, int t);
+
+ void setValueAt_i(int val, int x);
+ void setValueAt_i(int val, int x, int y);
+ void setValueAt_i(int val, int x, int y, int z);
+ void setValueAt_i(int val, int x, int y, int z, int t);
+
+ double getValueAt_d(int x);
+ double getValueAt_d(int x, int y);
+ double getValueAt_d(int x, int y, int z);
+ double getValueAt_d(int x, int y, int z, int t);
+
+ void setValueAt_d(double val, int x);
+ void setValueAt_d(double val, int x, int y);
+ void setValueAt_d(double val, int x, int y, int z);
+ void setValueAt_d(double val, int x, int y, int z, int t);
+
+ void setDataType(DATA_TYPES type = DATA_TYPES::CHAR);
+
+ bool resize(int x, const char *dataPointer=NULL);
+ bool resize(int x, int y, const char *dataPointer=NULL);
+ bool resize(int x, int y, int z, const char *dataPointer=NULL);
+ bool resize(int x, int y, int z, int t, const char *dataPointer=NULL);
+
+ int getSizeX(void);
+ int getSizeY(void);
+ int getSizeZ(void);
+ int getSizeT(void);
+ int getSizeInByte(void);
+
+ const char *getDataPointer(void);
+ void fill(const char *dataPointer);
+};
+
+#endif
\ No newline at end of file
Modified: trunk/qcell/baseheaders/Neighbourhood.h
===================================================================
--- trunk/qcell/baseheaders/Neighbourhood.h 2006-11-29 17:31:34 UTC (rev 24)
+++ trunk/qcell/baseheaders/Neighbourhood.h 2006-11-29 20:12:56 UTC (rev 25)
@@ -12,13 +12,14 @@
double dValue;
int iValue;
bool bValue;
+ int offset;
};
class Neighbourhood
{
private:
- int dimensions;
+ int dimension;
QVector<NContainer> neighbourVector;
protected:
@@ -37,20 +38,20 @@
void setNeighbourAt(int index, int x, int y, int z, int t);
void clearNeighbourhood(void);
- int getDimensions(void);
- void setDimensions(int dimensions);
+ int getDimension(void);
bool fromXmlString(QString *xmlString);
bool fromDomElement(QDomElement *xmlElement);
QString toXmlString();
int getNeighbourNumber(void);
bool getBoolValueOf(int index);
- int getIntValueOf(int index);
+ int getInValueOf(int index);
double getDoubleValueOf(int index);
+ void calculateOffsets(int sizeX, int sizeY, int sizeZ, int sizeT);
+
};
-#endif
-
+#endif
\ No newline at end of file
Added: trunk/qcell/basesources/CalculationData.cpp
===================================================================
--- trunk/qcell/basesources/CalculationData.cpp (rev 0)
+++ trunk/qcell/basesources/CalculationData.cpp 2006-11-29 20:12:56 UTC (rev 25)
@@ -0,0 +1,537 @@
+#include "../baseheaders/CalculationData.h"
+
+bool CalculationData::resize(const char *dataPointer)
+{
+ if(data)
+ delete data;
+
+ data = new char[getSizeInByte()];
+ if(!data)
+ return 0;
+
+ if(dataPointer)
+ fill(dataPointer);
+ return 1;
+}
+
+void * CalculationData::getAddressAt(int x, int y, int z, int t)
+{
+ int dSize;
+ if(dataType==CalculationData::DATA_TYPES::NONE)
+ return NULL;
+ switch(dataType)
+ {
+ case CalculationData::DATA_TYPES::BOOL:
+ size = 0;
+ break;
+
+ case CalculationData::DATA_TYPES::CHAR:
+ dSize = 1;
+ break;
+
+ case CalculationData::DATA_TYPES::INT:
+ dSize = sizeof(int);
+ break;
+
+ case CalculationData::DATA_TYPES::SHORT:
+ dSize = sizeof(short);
+ break;
+
+ case CalculationData::DATA_TYPES::DOUBLE:
+ dSize = sizeof(double);
+ break;
+ case CalculationData::DATA_TYPES::FLOAT:
+ dSize = sizeof(float);
+ break;
+ }
+
+ return data + dSize * (x + y * sizeX + z * sizeX * sizeY + t * sizeX * sizeY * sizeZ);
+}
+
+CalculationData::CalculationData()
+{
+ dataType = CalculationData::DATA_TYPES::NONE;
+ sizeX = sizeY = sizeZ = sizeT = 0;
+ dimension = -1;
+ size = -1;
+ data = NULL;
+}
+
+CalculationData::~CalculationData()
+{
+ dataType = CalculationData::DATA_TYPES::NONE;
+ sizeX = sizeY = sizeZ = sizeT = 0;
+ dimension = -1;
+ size = -1;
+ if(data)
+ {
+ delete data;
+ data = NULL;
+ }
+}
+
+int CalculationData::getValueAt_i(int x)
+{
+ switch(dataType)
+ {
+ case CalculationData::DATA_TYPES::BOOL:
+ size = 0;
+ break;
+
+ case CalculationData::DATA_TYPES::CHAR:
+ return *((char *)getAddressAt(x, 0, 0, 0));
+
+ case CalculationData::DATA_TYPES::INT:
+ return *((int *)(getAddressAt(x, 0, 0, 0)));
+
+ case CalculationData::DATA_TYPES::SHORT:
+ return *((short *)(getAddressAt(x, 0, 0, 0)));
+ }
+ return -1;
+}
+
+int CalculationData::getValueAt_i(int x, int y)
+{
+ switch(dataType)
+ {
+ case CalculationData::DATA_TYPES::BOOL:
+ size = 0;
+ break;
+
+ case CalculationData::DATA_TYPES::CHAR:
+ return *((char *)getAddressAt(x, y, 0, 0));
+
+ case CalculationData::DATA_TYPES::INT:
+ return *((int *)(getAddressAt(x, y, 0, 0)));
+
+ case CalculationData::DATA_TYPES::SHORT:
+ return *((short *)(getAddressAt(x, y, 0, 0)));
+ }
+ return -1;
+}
+
+int CalculationData::getValueAt_i(int x, int y, int z)
+{
+ switch(dataType)
+ {
+ case CalculationData::DATA_TYPES::BOOL:
+ size = 0;
+ break;
+
+ case CalculationData::DATA_TYPES::CHAR:
+ return *((char *)getAddressAt(x, y, z, 0));
+
+ case CalculationData::DATA_TYPES::INT:
+ return *((int *)(getAddressAt(x, y, z, 0)));
+
+ case CalculationData::DATA_TYPES::SHORT:
+ return *((short *)(getAddressAt(x, y, z, 0)));
+ }
+ return -1;
+}
+
+int CalculationData::getValueAt_i(int x, int y, int z, int t)
+{
+ switch(dataType)
+ {
+ case CalculationData::DATA_TYPES::BOOL:
+ size = 0;
+ break;
+
+ case CalculationData::DATA_TYPES::CHAR:
+ return *((char *)getAddressAt(x, y, z, t));
+
+ case CalculationData::DATA_TYPES::INT:
+ return *((int *)(getAddressAt(x, y, z, t)));
+
+ case CalculationData::DATA_TYPES::SHORT:
+ return *((short *)(getAddressAt(x, y, z, t)));
+ }
+ return -1;
+}
+
+void CalculationData::setValueAt_i(int val, int x)
+{
+ switch(dataType)
+ {
+ case CalculationData::DATA_TYPES::BOOL:
+ size = 0;
+ break;
+
+ case CalculationData::DATA_TYPES::CHAR:
+ *((char *)getAddressAt(x, 0, 0, 0)) = (char)val;
+ break;
+
+ case CalculationData::DATA_TYPES::INT:
+ *((int *)(getAddressAt(x, 0, 0, 0))) = val;
+ break;
+
+ case CalculationData::DATA_TYPES::SHORT:
+ *((short *)(getAddressAt(x, 0, 0, 0))) = (short)val;
+ break;
+ }
+}
+
+void CalculationData::setValueAt_i(int val, int x, int y)
+{
+ switch(dataType)
+ {
+ case CalculationData::DATA_TYPES::BOOL:
+ size = 0;
+ break;
+
+ case CalculationData::DATA_TYPES::CHAR:
+ *((char *)getAddressAt(x, y, 0, 0)) = (char)val;
+ break;
+
+ case CalculationData::DATA_TYPES::INT:
+ *((int *)(getAddressAt(x, y, 0, 0))) = val;
+ break;
+
+ case CalculationData::DATA_TYPES::SHORT:
+ *((short *)(getAddressAt(x, y, 0, 0))) = (short)val;
+ break;
+ }
+}
+
+void CalculationData::setValueAt_i(int val, int x, int y, int z)
+{
+ switch(dataType)
+ {
+ case CalculationData::DATA_TYPES::BOOL:
+ size = 0;
+ break;
+
+ case CalculationData::DATA_TYPES::CHAR:
+ *((char *)getAddressAt(x, y, z, 0)) = (char)val;
+ break;
+
+ case CalculationData::DATA_TYPES::INT:
+ *((int *)(getAddressAt(x, y, z, 0))) = val;
+ break;
+
+ case CalculationData::DATA_TYPES::SHORT:
+ *((short *)(getAddressAt(x, y, z, 0))) = (short)val;
+ break;
+ }
+}
+
+void CalculationData::setValueAt_i(int val, int x, int y, int z, int t)
+{
+ switch(dataType)
+ {
+ case CalculationData::DATA_TYPES::BOOL:
+ size = 0;
+ break;
+
+ case CalculationData::DATA_TYPES::CHAR:
+ *((char *)getAddressAt(x, y, z, t)) = (char)val;
+ break;
+
+ case CalculationData::DATA_TYPES::INT:
+ *((int *)(getAddressAt(x, y, z, t))) = val;
+ break;
+
+ case CalculationData::DATA_TYPES::SHORT:
+ *((short *)(getAddressAt(x, y, z, t))) = (short)val;
+ break;
+ }
+}
+
+double CalculationData::getValueAt_d(int x)
+{
+ switch(dataType)
+ {
+ case CalculationData::DATA_TYPES::DOUBLE:
+ return *((double *)(getAddressAt(x, 0, 0, 0)));
+
+ case CalculationData::DATA_TYPES::FLOAT:
+ return *((float *)(getAddressAt(x, 0, 0, 0)));
+ }
+ return -1;
+}
+
+double CalculationData::getValueAt_d(int x, int y)
+{
+ switch(dataType)
+ {
+ case CalculationData::DATA_TYPES::DOUBLE:
+ return *((double *)(getAddressAt(x, y, 0, 0)));
+
+ case CalculationData::DATA_TYPES::FLOAT:
+ return *((float *)(getAddressAt(x, y, 0, 0)));
+ }
+ return -1;
+}
+
+double CalculationData::getValueAt_d(int x, int y, int z)
+{
+ switch(dataType)
+ {
+ case CalculationData::DATA_TYPES::DOUBLE:
+ return *((double *)(getAddressAt(x, y, z, 0)));
+
+ case CalculationData::DATA_TYPES::FLOAT:
+ return *((float *)(getAddressAt(x, y, z, 0)));
+ }
+ return -1;
+}
+
+double CalculationData::getValueAt_d(int x, int y, int z, int t)
+{
+ switch(dataType)
+ {
+ case CalculationData::DATA_TYPES::DOUBLE:
+ return *((double *)(getAddressAt(x, y, z, t)));
+
+ case CalculationData::DATA_TYPES::FLOAT:
+ return *((float *)(getAddressAt(x, y, z, t)));
+ }
+ return -1;
+}
+
+void CalculationData::setValueAt_d(double val, int x)
+{
+ switch(dataType)
+ {
+ case CalculationData::DATA_TYPES::DOUBLE:
+ *((double *)(getAddressAt(x, 0, 0, 0))) = val;
+ break;
+
+ case CalculationData::DATA_TYPES::FLOAT:
+ *((float *)(getAddressAt(x, 0, 0, 0))) = (float)val;
+ break;
+ }
+}
+
+void CalculationData::setValueAt_d(double val, int x, int y)
+{
+ switch(dataType)
+ {
+ case CalculationData::DATA_TYPES::DOUBLE:
+ *((double *)(getAddressAt(x, y, 0, 0))) = val;
+ break;
+
+ case CalculationData::DATA_TYPES::FLOAT:
+ *((float *)(getAddressAt(x, y, 0, 0))) = (float)val;
+ break;
+ }
+}
+
+void CalculationData::setValueAt_d(double val, int x, int y, int z)
+{
+ switch(dataType)
+ {
+ case CalculationData::DATA_TYPES::DOUBLE:
+ *((double *)(getAddressAt(x, y, z, 0))) = val;
+ break;
+
+ case CalculationData::DATA_TYPES::FLOAT:
+ *((float *)(getAddressAt(x, y, z, 0))) = (float)val;
+ break;
+ }
+}
+
+void CalculationData::setValueAt_d(double val, int x, int y, int z, int t)
+{
+ switch(dataType)
+ {
+ case CalculationData::DATA_TYPES::DOUBLE:
+ *((double *)(getAddressAt(x, y, z, t))) = val;
+ break;
+
+ case CalculationData::DATA_TYPES::FLOAT:
+ *((float *)(getAddressAt(x, y, z, t))) = (float)val;
+ break;
+ }
+}
+
+void CalculationData::setDataType(DATA_TYPES type)
+{
+ dataType = type;
+ size = -1;
+ switch(dataType)
+ {
+ case CalculationData::DATA_TYPES::BOOL:
+ size = 0;
+ break;
+
+ case CalculationData::DATA_TYPES::CHAR:
+ size = 1;
+ break;
+
+ case CalculationData::DATA_TYPES::DOUBLE:
+ size = sizeof(double);
+ break;
+
+ case CalculationData::DATA_TYPES::FLOAT:
+ size = sizeof(float);
+ break;
+
+ case CalculationData::DATA_TYPES::INT:
+ size = sizeof(int);
+ break;
+
+ case CalculationData::DATA_TYPES::SHORT:
+ size = sizeof(short);
+ break;
+ }
+}
+
+bool CalculationData::resize(int x, const char *dataPointer)
+{
+ sizeX = x;
+ sizeY = 0;
+ sizeZ = 0;
+ sizeT = 0;
+ dimension = 1;
+ return resize(dataPointer);
+}
+
+bool CalculationData::resize(int x, int y, const char *dataPointer)
+{
+ sizeX = x;
+ sizeY = y;
+ sizeZ = 0;
+ sizeT = 0;
+ dimension = 2;
+ return resize(dataPointer);
+}
+
+bool CalculationData::resize(int x, int y, int z, const char *dataPointer)
+{
+ sizeX = x;
+ sizeY = y;
+ sizeZ = z;
+ sizeT = 0;
+ dimension = 3;
+ return resize(dataPointer);
+}
+
+bool CalculationData::resize(int x, int y, int z, int t, const char *dataPointer)
+{
+ sizeX = x;
+ sizeY = y;
+ sizeZ = z;
+ sizeT = t;
+ dimension = 4;
+ return resize(dataPointer);
+}
+
+int CalculationData::getSizeX(void)
+{
+ return sizeX;
+}
+
+int CalculationData::getSizeY(void)
+{
+ return sizeY;
+}
+
+int CalculationData::getSizeZ(void)
+{
+ return sizeZ;
+}
+
+int CalculationData::getSizeT(void)
+{
+ return sizeT;
+}
+
+int CalculationData::getSizeInByte(void)
+{
+ switch(dataType)
+ {
+ case CalculationData::DATA_TYPES::BOOL:
+ switch(dimension)
+ {
+ case 1:
+ return sizeX / 8 + ((sizeX % 8)>0);
+ case 2:
+ return (sizeX * sizeY) / 8 + (((sizeX * sizeY) % 8)>0);
+ case 3:
+ return (sizeX * sizeY * sizeZ) / 8 + (((sizeX * sizeY * sizeZ) % 8)>0);
+ case 4:
+ return (sizeX * sizeY * sizeZ * sizeT) / 8 + (((sizeX * sizeY * sizeZ * sizeT) % 8)>0);
+ }
+
+ case CalculationData::DATA_TYPES::CHAR:
+ switch(dimension)
+ {
+ case 1:
+ return sizeX;
+ case 2:
+ return sizeX * sizeY;
+ case 3:
+ return sizeX * sizeY * sizeZ;
+ case 4:
+ return sizeX * sizeY * sizeZ * sizeT;
+ }
+
+ case CalculationData::DATA_TYPES::DOUBLE:
+ switch(dimension)
+ {
+ case 1:
+ return sizeX * sizeof(double);
+ case 2:
+ return sizeX * sizeY * sizeof(double);
+ case 3:
+ return sizeX * sizeY * sizeZ * sizeof(double);
+ case 4:
+ return sizeX * sizeY * sizeZ * sizeT * sizeof(double);
+ }
+
+ case CalculationData::DATA_TYPES::FLOAT:
+ switch(dimension)
+ {
+ case 1:
+ return sizeX * sizeof(float);
+ case 2:
+ return sizeX * sizeY * sizeof(float);
+ case 3:
+ return sizeX * sizeY * sizeZ * sizeof(float);
+ case 4:
+ return sizeX * sizeY * sizeZ * sizeT * sizeof(float);
+ }
+
+ case CalculationData::DATA_TYPES::INT:
+ switch(dimension)
+ {
+ case 1:
+ return sizeX * sizeof(int);
+ case 2:
+ return sizeX * sizeY * sizeof(int);
+ case 3:
+ return sizeX * sizeY * sizeZ * sizeof(int);
+ case 4:
+ return sizeX * sizeY * sizeZ * sizeT * sizeof(int);
+ }
+
+ case CalculationData::DATA_TYPES::SHORT:
+ switch(dimension)
+ {
+ case 1:
+ return sizeX * sizeof(short);
+ case 2:
+ return sizeX * sizeY * sizeof(short);
+ case 3:
+ return sizeX * sizeY * sizeZ * sizeof(short);
+ case 4:
+ return sizeX * sizeY * sizeZ * sizeT * sizeof(short);
+ }
+ }
+ return 0;
+}
+
+const char *CalculationData::getDataPointer(void)
+{
+ return data;
+}
+
+void CalculationData::fill(const char *dataPointer)
+{
+ if(data!=NULL)
+ {
+ memcpy(data, dataPointer, getSizeInByte());
+ }
+}
\ No newline at end of file
Modified: trunk/qcell/basesources/Neighbourhood.cpp
===================================================================
--- trunk/qcell/basesources/Neighbourhood.cpp 2006-11-29 17:31:34 UTC (rev 24)
+++ trunk/qcell/basesources/Neighbourhood.cpp 2006-11-29 20:12:56 UTC (rev 25)
@@ -92,16 +92,11 @@
neighbourVector.clear();
}
-int Neighbourhood::getDimensions(void)
+int Neighbourhood::getDimension(void)
{
- return dimensions;
+ return dimension;
}
-void Neighbourhood::setDimensions(int dimensions)
-{
- this.dimensions = dimensions;
-}
-
bool Neighbourhood::fromXmlString(QString *xmlString)
{
QDomDocument doc;
@@ -222,7 +217,7 @@
return neighbourVector[index].bValue;
}
-int Neighbourhood::getIntValueOf(int index)
+int Neighbourhood::getInValueOf(int index)
{
return neighbourVector[index].iValue;
}
@@ -231,3 +226,11 @@
{
return neighbourVector[index].dValue;
}
+
+void Neighbourhood::calculateOffsets(int sizeX, int sizeY, int sizeZ, int sizeT, int dataSize)
+{
+ for(int i=0;i<neighbourVector.size();i++)
+ {
+ neighbourVector[i].offset = dataSize * (neighbourVector[i].x + neighbourVector[i].y * sizeX + neighbourVector[i].z * sizeX * sizeY + neighbourVector[i].t * sizeX * sizeY * sizeZ);
+ }
+}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <le...@us...> - 2006-11-29 23:39:27
|
Revision: 26
http://svn.sourceforge.net/qcell/?rev=26&view=rev
Author: lessm
Date: 2006-11-29 15:39:25 -0800 (Wed, 29 Nov 2006)
Log Message:
-----------
- CalculationData class can import/export setings from xml string
Modified Paths:
--------------
trunk/qcell/baseheaders/CalculationData.h
trunk/qcell/baseheaders/Neighbourhood.h
trunk/qcell/basesources/CalculationData.cpp
trunk/qcell/basesources/Neighbourhood.cpp
Modified: trunk/qcell/baseheaders/CalculationData.h
===================================================================
--- trunk/qcell/baseheaders/CalculationData.h 2006-11-29 20:12:56 UTC (rev 25)
+++ trunk/qcell/baseheaders/CalculationData.h 2006-11-29 23:39:25 UTC (rev 26)
@@ -3,7 +3,8 @@
#include <string.h>
#include <QString>
-#include <QByteArray>
+#include <QDomDocument>
+#include <QDomElement>
class CalculationData
{
@@ -22,12 +23,20 @@
private:
DATA_TYPES dataType;
int sizeX, sizeY, sizeZ, sizeT;
+ int backBufferSizeX, backBufferSizeY, backBufferSizeZ, backBufferSizeT;
int dimension, size;
- char *data;
+ char *data, *dataBorderFree;
+ int minX, minY, minZ, minT;
+ int maxX, maxY, maxZ, maxT;
+
+ bool borderExist;
+
protected:
bool resize(const char *dataPointer=NULL);
void * getAddressAt(int x, int y, int z, int t);
+ void * getAddressAtBackBuffer(int x, int y, int z, int t);
+ void calculateBackBufferSize(void);
public:
@@ -54,7 +63,9 @@
void setValueAt_d(double val, int x, int y, int z);
void setValueAt_d(double val, int x, int y, int z, int t);
- void setDataType(DATA_TYPES type = DATA_TYPES::CHAR);
+ void setDataType(CalculationData::DATA_TYPES type = CalculationData::DATA_TYPES::CHAR);
+ CalculationData::DATA_TYPES getDataType(void);
+ int getDataSize(void);
bool resize(int x, const char *dataPointer=NULL);
bool resize(int x, int y, const char *dataPointer=NULL);
@@ -68,7 +79,32 @@
int getSizeInByte(void);
const char *getDataPointer(void);
+ const char *getBackBufferDataPointer(void);
void fill(const char *dataPointer);
+
+
+ void setCalculationSpace(void);
+ void setCalculationSpace(int startX, int endX);
+ void setCalculationSpace(int startX, int startY, int endX, int endY);
+ void setCalculationSpace(int startX, int startY, int startZ, int endX, int endY, int endZ);
+ void setCalculationSpace(int startX, int startY, int startZ, int startT, int endX, int endY, int endZ, int endT);
+
+ void removeBorder(void);
+ bool haveBorder(void);
+
+ QString createXmlHeader(void);
+ void setFromXmlString(QString *xmlString);
+ void parseXmlElement(QDomElement *root);
+
+ void setValueAt_i_Back(int val, int x);
+ void setValueAt_i_Back(int val, int x, int y);
+ void setValueAt_i_Back(int val, int x, int y, int z);
+ void setValueAt_i_Back(int val, int x, int y, int z, int t);
+
+ void setValueAt_d_Back(double val, int x);
+ void setValueAt_d_Back(double val, int x, int y);
+ void setValueAt_d_Back(double val, int x, int y, int z);
+ void setValueAt_d_Back(double val, int x, int y, int z, int t);
};
-#endif
\ No newline at end of file
+#endif
Modified: trunk/qcell/baseheaders/Neighbourhood.h
===================================================================
--- trunk/qcell/baseheaders/Neighbourhood.h 2006-11-29 20:12:56 UTC (rev 25)
+++ trunk/qcell/baseheaders/Neighbourhood.h 2006-11-29 23:39:25 UTC (rev 26)
@@ -48,10 +48,10 @@
int getInValueOf(int index);
double getDoubleValueOf(int index);
- void calculateOffsets(int sizeX, int sizeY, int sizeZ, int sizeT);
+ void calculateOffsets(int sizeX, int sizeY, int sizeZ, int sizeT, int dataSize);
};
-#endif
\ No newline at end of file
+#endif
Modified: trunk/qcell/basesources/CalculationData.cpp
===================================================================
--- trunk/qcell/basesources/CalculationData.cpp 2006-11-29 20:12:56 UTC (rev 25)
+++ trunk/qcell/basesources/CalculationData.cpp 2006-11-29 23:39:25 UTC (rev 26)
@@ -2,13 +2,20 @@
bool CalculationData::resize(const char *dataPointer)
{
+ borderExist = 0;
if(data)
- delete data;
+ delete[] data;
data = new char[getSizeInByte()];
if(!data)
return 0;
+ if(dataBorderFree)
+ {
+ delete[] dataBorderFree;
+ dataBorderFree = NULL;
+ }
+
if(dataPointer)
fill(dataPointer);
return 1;
@@ -48,6 +55,69 @@
return data + dSize * (x + y * sizeX + z * sizeX * sizeY + t * sizeX * sizeY * sizeZ);
}
+void * CalculationData::getAddressAtBackBuffer(int x, int y, int z, int t)
+{
+ int dSize;
+ if(dataType==CalculationData::DATA_TYPES::NONE)
+ return NULL;
+ switch(dataType)
+ {
+ case CalculationData::DATA_TYPES::BOOL:
+ size = 0;
+ break;
+
+ case CalculationData::DATA_TYPES::CHAR:
+ dSize = 1;
+ break;
+
+ case CalculationData::DATA_TYPES::INT:
+ dSize = sizeof(int);
+ break;
+
+ case CalculationData::DATA_TYPES::SHORT:
+ dSize = sizeof(short);
+ break;
+
+ case CalculationData::DATA_TYPES::DOUBLE:
+ dSize = sizeof(double);
+ break;
+ case CalculationData::DATA_TYPES::FLOAT:
+ dSize = sizeof(float);
+ break;
+ }
+
+ x -= minX;
+ y -= minY;
+ z -= minZ;
+ t -= minT;
+
+ if(t<0)
+ t=0;
+ if(z<0)
+ z=0;
+ if(y<0)
+ y=0;
+ if(x<0)
+ x=0;
+
+ return dataBorderFree + dSize * (x + y * backBufferSizeX + z * backBufferSizeX * backBufferSizeY + t * backBufferSizeX * backBufferSizeY * backBufferSizeZ);
+}
+
+void CalculationData::calculateBackBufferSize(void)
+{
+ switch(dimension)
+ {
+ case 4:
+ backBufferSizeT = maxT - minT;
+ case 3:
+ backBufferSizeZ = maxZ - minZ;
+ case 2:
+ backBufferSizeY = maxY - minY;
+ case 1:
+ backBufferSizeX = maxX - minX;
+ }
+}
+
CalculationData::CalculationData()
{
dataType = CalculationData::DATA_TYPES::NONE;
@@ -55,6 +125,8 @@
dimension = -1;
size = -1;
data = NULL;
+ dataBorderFree = NULL;
+ borderExist = 0;
}
CalculationData::~CalculationData()
@@ -65,9 +137,14 @@
size = -1;
if(data)
{
- delete data;
+ delete[] data;
data = NULL;
}
+ if(dataBorderFree)
+ {
+ delete[] dataBorderFree;
+ dataBorderFree = NULL;
+ }
}
int CalculationData::getValueAt_i(int x)
@@ -378,6 +455,15 @@
}
}
+CalculationData::DATA_TYPES CalculationData::getDataType(void)
+{
+ return dataType;
+}
+int CalculationData::getDataSize(void)
+{
+ return size;
+}
+
bool CalculationData::resize(int x, const char *dataPointer)
{
sizeX = x;
@@ -443,17 +529,7 @@
switch(dataType)
{
case CalculationData::DATA_TYPES::BOOL:
- switch(dimension)
- {
- case 1:
- return sizeX / 8 + ((sizeX % 8)>0);
- case 2:
- return (sizeX * sizeY) / 8 + (((sizeX * sizeY) % 8)>0);
- case 3:
- return (sizeX * sizeY * sizeZ) / 8 + (((sizeX * sizeY * sizeZ) % 8)>0);
- case 4:
- return (sizeX * sizeY * sizeZ * sizeT) / 8 + (((sizeX * sizeY * sizeZ * sizeT) % 8)>0);
- }
+ return (sizeX * sizeY * sizeZ * sizeT)/8;
case CalculationData::DATA_TYPES::CHAR:
switch(dimension)
@@ -528,10 +604,478 @@
return data;
}
+const char *CalculationData::getBackBufferDataPointer(void)
+{
+ return dataBorderFree;
+}
+
void CalculationData::fill(const char *dataPointer)
{
if(data!=NULL)
{
memcpy(data, dataPointer, getSizeInByte());
}
-}
\ No newline at end of file
+}
+
+void CalculationData::setCalculationSpace(void)
+{
+ minX = 0;
+ minY = 0;
+ minZ = 0;
+ minT = 0;
+
+ maxX = sizeX;
+ maxY = sizeY;
+ maxZ = sizeZ;
+ maxT = sizeT;
+
+ borderExist = 0;
+ if(dataBorderFree)
+ {
+ delete[] dataBorderFree;
+ }
+ dataBorderFree = new char[getSizeInByte()];
+ calculateBackBufferSize();
+}
+
+void CalculationData::setCalculationSpace(int startX, int endX)
+{
+ minX = startX;
+ maxX = endX;
+ borderExist = 1;
+ if(dataBorderFree)
+ {
+ delete[] dataBorderFree;
+ }
+ dataBorderFree = new char[(maxX - minX) * size];
+ calculateBackBufferSize();
+}
+
+void CalculationData::setCalculationSpace(int startX, int startY, int endX, int endY)
+{
+ minX = startX;
+ maxX = endX;
+ minY = startY;
+ maxY = endY;
+ borderExist = 1;
+ if(dataBorderFree)
+ {
+ delete[] dataBorderFree;
+ }
+ dataBorderFree = new char[((maxX - minX) * (maxY - minY)) * size];
+ calculateBackBufferSize();
+}
+
+void CalculationData::setCalculationSpace(int startX, int startY, int startZ, int endX, int endY, int endZ)
+{
+ minX = startX;
+ maxX = endX;
+ minY = startY;
+ maxY = endY;
+ minZ = startZ;
+ maxZ = endZ;
+ borderExist = 1;
+ if(dataBorderFree)
+ {
+ delete[] dataBorderFree;
+ }
+ dataBorderFree = new char[((maxX - minX) * (maxY - minY) * (maxZ - minZ)) * size];
+ calculateBackBufferSize();
+}
+
+void CalculationData::setCalculationSpace(int startX, int startY, int startZ, int startT, int endX, int endY, int endZ, int endT)
+{
+ minX = startX;
+ maxX = endX;
+ minY = startY;
+ maxY = endY;
+ minZ = startZ;
+ maxZ = endZ;
+ minT = startT;
+ maxT = endT;
+ borderExist = 1;
+ if(dataBorderFree)
+ {
+ delete[] dataBorderFree;
+ }
+ dataBorderFree = new char[((maxX - minX) * (maxY - minY) * (maxZ - minZ) * (maxT - minT)) * size];
+ calculateBackBufferSize();
+}
+
+void CalculationData::removeBorder(void)
+{
+ char *temp;
+ int newSize = 1, counter = 0;
+ if(borderExist)
+ {
+ switch(dimension)
+ {
+
+ case 4:
+ newSize *= maxT - minT;
+
+ case 3:
+ newSize *= maxZ - minZ;
+
+ case 2:
+ newSize *= maxY - minY;
+
+ case 1:
+ newSize *= maxX - minX;
+ break;
+
+ default:
+ newSize = 0;
+ }
+
+ temp = new char[newSize * size];
+
+ for(int t=minT;t<maxT;++t)
+ {
+ for(int z=minZ;z<maxZ;++z)
+ {
+ for(int y=minY;y<maxY;++y)
+ {
+ for(int x=minX;x<maxX;++x)
+ {
+ memcpy(temp + counter, getAddressAt(x, y, z, t), size);
+ counter += size;
+ }
+ }
+ }
+ }
+
+ switch(dimension)
+ {
+
+ case 4:
+ sizeT = maxT - minT;
+
+ case 3:
+ sizeZ = maxZ - minZ;
+
+ case 2:
+ sizeY = maxY - minY;
+
+ case 1:
+ sizeX = maxX - minX;
+ }
+
+ delete[] data;
+ data = temp;
+ temp = NULL;
+
+ }
+ borderExist = 0;
+}
+
+bool CalculationData::haveBorder(void)
+{
+ return borderExist;
+}
+
+QString CalculationData::createXmlHeader(void)
+{
+ QDomDocument doc;
+ QDomElement root, element, subElementMin, subElementMax;
+ root = doc.createElement("CalculationData");
+ doc.appendChild(root);
+ element = doc.createElement("Data");
+ switch(dimension)
+ {
+ case 4:
+ element.setAttribute("t", sizeT);
+ case 3:
+ element.setAttribute("z", sizeZ);
+ case 2:
+ element.setAttribute("y", sizeY);
+ case 1:
+ element.setAttribute("x", sizeX);
+ }
+ switch(dataType)
+ {
+ case CalculationData::DATA_TYPES::BOOL:
+ element.setAttribute("ContentType", "bool");
+ break;
+
+ case CalculationData::DATA_TYPES::CHAR:
+ element.setAttribute("ContentType", "char");
+ break;
+
+ case CalculationData::DATA_TYPES::DOUBLE:
+ element.setAttribute("ContentType", "double");
+ break;
+
+ case CalculationData::DATA_TYPES::FLOAT:
+ element.setAttribute("ContentType", "float");
+ break;
+
+ case CalculationData::DATA_TYPES::INT:
+ element.setAttribute("ContentType", "bool");
+ break;
+
+ case CalculationData::DATA_TYPES::SHORT:
+ element.setAttribute("ContentType", "short");
+ break;
+ }
+ root.appendChild(element);
+
+ if(haveBorder())
+ {
+ element = doc.createElement("Border");
+ subElementMin = doc.createElement("Min");
+ subElementMax = doc.createElement("Max");
+ switch(dimension)
+ {
+ case 4:
+ subElementMin.setAttribute("t", minT);
+ subElementMax.setAttribute("t", maxT);
+ case 3:
+ subElementMin.setAttribute("z", minZ);
+ subElementMax.setAttribute("z", maxZ);
+ case 2:
+ subElementMin.setAttribute("y", minY);
+ subElementMax.setAttribute("y", maxY);
+ case 1:
+ subElementMin.setAttribute("x", minX);
+ subElementMax.setAttribute("x", maxX);
+ }
+ element.appendChild(subElementMin);
+ element.appendChild(subElementMax);
+ root.appendChild(element);
+ }
+ return doc.toString();
+}
+
+void CalculationData::setFromXmlString(QString *xmlString)
+{
+ QDomDocument doc;
+ QDomElement element;
+ doc.setContent(*xmlString);
+ element = doc.documentElement();
+ parseXmlElement(&element);
+}
+
+void CalculationData::parseXmlElement(QDomElement *root)
+{
+ QDomElement element, minElement, maxElement;
+ QDomNode node, subNode;
+
+ if(root->tagName()=="CalculationData")
+ {
+ node = root->firstChild();
+ while(!node.isNull())
+ {
+ element = node.toElement();
+ if(element.tagName()=="Data")
+ {
+ if(element.attribute("ContentType")=="bool")
+ setDataType(CalculationData::DATA_TYPES::BOOL);
+ else
+ if(element.attribute("ContentType")=="char")
+ setDataType(CalculationData::DATA_TYPES::CHAR);
+ else
+ if(element.attribute("ContentType")=="double")
+ setDataType(CalculationData::DATA_TYPES::DOUBLE);
+ else
+ if(element.attribute("ContentType")=="float")
+ setDataType(CalculationData::DATA_TYPES::FLOAT);
+ else
+ if(element.attribute("ContentType")=="int")
+ setDataType(CalculationData::DATA_TYPES::INT);
+ else
+ if(element.attribute("ContentType")=="short")
+ setDataType(CalculationData::DATA_TYPES::SHORT);
+
+ if(element.hasAttribute("t"))
+ resize(element.attribute("t").toInt(), element.attribute("z").toInt(), element.attribute("y").toInt(), element.attribute("x").toInt());
+ else
+ if(element.hasAttribute("z"))
+ resize(element.attribute("z").toInt(), element.attribute("y").toInt(), element.attribute("x").toInt());
+ else
+ if(element.hasAttribute("y"))
+ resize(element.attribute("y").toInt(), element.attribute("x").toInt());
+ else
+ resize(element.attribute("x").toInt());
+
+ }
+ if(element.tagName()=="Border")
+ {
+ subNode = element.firstChild();
+ while(!subNode.isNull())
+ {
+ element = subNode.toElement();
+ if(element.tagName()=="Min")
+ minElement = subNode.toElement();
+ else
+ if(element.tagName()=="Max")
+ maxElement = subNode.toElement();
+ subNode = subNode.nextSibling();
+ }
+ switch(dimension)
+ {
+ case 1:
+ setCalculationSpace(minElement.attribute("x").toInt(), maxElement.attribute("x").toInt());
+ break;
+ case 2:
+ setCalculationSpace(minElement.attribute("x").toInt(), minElement.attribute("y").toInt(), maxElement.attribute("x").toInt(), maxElement.attribute("y").toInt());
+ break;
+ case 3:
+ setCalculationSpace(minElement.attribute("x").toInt(), minElement.attribute("y").toInt(), minElement.attribute("z").toInt(), maxElement.attribute("x").toInt(), maxElement.attribute("y").toInt(), maxElement.attribute("z").toInt());
+ break;
+ case 4:
+ setCalculationSpace(minElement.attribute("x").toInt(), minElement.attribute("y").toInt(), minElement.attribute("z").toInt(), minElement.attribute("t").toInt(), maxElement.attribute("x").toInt(), maxElement.attribute("y").toInt(), maxElement.attribute("z").toInt(), maxElement.attribute("t").toInt());
+ break;
+ }
+ }
+ node = node.nextSibling();
+ }
+ if(!haveBorder())
+ setCalculationSpace();
+ }
+}
+
+void CalculationData::setValueAt_i_Back(int val, int x)
+{
+ switch(dataType)
+ {
+ case CalculationData::DATA_TYPES::BOOL:
+ size = 0;
+ break;
+
+ case CalculationData::DATA_TYPES::CHAR:
+ *((char *)getAddressAtBackBuffer(x, 0, 0, 0)) = (char)val;
+ break;
+
+ case CalculationData::DATA_TYPES::INT:
+ *((int *)(getAddressAtBackBuffer(x, 0, 0, 0))) = val;
+ break;
+
+ case CalculationData::DATA_TYPES::SHORT:
+ *((short *)(getAddressAtBackBuffer(x, 0, 0, 0))) = (short)val;
+ break;
+ }
+}
+
+void CalculationData::setValueAt_i_Back(int val, int x, int y)
+{
+ switch(dataType)
+ {
+ case CalculationData::DATA_TYPES::BOOL:
+ size = 0;
+ break;
+
+ case CalculationData::DATA_TYPES::CHAR:
+ *((char *)getAddressAtBackBuffer(x, y, 0, 0)) = (char)val;
+ break;
+
+ case CalculationData::DATA_TYPES::INT:
+ *((int *)(getAddressAtBackBuffer(x, y, 0, 0))) = val;
+ break;
+
+ case CalculationData::DATA_TYPES::SHORT:
+ *((short *)(getAddressAtBackBuffer(x, y, 0, 0))) = (short)val;
+ break;
+ }
+}
+
+void CalculationData::setValueAt_i_Back(int val, int x, int y, int z)
+{
+ switch(dataType)
+ {
+ case CalculationData::DATA_TYPES::BOOL:
+ size = 0;
+ break;
+
+ case CalculationData::DATA_TYPES::CHAR:
+ *((char *)getAddressAtBackBuffer(x, y, z, 0)) = (char)val;
+ break;
+
+ case CalculationData::DATA_TYPES::INT:
+ *((int *)(getAddressAtBackBuffer(x, y, z, 0))) = val;
+ break;
+
+ case CalculationData::DATA_TYPES::SHORT:
+ *((short *)(getAddressAtBackBuffer(x, y, z, 0))) = (short)val;
+ break;
+ }
+}
+
+void CalculationData::setValueAt_i_Back(int val, int x, int y, int z, int t)
+{
+ switch(dataType)
+ {
+ case CalculationData::DATA_TYPES::BOOL:
+ size = 0;
+ break;
+
+ case CalculationData::DATA_TYPES::CHAR:
+ *((char *)getAddressAtBackBuffer(x, y, z, t)) = (char)val;
+ break;
+
+ case CalculationData::DATA_TYPES::INT:
+ *((int *)(getAddressAtBackBuffer(x, y, z, t))) = val;
+ break;
+
+ case CalculationData::DATA_TYPES::SHORT:
+ *((short *)(getAddressAtBackBuffer(x, y, z, t))) = (short)val;
+ break;
+ }
+}
+
+void CalculationData::setValueAt_d_Back(double val, int x)
+{
+ switch(dataType)
+ {
+ case CalculationData::DATA_TYPES::DOUBLE:
+ *((double *)(getAddressAtBackBuffer(x, 0, 0, 0))) = val;
+ break;
+
+ case CalculationData::DATA_TYPES::FLOAT:
+ *((float *)(getAddressAtBackBuffer(x, 0, 0, 0))) = (float)val;
+ break;
+ }
+}
+
+void CalculationData::setValueAt_d_Back(double val, int x, int y)
+{
+ switch(dataType)
+ {
+ case CalculationData::DATA_TYPES::DOUBLE:
+ *((double *)(getAddressAtBackBuffer(x, y, 0, 0))) = val;
+ break;
+
+ case CalculationData::DATA_TYPES::FLOAT:
+ *((float *)(getAddressAtBackBuffer(x, y, 0, 0))) = (float)val;
+ break;
+ }
+}
+
+void CalculationData::setValueAt_d_Back(double val, int x, int y, int z)
+{
+ switch(dataType)
+ {
+ case CalculationData::DATA_TYPES::DOUBLE:
+ *((double *)(getAddressAtBackBuffer(x, y, z, 0))) = val;
+ break;
+
+ case CalculationData::DATA_TYPES::FLOAT:
+ *((float *)(getAddressAtBackBuffer(x, y, z, 0))) = (float)val;
+ break;
+ }
+}
+
+void CalculationData::setValueAt_d_Back(double val, int x, int y, int z, int t)
+{
+ switch(dataType)
+ {
+ case CalculationData::DATA_TYPES::DOUBLE:
+ *((double *)(getAddressAtBackBuffer(x, y, z, t))) = val;
+ break;
+
+ case CalculationData::DATA_TYPES::FLOAT:
+ *((float *)(getAddressAtBackBuffer(x, y, z, t))) = (float)val;
+ break;
+ }
+}
+
Modified: trunk/qcell/basesources/Neighbourhood.cpp
===================================================================
--- trunk/qcell/basesources/Neighbourhood.cpp 2006-11-29 20:12:56 UTC (rev 25)
+++ trunk/qcell/basesources/Neighbourhood.cpp 2006-11-29 23:39:25 UTC (rev 26)
@@ -233,4 +233,4 @@
{
neighbourVector[i].offset = dataSize * (neighbourVector[i].x + neighbourVector[i].y * sizeX + neighbourVector[i].z * sizeX * sizeY + neighbourVector[i].t * sizeX * sizeY * sizeZ);
}
-}
\ No newline at end of file
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <le...@us...> - 2006-11-30 12:22:08
|
Revision: 28
http://svn.sourceforge.net/qcell/?rev=28&view=rev
Author: lessm
Date: 2006-11-30 04:21:55 -0800 (Thu, 30 Nov 2006)
Log Message:
-----------
- Neighbourhood class calculate offset address properly
- CalculationData class have new methods clearFrontBuffer_d and clearFrontBuffer_i
- Neighbourhood and CalculationData classes inherits from baseDataTypes class
Modified Paths:
--------------
trunk/qcell/baseheaders/CalculationData.h
trunk/qcell/baseheaders/Neighbourhood.h
trunk/qcell/basesources/CalculationData.cpp
trunk/qcell/basesources/Neighbourhood.cpp
Added Paths:
-----------
trunk/qcell/baseheaders/BaseDataTypes.h
Added: trunk/qcell/baseheaders/BaseDataTypes.h
===================================================================
--- trunk/qcell/baseheaders/BaseDataTypes.h (rev 0)
+++ trunk/qcell/baseheaders/BaseDataTypes.h 2006-11-30 12:21:55 UTC (rev 28)
@@ -0,0 +1,19 @@
+#ifndef _BASE_DATA_TYPES
+#define _BASE_DATA_TYPES
+
+class baseDataTypes
+{
+public:
+ enum DATA_TYPES
+ {
+ BOOL,
+ CHAR,
+ SHORT,
+ INT,
+ FLOAT,
+ DOUBLE,
+ NONE
+ };
+};
+
+#endif
\ No newline at end of file
Modified: trunk/qcell/baseheaders/CalculationData.h
===================================================================
--- trunk/qcell/baseheaders/CalculationData.h 2006-11-30 12:06:33 UTC (rev 27)
+++ trunk/qcell/baseheaders/CalculationData.h 2006-11-30 12:21:55 UTC (rev 28)
@@ -5,21 +5,10 @@
#include <QString>
#include <QDomDocument>
#include <QDomElement>
+#include "BaseDataTypes.h"
-class CalculationData
+class CalculationData : public baseDataTypes
{
-public:
- enum DATA_TYPES
- {
- BOOL,
- CHAR,
- SHORT,
- INT,
- FLOAT,
- DOUBLE,
- NONE
- };
-
private:
DATA_TYPES dataType;
int sizeX, sizeY, sizeZ, sizeT;
@@ -32,7 +21,8 @@
bool borderExist;
-protected:
+//protected:
+public:
bool resize(const char *dataPointer=NULL);
void * getAddressAt(int x, int y, int z, int t);
void * getAddressAtBackBuffer(int x, int y, int z, int t);
@@ -63,8 +53,8 @@
void setValueAt_d(double val, int x, int y, int z);
void setValueAt_d(double val, int x, int y, int z, int t);
- void setDataType(CalculationData::DATA_TYPES type = CalculationData::DATA_TYPES::CHAR);
- CalculationData::DATA_TYPES getDataType(void);
+ void setDataType(baseDataTypes::DATA_TYPES type = baseDataTypes::DATA_TYPES::CHAR);
+ baseDataTypes::DATA_TYPES getDataType(void);
int getDataSize(void);
bool resize(int x, const char *dataPointer=NULL);
@@ -105,6 +95,9 @@
void setValueAt_d_Back(double val, int x, int y);
void setValueAt_d_Back(double val, int x, int y, int z);
void setValueAt_d_Back(double val, int x, int y, int z, int t);
+
+ void clearFrontBuffer_i(int val=0);
+ void clearFrontBuffer_d(double val=0.0);
};
#endif
Modified: trunk/qcell/baseheaders/Neighbourhood.h
===================================================================
--- trunk/qcell/baseheaders/Neighbourhood.h 2006-11-30 12:06:33 UTC (rev 27)
+++ trunk/qcell/baseheaders/Neighbourhood.h 2006-11-30 12:21:55 UTC (rev 28)
@@ -5,22 +5,27 @@
#include <QVector>
#include <QDomElement>
#include <QDomDocument>
+#include "BaseDataTypes.h"
struct NContainer
{
int x, y, z, t;
- double dValue;
- int iValue;
- bool bValue;
+ struct DV
+ {
+ double dValue;
+ int iValue;
+ bool bValue;
+ }value;
int offset;
};
-class Neighbourhood
+class Neighbourhood : public baseDataTypes
{
private:
int dimension;
QVector<NContainer> neighbourVector;
+ DATA_TYPES dType;
protected:
public:
@@ -45,10 +50,11 @@
QString toXmlString();
int getNeighbourNumber(void);
bool getBoolValueOf(int index);
- int getInValueOf(int index);
+ int getIntValueOf(int index);
double getDoubleValueOf(int index);
- void calculateOffsets(int sizeX, int sizeY, int sizeZ, int sizeT, int dataSize);
+ void calculateOffsets(int sizeX, int sizeY, int sizeZ, int sizeT, baseDataTypes::DATA_TYPES type);
+ void resolveValues(const char *address);
};
Modified: trunk/qcell/basesources/CalculationData.cpp
===================================================================
--- trunk/qcell/basesources/CalculationData.cpp 2006-11-30 12:06:33 UTC (rev 27)
+++ trunk/qcell/basesources/CalculationData.cpp 2006-11-30 12:21:55 UTC (rev 28)
@@ -24,30 +24,30 @@
void * CalculationData::getAddressAt(int x, int y, int z, int t)
{
int dSize;
- if(dataType==CalculationData::DATA_TYPES::NONE)
+ if(dataType==baseDataTypes::DATA_TYPES::NONE)
return NULL;
switch(dataType)
{
- case CalculationData::DATA_TYPES::BOOL:
+ case baseDataTypes::DATA_TYPES::BOOL:
size = 0;
break;
- case CalculationData::DATA_TYPES::CHAR:
+ case baseDataTypes::DATA_TYPES::CHAR:
dSize = 1;
break;
- case CalculationData::DATA_TYPES::INT:
+ case baseDataTypes::DATA_TYPES::INT:
dSize = sizeof(int);
break;
- case CalculationData::DATA_TYPES::SHORT:
+ case baseDataTypes::DATA_TYPES::SHORT:
dSize = sizeof(short);
break;
- case CalculationData::DATA_TYPES::DOUBLE:
+ case baseDataTypes::DATA_TYPES::DOUBLE:
dSize = sizeof(double);
break;
- case CalculationData::DATA_TYPES::FLOAT:
+ case baseDataTypes::DATA_TYPES::FLOAT:
dSize = sizeof(float);
break;
}
@@ -58,30 +58,30 @@
void * CalculationData::getAddressAtBackBuffer(int x, int y, int z, int t)
{
int dSize;
- if(dataType==CalculationData::DATA_TYPES::NONE)
+ if(dataType==baseDataTypes::DATA_TYPES::NONE)
return NULL;
switch(dataType)
{
- case CalculationData::DATA_TYPES::BOOL:
+ case baseDataTypes::DATA_TYPES::BOOL:
size = 0;
break;
- case CalculationData::DATA_TYPES::CHAR:
+ case baseDataTypes::DATA_TYPES::CHAR:
dSize = 1;
break;
- case CalculationData::DATA_TYPES::INT:
+ case baseDataTypes::DATA_TYPES::INT:
dSize = sizeof(int);
break;
- case CalculationData::DATA_TYPES::SHORT:
+ case baseDataTypes::DATA_TYPES::SHORT:
dSize = sizeof(short);
break;
- case CalculationData::DATA_TYPES::DOUBLE:
+ case baseDataTypes::DATA_TYPES::DOUBLE:
dSize = sizeof(double);
break;
- case CalculationData::DATA_TYPES::FLOAT:
+ case baseDataTypes::DATA_TYPES::FLOAT:
dSize = sizeof(float);
break;
}
@@ -120,7 +120,7 @@
CalculationData::CalculationData()
{
- dataType = CalculationData::DATA_TYPES::NONE;
+ dataType = baseDataTypes::DATA_TYPES::NONE;
sizeX = sizeY = sizeZ = sizeT = 0;
dimension = -1;
size = -1;
@@ -131,7 +131,7 @@
CalculationData::~CalculationData()
{
- dataType = CalculationData::DATA_TYPES::NONE;
+ dataType = baseDataTypes::DATA_TYPES::NONE;
sizeX = sizeY = sizeZ = sizeT = 0;
dimension = -1;
size = -1;
@@ -151,17 +151,17 @@
{
switch(dataType)
{
- case CalculationData::DATA_TYPES::BOOL:
+ case baseDataTypes::DATA_TYPES::BOOL:
size = 0;
break;
- case CalculationData::DATA_TYPES::CHAR:
+ case baseDataTypes::DATA_TYPES::CHAR:
return *((char *)getAddressAt(x, 0, 0, 0));
- case CalculationData::DATA_TYPES::INT:
+ case baseDataTypes::DATA_TYPES::INT:
return *((int *)(getAddressAt(x, 0, 0, 0)));
- case CalculationData::DATA_TYPES::SHORT:
+ case baseDataTypes::DATA_TYPES::SHORT:
return *((short *)(getAddressAt(x, 0, 0, 0)));
}
return -1;
@@ -171,17 +171,17 @@
{
switch(dataType)
{
- case CalculationData::DATA_TYPES::BOOL:
+ case baseDataTypes::DATA_TYPES::BOOL:
size = 0;
break;
- case CalculationData::DATA_TYPES::CHAR:
+ case baseDataTypes::DATA_TYPES::CHAR:
return *((char *)getAddressAt(x, y, 0, 0));
- case CalculationData::DATA_TYPES::INT:
+ case baseDataTypes::DATA_TYPES::INT:
return *((int *)(getAddressAt(x, y, 0, 0)));
- case CalculationData::DATA_TYPES::SHORT:
+ case baseDataTypes::DATA_TYPES::SHORT:
return *((short *)(getAddressAt(x, y, 0, 0)));
}
return -1;
@@ -191,17 +191,17 @@
{
switch(dataType)
{
- case CalculationData::DATA_TYPES::BOOL:
+ case baseDataTypes::DATA_TYPES::BOOL:
size = 0;
break;
- case CalculationData::DATA_TYPES::CHAR:
+ case baseDataTypes::DATA_TYPES::CHAR:
return *((char *)getAddressAt(x, y, z, 0));
- case CalculationData::DATA_TYPES::INT:
+ case baseDataTypes::DATA_TYPES::INT:
return *((int *)(getAddressAt(x, y, z, 0)));
- case CalculationData::DATA_TYPES::SHORT:
+ case baseDataTypes::DATA_TYPES::SHORT:
return *((short *)(getAddressAt(x, y, z, 0)));
}
return -1;
@@ -211,17 +211,17 @@
{
switch(dataType)
{
- case CalculationData::DATA_TYPES::BOOL:
+ case baseDataTypes::DATA_TYPES::BOOL:
size = 0;
break;
- case CalculationData::DATA_TYPES::CHAR:
+ case baseDataTypes::DATA_TYPES::CHAR:
return *((char *)getAddressAt(x, y, z, t));
- case CalculationData::DATA_TYPES::INT:
+ case baseDataTypes::DATA_TYPES::INT:
return *((int *)(getAddressAt(x, y, z, t)));
- case CalculationData::DATA_TYPES::SHORT:
+ case baseDataTypes::DATA_TYPES::SHORT:
return *((short *)(getAddressAt(x, y, z, t)));
}
return -1;
@@ -231,19 +231,19 @@
{
switch(dataType)
{
- case CalculationData::DATA_TYPES::BOOL:
+ case baseDataTypes::DATA_TYPES::BOOL:
size = 0;
break;
- case CalculationData::DATA_TYPES::CHAR:
+ case baseDataTypes::DATA_TYPES::CHAR:
*((char *)getAddressAt(x, 0, 0, 0)) = (char)val;
break;
- case CalculationData::DATA_TYPES::INT:
+ case baseDataTypes::DATA_TYPES::INT:
*((int *)(getAddressAt(x, 0, 0, 0))) = val;
break;
- case CalculationData::DATA_TYPES::SHORT:
+ case baseDataTypes::DATA_TYPES::SHORT:
*((short *)(getAddressAt(x, 0, 0, 0))) = (short)val;
break;
}
@@ -253,19 +253,19 @@
{
switch(dataType)
{
- case CalculationData::DATA_TYPES::BOOL:
+ case baseDataTypes::DATA_TYPES::BOOL:
size = 0;
break;
- case CalculationData::DATA_TYPES::CHAR:
+ case baseDataTypes::DATA_TYPES::CHAR:
*((char *)getAddressAt(x, y, 0, 0)) = (char)val;
break;
- case CalculationData::DATA_TYPES::INT:
+ case baseDataTypes::DATA_TYPES::INT:
*((int *)(getAddressAt(x, y, 0, 0))) = val;
break;
- case CalculationData::DATA_TYPES::SHORT:
+ case baseDataTypes::DATA_TYPES::SHORT:
*((short *)(getAddressAt(x, y, 0, 0))) = (short)val;
break;
}
@@ -275,19 +275,19 @@
{
switch(dataType)
{
- case CalculationData::DATA_TYPES::BOOL:
+ case baseDataTypes::DATA_TYPES::BOOL:
size = 0;
break;
- case CalculationData::DATA_TYPES::CHAR:
+ case baseDataTypes::DATA_TYPES::CHAR:
*((char *)getAddressAt(x, y, z, 0)) = (char)val;
break;
- case CalculationData::DATA_TYPES::INT:
+ case baseDataTypes::DATA_TYPES::INT:
*((int *)(getAddressAt(x, y, z, 0))) = val;
break;
- case CalculationData::DATA_TYPES::SHORT:
+ case baseDataTypes::DATA_TYPES::SHORT:
*((short *)(getAddressAt(x, y, z, 0))) = (short)val;
break;
}
@@ -297,19 +297,19 @@
{
switch(dataType)
{
- case CalculationData::DATA_TYPES::BOOL:
+ case baseDataTypes::DATA_TYPES::BOOL:
size = 0;
break;
- case CalculationData::DATA_TYPES::CHAR:
+ case baseDataTypes::DATA_TYPES::CHAR:
*((char *)getAddressAt(x, y, z, t)) = (char)val;
break;
- case CalculationData::DATA_TYPES::INT:
+ case baseDataTypes::DATA_TYPES::INT:
*((int *)(getAddressAt(x, y, z, t))) = val;
break;
- case CalculationData::DATA_TYPES::SHORT:
+ case baseDataTypes::DATA_TYPES::SHORT:
*((short *)(getAddressAt(x, y, z, t))) = (short)val;
break;
}
@@ -319,10 +319,10 @@
{
switch(dataType)
{
- case CalculationData::DATA_TYPES::DOUBLE:
+ case baseDataTypes::DATA_TYPES::DOUBLE:
return *((double *)(getAddressAt(x, 0, 0, 0)));
- case CalculationData::DATA_TYPES::FLOAT:
+ case baseDataTypes::DATA_TYPES::FLOAT:
return *((float *)(getAddressAt(x, 0, 0, 0)));
}
return -1;
@@ -332,10 +332,10 @@
{
switch(dataType)
{
- case CalculationData::DATA_TYPES::DOUBLE:
+ case baseDataTypes::DATA_TYPES::DOUBLE:
return *((double *)(getAddressAt(x, y, 0, 0)));
- case CalculationData::DATA_TYPES::FLOAT:
+ case baseDataTypes::DATA_TYPES::FLOAT:
return *((float *)(getAddressAt(x, y, 0, 0)));
}
return -1;
@@ -345,10 +345,10 @@
{
switch(dataType)
{
- case CalculationData::DATA_TYPES::DOUBLE:
+ case baseDataTypes::DATA_TYPES::DOUBLE:
return *((double *)(getAddressAt(x, y, z, 0)));
- case CalculationData::DATA_TYPES::FLOAT:
+ case baseDataTypes::DATA_TYPES::FLOAT:
return *((float *)(getAddressAt(x, y, z, 0)));
}
return -1;
@@ -358,10 +358,10 @@
{
switch(dataType)
{
- case CalculationData::DATA_TYPES::DOUBLE:
+ case baseDataTypes::DATA_TYPES::DOUBLE:
return *((double *)(getAddressAt(x, y, z, t)));
- case CalculationData::DATA_TYPES::FLOAT:
+ case baseDataTypes::DATA_TYPES::FLOAT:
return *((float *)(getAddressAt(x, y, z, t)));
}
return -1;
@@ -371,11 +371,11 @@
{
switch(dataType)
{
- case CalculationData::DATA_TYPES::DOUBLE:
+ case baseDataTypes::DATA_TYPES::DOUBLE:
*((double *)(getAddressAt(x, 0, 0, 0))) = val;
break;
- case CalculationData::DATA_TYPES::FLOAT:
+ case baseDataTypes::DATA_TYPES::FLOAT:
*((float *)(getAddressAt(x, 0, 0, 0))) = (float)val;
break;
}
@@ -385,11 +385,11 @@
{
switch(dataType)
{
- case CalculationData::DATA_TYPES::DOUBLE:
+ case baseDataTypes::DATA_TYPES::DOUBLE:
*((double *)(getAddressAt(x, y, 0, 0))) = val;
break;
- case CalculationData::DATA_TYPES::FLOAT:
+ case baseDataTypes::DATA_TYPES::FLOAT:
*((float *)(getAddressAt(x, y, 0, 0))) = (float)val;
break;
}
@@ -399,11 +399,11 @@
{
switch(dataType)
{
- case CalculationData::DATA_TYPES::DOUBLE:
+ case baseDataTypes::DATA_TYPES::DOUBLE:
*((double *)(getAddressAt(x, y, z, 0))) = val;
break;
- case CalculationData::DATA_TYPES::FLOAT:
+ case baseDataTypes::DATA_TYPES::FLOAT:
*((float *)(getAddressAt(x, y, z, 0))) = (float)val;
break;
}
@@ -413,11 +413,11 @@
{
switch(dataType)
{
- case CalculationData::DATA_TYPES::DOUBLE:
+ case baseDataTypes::DATA_TYPES::DOUBLE:
*((double *)(getAddressAt(x, y, z, t))) = val;
break;
- case CalculationData::DATA_TYPES::FLOAT:
+ case baseDataTypes::DATA_TYPES::FLOAT:
*((float *)(getAddressAt(x, y, z, t))) = (float)val;
break;
}
@@ -429,33 +429,33 @@
size = -1;
switch(dataType)
{
- case CalculationData::DATA_TYPES::BOOL:
+ case baseDataTypes::DATA_TYPES::BOOL:
size = 0;
break;
- case CalculationData::DATA_TYPES::CHAR:
+ case baseDataTypes::DATA_TYPES::CHAR:
size = 1;
break;
- case CalculationData::DATA_TYPES::DOUBLE:
+ case baseDataTypes::DATA_TYPES::DOUBLE:
size = sizeof(double);
break;
- case CalculationData::DATA_TYPES::FLOAT:
+ case baseDataTypes::DATA_TYPES::FLOAT:
size = sizeof(float);
break;
- case CalculationData::DATA_TYPES::INT:
+ case baseDataTypes::DATA_TYPES::INT:
size = sizeof(int);
break;
- case CalculationData::DATA_TYPES::SHORT:
+ case baseDataTypes::DATA_TYPES::SHORT:
size = sizeof(short);
break;
}
}
-CalculationData::DATA_TYPES CalculationData::getDataType(void)
+baseDataTypes::DATA_TYPES CalculationData::getDataType(void)
{
return dataType;
}
@@ -528,10 +528,10 @@
{
switch(dataType)
{
- case CalculationData::DATA_TYPES::BOOL:
+ case baseDataTypes::DATA_TYPES::BOOL:
return (sizeX * sizeY * sizeZ * sizeT)/8;
- case CalculationData::DATA_TYPES::CHAR:
+ case baseDataTypes::DATA_TYPES::CHAR:
switch(dimension)
{
case 1:
@@ -544,7 +544,7 @@
return sizeX * sizeY * sizeZ * sizeT;
}
- case CalculationData::DATA_TYPES::DOUBLE:
+ case baseDataTypes::DATA_TYPES::DOUBLE:
switch(dimension)
{
case 1:
@@ -557,7 +557,7 @@
return sizeX * sizeY * sizeZ * sizeT * sizeof(double);
}
- case CalculationData::DATA_TYPES::FLOAT:
+ case baseDataTypes::DATA_TYPES::FLOAT:
switch(dimension)
{
case 1:
@@ -570,7 +570,7 @@
return sizeX * sizeY * sizeZ * sizeT * sizeof(float);
}
- case CalculationData::DATA_TYPES::INT:
+ case baseDataTypes::DATA_TYPES::INT:
switch(dimension)
{
case 1:
@@ -583,7 +583,7 @@
return sizeX * sizeY * sizeZ * sizeT * sizeof(int);
}
- case CalculationData::DATA_TYPES::SHORT:
+ case baseDataTypes::DATA_TYPES::SHORT:
switch(dimension)
{
case 1:
@@ -794,27 +794,27 @@
}
switch(dataType)
{
- case CalculationData::DATA_TYPES::BOOL:
+ case baseDataTypes::DATA_TYPES::BOOL:
element.setAttribute("ContentType", "bool");
break;
- case CalculationData::DATA_TYPES::CHAR:
+ case baseDataTypes::DATA_TYPES::CHAR:
element.setAttribute("ContentType", "char");
break;
- case CalculationData::DATA_TYPES::DOUBLE:
+ case baseDataTypes::DATA_TYPES::DOUBLE:
element.setAttribute("ContentType", "double");
break;
- case CalculationData::DATA_TYPES::FLOAT:
+ case baseDataTypes::DATA_TYPES::FLOAT:
element.setAttribute("ContentType", "float");
break;
- case CalculationData::DATA_TYPES::INT:
+ case baseDataTypes::DATA_TYPES::INT:
element.setAttribute("ContentType", "bool");
break;
- case CalculationData::DATA_TYPES::SHORT:
+ case baseDataTypes::DATA_TYPES::SHORT:
element.setAttribute("ContentType", "short");
break;
}
@@ -870,22 +870,22 @@
if(element.tagName()=="Data")
{
if(element.attribute("ContentType")=="bool")
- setDataType(CalculationData::DATA_TYPES::BOOL);
+ setDataType(baseDataTypes::DATA_TYPES::BOOL);
else
if(element.attribute("ContentType")=="char")
- setDataType(CalculationData::DATA_TYPES::CHAR);
+ setDataType(baseDataTypes::DATA_TYPES::CHAR);
else
if(element.attribute("ContentType")=="double")
- setDataType(CalculationData::DATA_TYPES::DOUBLE);
+ setDataType(baseDataTypes::DATA_TYPES::DOUBLE);
else
if(element.attribute("ContentType")=="float")
- setDataType(CalculationData::DATA_TYPES::FLOAT);
+ setDataType(baseDataTypes::DATA_TYPES::FLOAT);
else
if(element.attribute("ContentType")=="int")
- setDataType(CalculationData::DATA_TYPES::INT);
+ setDataType(baseDataTypes::DATA_TYPES::INT);
else
if(element.attribute("ContentType")=="short")
- setDataType(CalculationData::DATA_TYPES::SHORT);
+ setDataType(baseDataTypes::DATA_TYPES::SHORT);
if(element.hasAttribute("t"))
resize(element.attribute("t").toInt(), element.attribute("z").toInt(), element.attribute("y").toInt(), element.attribute("x").toInt());
@@ -939,19 +939,19 @@
{
switch(dataType)
{
- case CalculationData::DATA_TYPES::BOOL:
+ case baseDataTypes::DATA_TYPES::BOOL:
size = 0;
break;
- case CalculationData::DATA_TYPES::CHAR:
+ case baseDataTypes::DATA_TYPES::CHAR:
*((char *)getAddressAtBackBuffer(x, 0, 0, 0)) = (char)val;
break;
- case CalculationData::DATA_TYPES::INT:
+ case baseDataTypes::DATA_TYPES::INT:
*((int *)(getAddressAtBackBuffer(x, 0, 0, 0))) = val;
break;
- case CalculationData::DATA_TYPES::SHORT:
+ case baseDataTypes::DATA_TYPES::SHORT:
*((short *)(getAddressAtBackBuffer(x, 0, 0, 0))) = (short)val;
break;
}
@@ -961,19 +961,19 @@
{
switch(dataType)
{
- case CalculationData::DATA_TYPES::BOOL:
+ case baseDataTypes::DATA_TYPES::BOOL:
size = 0;
break;
- case CalculationData::DATA_TYPES::CHAR:
+ case baseDataTypes::DATA_TYPES::CHAR:
*((char *)getAddressAtBackBuffer(x, y, 0, 0)) = (char)val;
break;
- case CalculationData::DATA_TYPES::INT:
+ case baseDataTypes::DATA_TYPES::INT:
*((int *)(getAddressAtBackBuffer(x, y, 0, 0))) = val;
break;
- case CalculationData::DATA_TYPES::SHORT:
+ case baseDataTypes::DATA_TYPES::SHORT:
*((short *)(getAddressAtBackBuffer(x, y, 0, 0))) = (short)val;
break;
}
@@ -983,19 +983,19 @@
{
switch(dataType)
{
- case CalculationData::DATA_TYPES::BOOL:
+ case baseDataTypes::DATA_TYPES::BOOL:
size = 0;
break;
- case CalculationData::DATA_TYPES::CHAR:
+ case baseDataTypes::DATA_TYPES::CHAR:
*((char *)getAddressAtBackBuffer(x, y, z, 0)) = (char)val;
break;
- case CalculationData::DATA_TYPES::INT:
+ case baseDataTypes::DATA_TYPES::INT:
*((int *)(getAddressAtBackBuffer(x, y, z, 0))) = val;
break;
- case CalculationData::DATA_TYPES::SHORT:
+ case baseDataTypes::DATA_TYPES::SHORT:
*((short *)(getAddressAtBackBuffer(x, y, z, 0))) = (short)val;
break;
}
@@ -1005,19 +1005,19 @@
{
switch(dataType)
{
- case CalculationData::DATA_TYPES::BOOL:
+ case baseDataTypes::DATA_TYPES::BOOL:
size = 0;
break;
- case CalculationData::DATA_TYPES::CHAR:
+ case baseDataTypes::DATA_TYPES::CHAR:
*((char *)getAddressAtBackBuffer(x, y, z, t)) = (char)val;
break;
- case CalculationData::DATA_TYPES::INT:
+ case baseDataTypes::DATA_TYPES::INT:
*((int *)(getAddressAtBackBuffer(x, y, z, t))) = val;
break;
- case CalculationData::DATA_TYPES::SHORT:
+ case baseDataTypes::DATA_TYPES::SHORT:
*((short *)(getAddressAtBackBuffer(x, y, z, t))) = (short)val;
break;
}
@@ -1027,11 +1027,11 @@
{
switch(dataType)
{
- case CalculationData::DATA_TYPES::DOUBLE:
+ case baseDataTypes::DATA_TYPES::DOUBLE:
*((double *)(getAddressAtBackBuffer(x, 0, 0, 0))) = val;
break;
- case CalculationData::DATA_TYPES::FLOAT:
+ case baseDataTypes::DATA_TYPES::FLOAT:
*((float *)(getAddressAtBackBuffer(x, 0, 0, 0))) = (float)val;
break;
}
@@ -1041,11 +1041,11 @@
{
switch(dataType)
{
- case CalculationData::DATA_TYPES::DOUBLE:
+ case baseDataTypes::DATA_TYPES::DOUBLE:
*((double *)(getAddressAtBackBuffer(x, y, 0, 0))) = val;
break;
- case CalculationData::DATA_TYPES::FLOAT:
+ case baseDataTypes::DATA_TYPES::FLOAT:
*((float *)(getAddressAtBackBuffer(x, y, 0, 0))) = (float)val;
break;
}
@@ -1055,11 +1055,11 @@
{
switch(dataType)
{
- case CalculationData::DATA_TYPES::DOUBLE:
+ case baseDataTypes::DATA_TYPES::DOUBLE:
*((double *)(getAddressAtBackBuffer(x, y, z, 0))) = val;
break;
- case CalculationData::DATA_TYPES::FLOAT:
+ case baseDataTypes::DATA_TYPES::FLOAT:
*((float *)(getAddressAtBackBuffer(x, y, z, 0))) = (float)val;
break;
}
@@ -1069,13 +1069,68 @@
{
switch(dataType)
{
- case CalculationData::DATA_TYPES::DOUBLE:
+ case baseDataTypes::DATA_TYPES::DOUBLE:
*((double *)(getAddressAtBackBuffer(x, y, z, t))) = val;
break;
- case CalculationData::DATA_TYPES::FLOAT:
+ case baseDataTypes::DATA_TYPES::FLOAT:
*((float *)(getAddressAtBackBuffer(x, y, z, t))) = (float)val;
break;
}
}
+void CalculationData::clearFrontBuffer_i(int val)
+{
+ int dSize;
+ switch(dataType)
+ {
+ case baseDataTypes::DATA_TYPES::BOOL:
+ break;
+
+ case baseDataTypes::DATA_TYPES::CHAR:
+ dSize = sizeof(char);
+ for(int i=0;i<getSizeInByte();i+=dSize)
+ {
+ *((char *)(data + i)) = (char)val;
+ }
+ break;
+
+ case baseDataTypes::DATA_TYPES::INT:
+ dSize = sizeof(int);
+ for(int i=0;i<getSizeInByte();i+=dSize)
+ {
+ *((int *)(data + i)) = val;
+ }
+ break;
+
+ case baseDataTypes::DATA_TYPES::SHORT:
+ dSize = sizeof(short);
+ for(int i=0;i<getSizeInByte();i+=dSize)
+ {
+ *((short *)(data + i)) = (short)val;
+ }
+ break;
+ }
+}
+
+void CalculationData::clearFrontBuffer_d(double val)
+{
+ int dSize;
+ switch(dataType)
+ {
+ case baseDataTypes::DATA_TYPES::DOUBLE:
+ dSize = sizeof(double);
+ for(int i=0;i<getSizeInByte();i+=dSize)
+ {
+ *((double *)(data + i)) = val;
+ }
+ break;
+ case baseDataTypes::DATA_TYPES::FLOAT:
+ dSize = sizeof(float);
+ for(int i=0;i<getSizeInByte();i+=dSize)
+ {
+ *((float *)(data + i)) = (float)val;
+ }
+ break;
+ }
+}
Modified: trunk/qcell/basesources/Neighbourhood.cpp
===================================================================
--- trunk/qcell/basesources/Neighbourhood.cpp 2006-11-30 12:06:33 UTC (rev 27)
+++ trunk/qcell/basesources/Neighbourhood.cpp 2006-11-30 12:21:55 UTC (rev 28)
@@ -14,6 +14,9 @@
{
NContainer temp;
temp.x = x;
+ temp.y = 0;
+ temp.z = 0;
+ temp.t = 0;
neighbourVector << temp;
dimension = 1;
}
@@ -23,6 +26,8 @@
NContainer temp;
temp.x = x;
temp.y = y;
+ temp.z = 0;
+ temp.t = 0;
neighbourVector << temp;
if(dimension>2)
dimension = 2;
@@ -33,6 +38,7 @@
temp.x = x;
temp.y = y;
temp.z = z;
+ temp.t = 0;
neighbourVector << temp;
if(dimension>3)
dimension = 3;
@@ -214,23 +220,100 @@
bool Neighbourhood::getBoolValueOf(int index)
{
- return neighbourVector[index].bValue;
+ return neighbourVector[index].value.bValue;
}
-int Neighbourhood::getInValueOf(int index)
+int Neighbourhood::getIntValueOf(int index)
{
- return neighbourVector[index].iValue;
+ return neighbourVector[index].value.iValue;
}
double Neighbourhood::getDoubleValueOf(int index)
{
- return neighbourVector[index].dValue;
+ return neighbourVector[index].value.dValue;
}
-void Neighbourhood::calculateOffsets(int sizeX, int sizeY, int sizeZ, int sizeT, int dataSize)
+void Neighbourhood::calculateOffsets(int sizeX, int sizeY, int sizeZ, int sizeT, baseDataTypes::DATA_TYPES type)
{
+ int dataSize=0;
+ dType = type;
+ switch(dType)
+ {
+ case baseDataTypes::DATA_TYPES::BOOL:
+ break;
+
+ case baseDataTypes::DATA_TYPES::CHAR:
+ dataSize = sizeof(char);
+ break;
+ case baseDataTypes::DATA_TYPES::DOUBLE:
+ dataSize = sizeof(double);
+ break;
+ case baseDataTypes::DATA_TYPES::FLOAT:
+ dataSize = sizeof(float);
+ break;
+ case baseDataTypes::DATA_TYPES::INT:
+ dataSize = sizeof(int);
+ break;
+ case baseDataTypes::DATA_TYPES::SHORT:
+ dataSize = sizeof(short);
+ break;
+ }
+
+ int h;
+ int a, b, c, d;
+
for(int i=0;i<neighbourVector.size();i++)
{
- neighbourVector[i].offset = dataSize * (neighbourVector[i].x + neighbourVector[i].y * sizeX + neighbourVector[i].z * sizeX * sizeY + neighbourVector[i].t * sizeX * sizeY * sizeZ);
+ a = neighbourVector[i].x;
+ b = neighbourVector[i].y;
+ c = neighbourVector[i].z;
+ d = neighbourVector[i].t;
+ h = dataSize * (neighbourVector[i].x + neighbourVector[i].y * sizeX + neighbourVector[i].z * sizeX * sizeY + neighbourVector[i].t * sizeX * sizeY * sizeZ);
+ neighbourVector[i].offset = h;
}
}
+
+void Neighbourhood::resolveValues(const char *address)
+{
+ int i;
+ switch(dType)
+ {
+ case baseDataTypes::DATA_TYPES::BOOL:
+ break;
+
+ case baseDataTypes::DATA_TYPES::CHAR:
+ for(i=0;i<neighbourVector.size();++i)
+ {
+ neighbourVector[i].value.iValue = *((char *)(address + neighbourVector[i].offset));
+ }
+ break;
+
+ case baseDataTypes::DATA_TYPES::DOUBLE:
+ for(i=0;i<neighbourVector.size();++i)
+ {
+ neighbourVector[i].value.dValue = *((double *)(address + neighbourVector[i].offset));
+ }
+ break;
+
+ case baseDataTypes::DATA_TYPES::FLOAT:
+ for(i=0;i<neighbourVector.size();++i)
+ {
+ neighbourVector[i].value.dValue = *((float *)(address + neighbourVector[i].offset));
+ }
+ break;
+
+ case baseDataTypes::DATA_TYPES::INT:
+ for(i=0;i<neighbourVector.size();++i)
+ {
+ neighbourVector[i].value.iValue = *((int *)(address + neighbourVector[i].offset));
+ }
+ break;
+
+ case baseDataTypes::DATA_TYPES::SHORT:
+ for(i=0;i<neighbourVector.size();++i)
+ {
+ neighbourVector[i].value.iValue = *((short *)(address + neighbourVector[i].offset));
+ }
+ break;
+ }
+}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <le...@us...> - 2006-11-30 13:12:48
|
Revision: 32
http://svn.sourceforge.net/qcell/?rev=32&view=rev
Author: lessm
Date: 2006-11-30 05:12:45 -0800 (Thu, 30 Nov 2006)
Log Message:
-----------
- Neighbourhood class have QVector<int> arguments support
Modified Paths:
--------------
trunk/qcell/baseheaders/Neighbourhood.h
trunk/qcell/basesources/Neighbourhood.cpp
Modified: trunk/qcell/baseheaders/Neighbourhood.h
===================================================================
--- trunk/qcell/baseheaders/Neighbourhood.h 2006-11-30 12:58:08 UTC (rev 31)
+++ trunk/qcell/baseheaders/Neighbourhood.h 2006-11-30 13:12:45 UTC (rev 32)
@@ -10,7 +10,7 @@
struct NContainer
{
int x, y, z, t;
- struct DV
+ union DV
{
double dValue;
int iValue;
@@ -36,11 +36,13 @@
void addNeighbour(int x, int y);
void addNeighbour(int x, int y, int z);
void addNeighbour(int x, int y, int z, int t);
+ void addNeighbour(QVector<int> v);
void setNeighbourAt(int index, int x);
void setNeighbourAt(int index, int x, int y);
void setNeighbourAt(int index, int x, int y, int z);
void setNeighbourAt(int index, int x, int y, int z, int t);
+ void setNeighbourAt(int index, QVector<int> v);
void clearNeighbourhood(void);
int getDimension(void);
Modified: trunk/qcell/basesources/Neighbourhood.cpp
===================================================================
--- trunk/qcell/basesources/Neighbourhood.cpp 2006-11-30 12:58:08 UTC (rev 31)
+++ trunk/qcell/basesources/Neighbourhood.cpp 2006-11-30 13:12:45 UTC (rev 32)
@@ -56,6 +56,28 @@
dimension = 4;
}
+void Neighbourhood::addNeighbour(QVector<int> v)
+{
+ switch(v.size())
+ {
+ case 1:
+ addNeighbour(v[0]);
+ break;
+ case 2:
+ addNeighbour(v[0], v[1]);
+ break;
+ case 3:
+ addNeighbour(v[0], v[1], v[2]);
+ break;
+ case 4:
+ addNeighbour(v[0], v[1], v[2], v[3]);
+ break;
+ default:
+ if(v.size()>4)
+ addNeighbour(v[0], v[1], v[2], v[3]);
+ }
+}
+
void Neighbourhood::setNeighbourAt(int index, int x)
{
if(neighbourVector.size()>index)
@@ -91,6 +113,27 @@
neighbourVector[index].t = t;
}
}
+void Neighbourhood::setNeighbourAt(int index, QVector<int> v)
+{
+ switch(v.size())
+ {
+ case 1:
+ setNeighbourAt(index, v[0]);
+ break;
+ case 2:
+ setNeighbourAt(index, v[0], v[1]);
+ break;
+ case 3:
+ setNeighbourAt(index, v[0], v[1], v[2]);
+ break;
+ case 4:
+ setNeighbourAt(index, v[0], v[1], v[2], v[3]);
+ break;
+ default:
+ if(v.size()>4)
+ setNeighbourAt(index, v[0], v[1], v[2], v[3]);
+ }
+}
void Neighbourhood::clearNeighbourhood(void)
{
@@ -316,4 +359,4 @@
}
break;
}
-}
\ No newline at end of file
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dhu...@us...> - 2006-12-01 13:11:57
|
Revision: 45
http://svn.sourceforge.net/qcell/?rev=45&view=rev
Author: dhubleizh
Date: 2006-12-01 05:11:52 -0800 (Fri, 01 Dec 2006)
Log Message:
-----------
- an ide to use GenericParserPlugin which partially implements the ParserInterface
- eases the writting of plugins
- KIParserPlugin as an example of how to use the 'new' way
- this implies of partially rewritting two other plugins (NParserPlugin and FQTParserPlugin)
Modified Paths:
--------------
trunk/qcell/baseheaders/interfaces.h
trunk/qcell/parsers/KI/KIParserPlugin.cpp
trunk/qcell/parsers/KI/KIParserPlugin.h
Added Paths:
-----------
trunk/qcell/baseheaders/GenericParserPlugin.h
Added: trunk/qcell/baseheaders/GenericParserPlugin.h
===================================================================
--- trunk/qcell/baseheaders/GenericParserPlugin.h (rev 0)
+++ trunk/qcell/baseheaders/GenericParserPlugin.h 2006-12-01 13:11:52 UTC (rev 45)
@@ -0,0 +1,38 @@
+/**@file GenericParserPlugin.h
+ * @author czarny
+ * @version 0.1
+ * @date
+ * Created: pi? 01 gru 2006 13:33:00 CET \n
+ * Last Update: pi? 01 gru 2006 13:33:00 CET
+ */
+
+#ifndef __GENERICPARSERPLUGIN_H__
+#define __GENERICPARSERPLUGIN_H__
+
+#include "interfaces.h"
+
+class GenericParserPlugin : public QObject, public ParserInterface
+{
+ Q_OBJECT
+ Q_INTERFACES(ParserInterface)
+
+protected:
+ /// A list defined by each plugin of supported plugin types
+ QStringList supported_parser_types;
+ /// A list defined by each plugin of supported file types
+ QStringList supported_file_types;
+
+public:
+ inline QStringList parserTypes() const
+ {
+ return supported_parser_types;
+ };
+// inline QStringList fileTypes(const QString type) const
+// {
+// return supported_file_types;
+// }
+
+};
+
+#endif
+
Modified: trunk/qcell/baseheaders/interfaces.h
===================================================================
--- trunk/qcell/baseheaders/interfaces.h 2006-12-01 12:29:35 UTC (rev 44)
+++ trunk/qcell/baseheaders/interfaces.h 2006-12-01 13:11:52 UTC (rev 45)
@@ -10,6 +10,7 @@
#ifndef __INTERFACES_H__
#define __INTERFACES_H__
+#include <QtPlugin>
#include <QByteArray>
#include <QString>
#include <QStringList>
Modified: trunk/qcell/parsers/KI/KIParserPlugin.cpp
===================================================================
--- trunk/qcell/parsers/KI/KIParserPlugin.cpp 2006-12-01 12:29:35 UTC (rev 44)
+++ trunk/qcell/parsers/KI/KIParserPlugin.cpp 2006-12-01 13:11:52 UTC (rev 45)
@@ -1,33 +1,18 @@
-/**@file KIParserPlugin.c
+/**@file KIParserPlugin.cpp
* @author czarny
* @version 0.1
* @date
* Created: pi\xB1 gru 1 13:23:27 CET 2006 \n
* Last Update: pi\xB1 gru 1 13:23:39 CET 2006
*/
+
#include "KIParserPlugin.h"
-
-QStringList KIParserPlugin::parserTypes() const
+KIParserPlugin::KIParserPlugin()
{
- return QStringList(FQT_PARSER_TYPE);
-}
+ supported_parser_types << "World";
+ supported_file_types << "KI";
-QStringList KIParserPlugin::fileTypes(const QString type) const
-{
- if(type == FQT_PARSER_TYPE)
- {
- return QStringList(FQT_PARSER_TYPE);
- }
- else {
-
- qDebug(tr("This plugin doesn't support type %1.")
- .arg(type)
- .toAscii()
- );
-
- return QStringList();
- }
}
/// @todo Incorporate genreal Function file to output resulting XML
@@ -41,17 +26,18 @@
// Parameters from the file header
// If we're asked by accident to parse a file not supported by the plugin
- if(type != FQT_PARSER_TYPE)
- {
- qDebug(tr("The pluginn has been asked to parse a file type (%1) different from declared one (%2).")
- .arg(type)
- .arg(FQT_PARSER_TYPE)
- .toAscii()
- );
+ /// @todo redefine it the 'new' way
+// if(type != FQT_PARSER_TYPE)
+// {
+// qDebug(tr("The pluginn has been asked to parse a file type (%1) different from declared one (%2).")
+// .arg(type)
+// .arg(FQT_PARSER_TYPE)
+// .toAscii()
+// );
+//
+// return QString();
+// }
- return QString();
- }
-
// Basic sanity check
lines = QString(content).split('\n');
if(lines.count() < 1)
Modified: trunk/qcell/parsers/KI/KIParserPlugin.h
===================================================================
--- trunk/qcell/parsers/KI/KIParserPlugin.h 2006-12-01 12:29:35 UTC (rev 44)
+++ trunk/qcell/parsers/KI/KIParserPlugin.h 2006-12-01 13:11:52 UTC (rev 45)
@@ -9,25 +9,17 @@
#ifndef __KIPARSERPLUGIN_H__
#define __KIPARSERPLUGIN_H__
-#include <QObject>
-#include <QtPlugin>
-#include <QStringList>
-#include <QString>
-#include <QByteArray>
#include <QVector>
#include <QMap>
-#include "interfaces.h"
+#include "GenericParserPlugin.h"
//#include "Neighbourhood.h"
-#define FQT_PARSER_TYPE "World"
-
-class KIParserPlugin : public QObject, public ParserInterface
+class KIParserPlugin : public GenericParserPlugin
{
- Q_OBJECT
- Q_INTERFACES(ParserInterface)
-
public:
+ KIParserPlugin();
+
QStringList parserTypes() const;
QStringList fileTypes(const QString type) const;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dhu...@us...> - 2006-12-01 13:22:18
|
Revision: 46
http://svn.sourceforge.net/qcell/?rev=46&view=rev
Author: dhubleizh
Date: 2006-12-01 05:22:13 -0800 (Fri, 01 Dec 2006)
Log Message:
-----------
- additional tweaking of the GenericPlugin class
- some docs to ease the writting
- some more KIParserPlugin twaeking
Modified Paths:
--------------
trunk/qcell/baseheaders/GenericParserPlugin.h
trunk/qcell/parsers/KI/KIParserPlugin.h
Modified: trunk/qcell/baseheaders/GenericParserPlugin.h
===================================================================
--- trunk/qcell/baseheaders/GenericParserPlugin.h 2006-12-01 13:11:52 UTC (rev 45)
+++ trunk/qcell/baseheaders/GenericParserPlugin.h 2006-12-01 13:22:13 UTC (rev 46)
@@ -23,15 +23,38 @@
QStringList supported_file_types;
public:
+ /**
+ * @brief What types of parsing does this plugin do
+ *
+ * @return A list of plugin types provided by this plugin
+ */
inline QStringList parserTypes() const
{
return supported_parser_types;
- };
-// inline QStringList fileTypes(const QString type) const
-// {
-// return supported_file_types;
-// }
+ }
+ /**
+ * @brief Which file types this plugin parses
+ *
+ * @param type The type of plugin to output results for
+ *
+ * @return A list of file types (extensions) parsed by this plugin
+ */
+ inline QStringList fileTypes(const QString type) const
+ {
+ if(supported_parser_types.contains(type))
+ {
+ return supported_file_types;
+ }
+ else {
+ qDebug(tr("The plugin type %1 is not supported by this plugin.")
+ .arg(type)
+ .toAscii()
+ );
+ return QStringList();
+ }
+ }
+
};
#endif
Modified: trunk/qcell/parsers/KI/KIParserPlugin.h
===================================================================
--- trunk/qcell/parsers/KI/KIParserPlugin.h 2006-12-01 13:11:52 UTC (rev 45)
+++ trunk/qcell/parsers/KI/KIParserPlugin.h 2006-12-01 13:22:13 UTC (rev 46)
@@ -20,9 +20,6 @@
public:
KIParserPlugin();
- QStringList parserTypes() const;
- QStringList fileTypes(const QString type) const;
-
QString parse(const QByteArray content, const QString type);
};
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <le...@us...> - 2006-12-01 17:27:37
|
Revision: 47
http://svn.sourceforge.net/qcell/?rev=47&view=rev
Author: lessm
Date: 2006-12-01 09:27:34 -0800 (Fri, 01 Dec 2006)
Log Message:
-----------
- LocalFunction class added
Added Paths:
-----------
trunk/qcell/baseheaders/LocalFunction.h
trunk/qcell/basesources/LocalFunction.cpp
Added: trunk/qcell/baseheaders/LocalFunction.h
===================================================================
--- trunk/qcell/baseheaders/LocalFunction.h (rev 0)
+++ trunk/qcell/baseheaders/LocalFunction.h 2006-12-01 17:27:34 UTC (rev 47)
@@ -0,0 +1,70 @@
+#ifndef _LOCAL_FUNCTION_H
+#define _LOCAL_FUNCTION_H
+
+#include <QVector>
+#include <QString>
+
+#include <math.h>
+
+class LocalFunction
+{
+
+public:
+
+ enum FUNCTION_TYPE
+ {
+ SWITCH,
+ SUM,
+ MIXED_SUM_SWITCH,
+ PRODUCT,
+ MIXED_PRODUCT_SWITCH,
+ SCRIPT
+ };
+
+private:
+ QVector<int> valueTable;
+ QVector<int> sumArguments;
+ QVector<int> productArguments;
+ QVector<int> freeArguments;
+ FUNCTION_TYPE functionMode;
+ int numArg, maxArgVal;
+ QString script;
+
+protected:
+ void resizeValueTable(void);
+public:
+
+ LocalFunction();
+ ~LocalFunction();
+
+ void inti(int numberOfArguments, int AlphabetSize);
+
+ // args is vector contein index of arguments to sum
+ void setSumArguments(QVector<int> args);
+
+ void setProductArguments(QVector<int> args);
+
+ void setSwitchFunction(void);
+
+ //
+ void setScript(QString scriptData);
+
+ // method set type of function (normally function type is set automatically when setSumArguments, setProductArguments, setSwitchFunction or setScript methosd ar used)
+ void setFunctonType(LocalFunction::FUNCTION_TYPE type);
+ LocalFunction::FUNCTION_TYPE getFunctonType(void);
+
+ int addFunctionValueArgumentsNumberRequest(void);
+
+ // fill value table with val
+ void setDefaultValue(int val);
+
+ // first value is sum or product if function have sum or product arguments
+ //
+ bool addFunctionValue(int value, QVector<int> args);
+
+ int resolve(QVector<int> arg);
+
+ double resolve(QVector<double> arg);
+};
+
+#endif
Added: trunk/qcell/basesources/LocalFunction.cpp
===================================================================
--- trunk/qcell/basesources/LocalFunction.cpp (rev 0)
+++ trunk/qcell/basesources/LocalFunction.cpp 2006-12-01 17:27:34 UTC (rev 47)
@@ -0,0 +1,218 @@
+#include "../baseheaders/LocalFunction.h"
+
+void LocalFunction::resizeValueTable(void)
+{
+ switch(functionMode)
+ {
+ case LocalFunction::FUNCTION_TYPE::SUM:
+ case LocalFunction::FUNCTION_TYPE::PRODUCT:
+ valueTable.resize(maxArgVal);
+ break;
+
+ case LocalFunction::FUNCTION_TYPE::MIXED_SUM_SWITCH:
+ valueTable.resize(freeArguments.size() * maxArgVal * (sumArguments.size() * (maxArgVal - 1) + 1));
+ break;
+
+ case LocalFunction::FUNCTION_TYPE::MIXED_PRODUCT_SWITCH:
+ valueTable.resize(freeArguments.size() * maxArgVal * (pow(maxArgVal - 1, productArguments.size()) + 1));
+ break;
+
+ case LocalFunction::FUNCTION_TYPE::SWITCH:
+ valueTable.resize(numArg * maxArgVal);
+ break;
+ }
+}
+
+LocalFunction::LocalFunction()
+{
+ functionMode = LocalFunction::FUNCTION_TYPE::SWITCH;
+}
+
+LocalFunction::~LocalFunction()
+{
+ functionMode = LocalFunction::FUNCTION_TYPE::SWITCH;
+}
+
+void LocalFunction::inti(int numberOfArguments, int AlphabetSize)
+{
+ numArg = numberOfArguments;
+ maxArgVal = AlphabetSize;
+}
+
+void LocalFunction::setSumArguments(QVector<int> arg)
+{
+ if(arg.size()<=numArg)
+ {
+ sumArguments = arg;
+ freeArguments.clear();
+ valueTable.clear();
+ for(int i=0;i<numArg;++i)
+ if(!sumArguments.contains(i))
+ freeArguments<<i;
+
+ if(freeArguments.size()==0)
+ functionMode = LocalFunction::FUNCTION_TYPE::SUM;
+ else
+ if(freeArguments.size()==numArg)
+ functionMode = LocalFunction::FUNCTION_TYPE::SWITCH;
+ else
+ functionMode = LocalFunction::FUNCTION_TYPE::MIXED_SUM_SWITCH;
+ }
+}
+
+void LocalFunction::setProductArguments(QVector<int> arg)
+{
+ if(arg.size()<=numArg)
+ {
+ productArguments = arg;
+ freeArguments.clear();
+ valueTable.clear();
+ for(int i=0;i<numArg;++i)
+ if(!productArguments.contains(i))
+ freeArguments<<i;
+ if(freeArguments.size()==0)
+ functionMode = LocalFunction::FUNCTION_TYPE::PRODUCT;
+ else
+ if(freeArguments.size()==numArg)
+ functionMode = LocalFunction::FUNCTION_TYPE::SWITCH;
+ else
+ functionMode = LocalFunction::FUNCTION_TYPE::MIXED_PRODUCT_SWITCH;
+ }
+}
+
+void LocalFunction::setSwitchFunction(void)
+{
+ functionMode = LocalFunction::FUNCTION_TYPE::SWITCH;
+}
+
+void LocalFunction::setScript(QString scriptData)
+{
+ script = scriptData;
+ functionMode = LocalFunction::FUNCTION_TYPE::SCRIPT;
+}
+
+void LocalFunction::setFunctonType(LocalFunction::FUNCTION_TYPE type)
+{
+ functionMode = type;
+}
+
+LocalFunction::FUNCTION_TYPE LocalFunction::getFunctonType(void)
+{
+ return functionMode;
+}
+
+int LocalFunction::addFunctionValueArgumentsNumberRequest(void)
+{
+ switch(functionMode)
+ {
+ case LocalFunction::FUNCTION_TYPE::SUM:
+ case LocalFunction::FUNCTION_TYPE::PRODUCT:
+ return 1;
+
+ case LocalFunction::FUNCTION_TYPE::MIXED_SUM_SWITCH:
+ case LocalFunction::FUNCTION_TYPE::MIXED_PRODUCT_SWITCH:
+ return freeArguments.size() + 1;
+
+ case LocalFunction::FUNCTION_TYPE::SWITCH:
+ return freeArguments.size();
+ }
+
+ return 0;
+}
+
+void LocalFunction::setDefaultValue(int val)
+{
+ if(valueTable.empty())
+ resizeValueTable();
+ if(val < 0)
+ val = 0;
+ if(val > maxArgVal - 1)
+ val = maxArgVal - 1;
+
+ valueTable.fill(val);
+}
+
+
+
+bool LocalFunction::addFunctionValue(int value, QVector<int> args)
+{
+ int i, index = 0;
+ if(valueTable.empty())
+ resizeValueTable();
+ switch(functionMode)
+ {
+ case LocalFunction::FUNCTION_TYPE::SUM:
+ case LocalFunction::FUNCTION_TYPE::PRODUCT:
+ index = args[0];
+ break;
+
+ case LocalFunction::FUNCTION_TYPE::MIXED_SUM_SWITCH:
+ case LocalFunction::FUNCTION_TYPE::MIXED_PRODUCT_SWITCH:
+ for(i=0;i<freeArguments.size();++i)
+ index += args[i+1] * pow(maxArgVal, i);
+ index *= args[0];
+ break;
+
+ case LocalFunction::FUNCTION_TYPE::SWITCH:
+ for(i=0;i<numArg;++i)
+ index += args[i] * pow(maxArgVal, i);
+ break;
+ }
+ valueTable[index] = value;
+ return 1;
+}
+
+int LocalFunction::resolve(QVector<int> args)
+{
+ int i, index = 0;
+ if(valueTable.empty())
+ resizeValueTable();
+ if(functionMode==LocalFunction::FUNCTION_TYPE::SCRIPT)
+ return -1;
+
+ switch(functionMode)
+ {
+ case LocalFunction::FUNCTION_TYPE::SUM:
+ case LocalFunction::FUNCTION_TYPE::PRODUCT:
+ index = args[0];
+ break;
+
+ case LocalFunction::FUNCTION_TYPE::MIXED_SUM_SWITCH:
+ case LocalFunction::FUNCTION_TYPE::MIXED_PRODUCT_SWITCH:
+ for(i=0;i<freeArguments.size();++i)
+ index += args[i+1] * pow(maxArgVal, i);
+ index *= args[0];
+ break;
+
+ case LocalFunction::FUNCTION_TYPE::SWITCH:
+ for(i=0;i<numArg;++i)
+ index += args[i] * pow(maxArgVal, i);
+ break;
+ case LocalFunction::FUNCTION_TYPE::SCRIPT:
+ break;
+ }
+ return valueTable[index];
+}
+
+double LocalFunction::resolve(QVector<double> args)
+{
+ int i;
+ double out = 0.0;
+ switch(functionMode)
+ {
+ case LocalFunction::FUNCTION_TYPE::SUM:
+ for (i=0;i<args.size();++i)
+ out += args[i];
+ break;
+ case LocalFunction::FUNCTION_TYPE::PRODUCT:
+ out = args[0];
+ for (i=1;i<args.size();++i)
+ out *= args[i];
+ break;
+
+ case LocalFunction::FUNCTION_TYPE::SCRIPT:
+ break;
+ }
+
+ return out;
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dhu...@us...> - 2006-12-02 16:14:52
|
Revision: 48
http://svn.sourceforge.net/qcell/?rev=48&view=rev
Author: dhubleizh
Date: 2006-12-02 08:14:41 -0800 (Sat, 02 Dec 2006)
Log Message:
-----------
- a masterpice in architecture
- GenericPlugin now does some checkups before the actual plugin does it's job
- interface.h updated with subtype for parsing
- KIParser finished - waiting only for generic world class
- other plugins need tweaking for the new API
Modified Paths:
--------------
trunk/qcell/baseheaders/GenericParserPlugin.h
trunk/qcell/baseheaders/interfaces.h
trunk/qcell/parsers/KI/KIParserPlugin.cpp
trunk/qcell/parsers/KI/KIParserPlugin.h
Modified: trunk/qcell/baseheaders/GenericParserPlugin.h
===================================================================
--- trunk/qcell/baseheaders/GenericParserPlugin.h 2006-12-01 17:27:34 UTC (rev 47)
+++ trunk/qcell/baseheaders/GenericParserPlugin.h 2006-12-02 16:14:41 UTC (rev 48)
@@ -22,6 +22,17 @@
/// A list defined by each plugin of supported file types
QStringList supported_file_types;
+ /**
+ * @brief Parser implemented by each individual plugin.
+ *
+ * @param content Content to parse
+ * @param type Type of parsing
+ * @param subtype Type of file to parse
+ *
+ * @return A an XML string with parsed data
+ */
+ virtual QString realParser(QByteArray content, QString type, QString subtype) = 0;
+
public:
/**
* @brief What types of parsing does this plugin do
@@ -55,6 +66,54 @@
}
}
+ QString parse(const QByteArray content, const QString type, const QString subtype="")
+ {
+ if(!supported_parser_types.contains(type))
+ {
+ // Constructing supported parser types
+ QString types;
+ for(int i =0 ; i < supported_parser_types.count()-1; i++)
+ {
+ types.append(supported_parser_types[i]);
+ types.append(',');
+
+ };
+ types.append(supported_parser_types.last());
+
+ qDebug(tr("This plugin doesn't support parsing of type %1. It supports %2.")
+ .arg(type)
+ .arg(types)
+ .toAscii()
+ );
+
+ return QString();
+ }
+ else if(!supported_file_types.contains(subtype)){
+
+ // Constructing supported file types
+ QString subtypes;
+ for(int i =0 ; i < supported_file_types.count()-1; i++)
+ {
+ subtypes.append(supported_file_types[i]);
+ subtypes.append(',');
+
+ };
+ subtypes.append(supported_file_types.last());
+
+ qDebug(tr("This plugin doesn't support parsing of type %1. It supports %2.")
+ .arg(type)
+ .arg(subtypes)
+ .toAscii()
+ );
+
+ return QString();
+
+ }
+
+ return realParser(content, type, subtype);
+
+ }
+
};
#endif
Modified: trunk/qcell/baseheaders/interfaces.h
===================================================================
--- trunk/qcell/baseheaders/interfaces.h 2006-12-01 17:27:34 UTC (rev 47)
+++ trunk/qcell/baseheaders/interfaces.h 2006-12-02 16:14:41 UTC (rev 48)
@@ -45,10 +45,11 @@
*
* @param content Data do parse
* @param type Parsing category type
+ * @param subtype File type to parse
*
* @return A xml string containing the parsed data in common format
*/
- virtual QString parse(const QByteArray content, const QString type) = 0;
+ virtual QString parse(const QByteArray content, const QString type, const QString subtype) = 0;
};
Q_DECLARE_INTERFACE(ParserInterface,
Modified: trunk/qcell/parsers/KI/KIParserPlugin.cpp
===================================================================
--- trunk/qcell/parsers/KI/KIParserPlugin.cpp 2006-12-01 17:27:34 UTC (rev 47)
+++ trunk/qcell/parsers/KI/KIParserPlugin.cpp 2006-12-02 16:14:41 UTC (rev 48)
@@ -16,28 +16,20 @@
}
/// @todo Incorporate genreal Function file to output resulting XML
-QString KIParserPlugin::parse(const QByteArray content, const QString type)
+QString KIParserPlugin::realParser(const QByteArray content, const QString type, const QString subtype)
{
QStringList lines;
// Used to doublecheck the format of a line in file
QRegExp format;
// To be able to print the line in which some error occured
- int line_nr = 1;
+ int line_nr,columnt_nr;
+ line_nr = 1;
// Parameters from the file header
+ // The real world holder
+ // As this file type has no header, we have absolutely no idea of how many
+ // dimensions and how large it is, so we need to track counts
+ QVector<QVector<QVector <int> > > world;
- // If we're asked by accident to parse a file not supported by the plugin
- /// @todo redefine it the 'new' way
-// if(type != FQT_PARSER_TYPE)
-// {
-// qDebug(tr("The pluginn has been asked to parse a file type (%1) different from declared one (%2).")
-// .arg(type)
-// .arg(FQT_PARSER_TYPE)
-// .toAscii()
-// );
-//
-// return QString();
-// }
-
// Basic sanity check
lines = QString(content).split('\n');
if(lines.count() < 1)
@@ -45,6 +37,50 @@
qDebug(tr("The input file is to short!").toAscii());
return QString();
}
+
+ // Allowed signs in file
+ format.setPattern("[\\-a-Z0-9]");
+ // Append first wall (well - a 1D world has one wall in a 3D thinking fasion)
+ world.append(QVector<QVector <int> >());
+ foreach(QString line, lines)
+ {
+ // When there's nothing in a line it is a wall seperator
+ if(line.length()==0)
+ {
+ world.append(QVector<QVector <int> >());
+ }
+ else {
+
+ // A new verse for each line
+ world.last().append(QVector<int>());
+ // Reset columnt ocunter for each line
+ columnt_nr = 1;
+
+ foreach(QChar sign, line)
+ {
+ if(!format.exactMatch(sign))
+ {
+ qDebug(tr("The sign in line %1 column %2 is wrong. It should be in range of %3.")
+ .arg(line_nr)
+ .arg(columnt_nr)
+ .toAscii()
+ );
+
+ return QString();
+ }
+
+ // The real adding
+ world.last().last().append(sign.toAscii() - '0');
+
+ // Keep track of columnt nr
+ columnt_nr++;
+ }
+
+ }
+
+ // Keep track of line nr
+ line_nr++;
+ }
}
Q_EXPORT_PLUGIN2(KIFileParser, KIParserPlugin)
Modified: trunk/qcell/parsers/KI/KIParserPlugin.h
===================================================================
--- trunk/qcell/parsers/KI/KIParserPlugin.h 2006-12-01 17:27:34 UTC (rev 47)
+++ trunk/qcell/parsers/KI/KIParserPlugin.h 2006-12-02 16:14:41 UTC (rev 48)
@@ -17,10 +17,12 @@
class KIParserPlugin : public GenericParserPlugin
{
+protected:
+ QString realParser(QByteArray content, QString type, QString subtype);
+
public:
KIParserPlugin();
- QString parse(const QByteArray content, const QString type);
};
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <le...@us...> - 2006-12-04 10:29:37
|
Revision: 50
http://svn.sourceforge.net/qcell/?rev=50&view=rev
Author: lessm
Date: 2006-12-04 02:29:27 -0800 (Mon, 04 Dec 2006)
Log Message:
-----------
- LocalFunction can generate xmlString
Modified Paths:
--------------
trunk/qcell/baseheaders/LocalFunction.h
trunk/qcell/basesources/LocalFunction.cpp
Modified: trunk/qcell/baseheaders/LocalFunction.h
===================================================================
--- trunk/qcell/baseheaders/LocalFunction.h 2006-12-02 16:26:36 UTC (rev 49)
+++ trunk/qcell/baseheaders/LocalFunction.h 2006-12-04 10:29:27 UTC (rev 50)
@@ -3,6 +3,9 @@
#include <QVector>
#include <QString>
+#include <QDomDocument>
+#include <QDomElement>
+#include <QDomText>
#include <math.h>
@@ -27,17 +30,20 @@
QVector<int> productArguments;
QVector<int> freeArguments;
FUNCTION_TYPE functionMode;
- int numArg, maxArgVal;
+ int numArg, maxArgVal, numElements;
QString script;
protected:
+//public:
void resizeValueTable(void);
+ int mostPopularValue(void);
+
public:
LocalFunction();
~LocalFunction();
- void inti(int numberOfArguments, int AlphabetSize);
+ void inti(int numberOfArguments, int maxArgumentVelue);
// args is vector contein index of arguments to sum
void setSumArguments(QVector<int> args);
@@ -65,6 +71,8 @@
int resolve(QVector<int> arg);
double resolve(QVector<double> arg);
+
+ QString toXmlString(void);
};
#endif
Modified: trunk/qcell/basesources/LocalFunction.cpp
===================================================================
--- trunk/qcell/basesources/LocalFunction.cpp 2006-12-02 16:26:36 UTC (rev 49)
+++ trunk/qcell/basesources/LocalFunction.cpp 2006-12-04 10:29:27 UTC (rev 50)
@@ -2,27 +2,64 @@
void LocalFunction::resizeValueTable(void)
{
+
switch(functionMode)
{
- case LocalFunction::FUNCTION_TYPE::SUM:
case LocalFunction::FUNCTION_TYPE::PRODUCT:
- valueTable.resize(maxArgVal);
+ numElements = pow(maxArgVal - 1, productArguments.size()) + 1;
break;
+ case LocalFunction::FUNCTION_TYPE::SUM:
+ numElements = sumArguments.size() * (maxArgVal - 1) + 1;
+ break;
+
case LocalFunction::FUNCTION_TYPE::MIXED_SUM_SWITCH:
- valueTable.resize(freeArguments.size() * maxArgVal * (sumArguments.size() * (maxArgVal - 1) + 1));
+ numElements = freeArguments.size() * maxArgVal * (sumArguments.size() * (maxArgVal - 1) + 1);
break;
case LocalFunction::FUNCTION_TYPE::MIXED_PRODUCT_SWITCH:
- valueTable.resize(freeArguments.size() * maxArgVal * (pow(maxArgVal - 1, productArguments.size()) + 1));
+ numElements = freeArguments.size() * maxArgVal * (pow(maxArgVal - 1, productArguments.size()) + 1);
break;
case LocalFunction::FUNCTION_TYPE::SWITCH:
- valueTable.resize(numArg * maxArgVal);
+ numElements = numArg * maxArgVal;
break;
}
+
+ valueTable.resize(numElements);
}
+int LocalFunction::mostPopularValue(void)
+{
+ int i, t, out;
+ QVector<int> temp;
+
+ if(functionMode==LocalFunction::FUNCTION_TYPE::SCRIPT)
+ return -1;
+
+ temp.resize(maxArgVal);
+ for(i=0;i<numElements;++i)
+ {
+ if(temp[valueTable[i]]>numElements/2)
+ return valueTable[i];
+ else
+ temp[valueTable[i]]++;
+ }
+
+ t = temp[0];
+ out = 0;
+
+ for(i=i;i<temp.size();++i)
+ {
+ if(t<temp[i])
+ {
+ t = temp[i];
+ out = i;
+ }
+ }
+ return out;
+}
+
LocalFunction::LocalFunction()
{
functionMode = LocalFunction::FUNCTION_TYPE::SWITCH;
@@ -33,10 +70,10 @@
functionMode = LocalFunction::FUNCTION_TYPE::SWITCH;
}
-void LocalFunction::inti(int numberOfArguments, int AlphabetSize)
+void LocalFunction::inti(int numberOfArguments, int maxArgumentVelue)
{
numArg = numberOfArguments;
- maxArgVal = AlphabetSize;
+ maxArgVal = maxArgumentVelue;
}
void LocalFunction::setSumArguments(QVector<int> arg)
@@ -216,3 +253,133 @@
return out;
}
+
+
+QString LocalFunction::toXmlString(void)
+{
+ int i, fillValue = mostPopularValue();
+ QString index, value, data;
+ QDomDocument dom;
+ QDomElement root, element, subElement;
+ QDomText textData = dom.createTextNode("");
+ root = dom.createElement("LocalFunction");
+
+ root.setAttribute("ArgumentsNumber", numArg);
+ root.setAttribute("AlphabetSize", maxArgVal);
+
+ switch(functionMode)
+ {
+ case LocalFunction::FUNCTION_TYPE::SUM:
+ element = dom.createElement("Sum");
+ element.setAttribute("Fill", fillValue);
+ for(i=0;i<numElements;i++)
+ {
+ if(valueTable[i]!=fillValue)
+ {
+ index.setNum(i);
+ value.setNum(valueTable[i]);
+ data = index + ":" + value + ";";
+ textData.appendData(data);
+ }
+ }
+ element.appendChild(textData);
+ root.appendChild(element);
+ break;
+
+ case LocalFunction::FUNCTION_TYPE::PRODUCT:
+ element = dom.createElement("Product");
+ element.setAttribute("Fill", fillValue);
+ for(i=0;i<numElements;i++)
+ {
+ if(valueTable[i]!=fillValue)
+ {
+ index.setNum(i);
+ value.setNum(valueTable[i]);
+ data = index + ":" + value + ";";
+ textData.appendData(data);
+ }
+ }
+ element.appendChild(textData);
+ root.appendChild(element);
+ break;
+
+ case LocalFunction::FUNCTION_TYPE::MIXED_SUM_SWITCH:
+ element = dom.createElement("Mixed");
+ element.setAttribute("Fill", fillValue);
+ for(i=0;i<sumArguments.size();++i)
+ {
+ index.setNum(sumArguments[i]);
+ data += index + ";";
+ }
+ element.setAttribute("SumArguments", data);
+ for(i=0;i<numElements;i++)
+ {
+ if(valueTable[i]!=fillValue)
+ {
+ index.setNum(i);
+ value.setNum(valueTable[i]);
+ data = index + ":" + value + ";";
+ textData.appendData(data);
+ }
+ }
+ element.appendChild(textData);
+ root.appendChild(element);
+ break;
+
+ case LocalFunction::FUNCTION_TYPE::MIXED_PRODUCT_SWITCH:
+ element = dom.createElement("Mixed");
+ element.setAttribute("Fill", fillValue);
+ for(i=0;i<productArguments.size();++i)
+ {
+ index.setNum(productArguments[i]);
+ data += index + ";";
+ }
+ element.setAttribute("ProductArguments", data);
+
+ for(i=0;i<numElements;i++)
+ {
+ if(valueTable[i]!=fillValue)
+ {
+ index.setNum(i);
+ value.setNum(valueTable[i]);
+ data = index + ":" + value + ";";
+ textData.appendData(data);
+ }
+ }
+
+ element.appendChild(textData);
+ root.appendChild(element);
+
+ break;
+
+ case LocalFunction::FUNCTION_TYPE::SWITCH:
+ element = dom.createElement("Switch");
+ element.setAttribute("Fill", fillValue);
+
+ for(i=0;i<numElements;i++)
+ {
+ if(valueTable[i]!=fillValue)
+ {
+ index.setNum(i);
+ value.setNum(valueTable[i]);
+ data = index + ":" + value + ";";
+ textData.appendData(data);
+ }
+ }
+
+ element.appendChild(textData);
+ root.appendChild(element);
+
+ break;
+
+ case LocalFunction::FUNCTION_TYPE::SCRIPT:
+ element = dom.createElement("Script");
+ textData.setData(script);
+ element.appendChild(textData);
+ root.appendChild(element);
+ break;
+ }
+
+ dom.appendChild(root);
+ return dom.toString();
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <le...@us...> - 2006-12-04 13:01:21
|
Revision: 51
http://svn.sourceforge.net/qcell/?rev=51&view=rev
Author: lessm
Date: 2006-12-04 05:01:14 -0800 (Mon, 04 Dec 2006)
Log Message:
-----------
- LocalFunction class can be set from xmlString
Modified Paths:
--------------
trunk/qcell/baseheaders/LocalFunction.h
trunk/qcell/basesources/LocalFunction.cpp
Modified: trunk/qcell/baseheaders/LocalFunction.h
===================================================================
--- trunk/qcell/baseheaders/LocalFunction.h 2006-12-04 10:29:27 UTC (rev 50)
+++ trunk/qcell/baseheaders/LocalFunction.h 2006-12-04 13:01:14 UTC (rev 51)
@@ -6,6 +6,7 @@
#include <QDomDocument>
#include <QDomElement>
#include <QDomText>
+#include <QStringList>
#include <math.h>
@@ -37,13 +38,21 @@
//public:
void resizeValueTable(void);
int mostPopularValue(void);
+ QString valueTableToString(void);
+ QString valueTableToString(int fillValue);
+ QString sumArgumentsToString(void);
+ QString productArgumentsToString(void);
+ void valueTableFromString(QString *string);
+ void sumArgumentsFromString(QString *string);
+ void productArgumentsFromString(QString *string);
+
public:
LocalFunction();
~LocalFunction();
- void inti(int numberOfArguments, int maxArgumentVelue);
+ void init(int numberOfArguments, int alphabetSize);
// args is vector contein index of arguments to sum
void setSumArguments(QVector<int> args);
@@ -73,6 +82,8 @@
double resolve(QVector<double> arg);
QString toXmlString(void);
+ bool fromXmlString(QString *xmlString);
+ bool fromDomElement(QDomElement *xmlElement);
};
#endif
Modified: trunk/qcell/basesources/LocalFunction.cpp
===================================================================
--- trunk/qcell/basesources/LocalFunction.cpp 2006-12-04 10:29:27 UTC (rev 50)
+++ trunk/qcell/basesources/LocalFunction.cpp 2006-12-04 13:01:14 UTC (rev 51)
@@ -60,6 +60,97 @@
return out;
}
+QString LocalFunction::valueTableToString(void)
+{
+ int fillValue;
+ QString data, index, value;
+ fillValue = mostPopularValue();
+ for(int i=0;i<numElements;i++)
+ {
+ if(valueTable[i]!=fillValue)
+ {
+ index.setNum(i);
+ value.setNum(valueTable[i]);
+ data = index + ":" + value + ";";
+ }
+ }
+ return data;
+}
+
+QString LocalFunction::valueTableToString(int fillValue)
+{
+ QString data, index, value;
+ for(int i=0;i<numElements;i++)
+ {
+ if(valueTable[i]!=fillValue)
+ {
+ index.setNum(i);
+ value.setNum(valueTable[i]);
+ data += index + ":" + value + ";";
+ }
+ }
+ return data;
+}
+
+QString LocalFunction::sumArgumentsToString(void)
+{
+ int i;
+ QString out, temp;
+ foreach(i, sumArguments)
+ {
+ temp.setNum(i);
+ out += temp + ";";
+ }
+ return out;
+}
+
+QString LocalFunction::productArgumentsToString(void)
+{
+ int i;
+ QString out, temp;
+ foreach(i, productArguments)
+ {
+ temp.setNum(i);
+ out += temp + ";";
+ }
+ return out;
+}
+
+void LocalFunction::valueTableFromString(QString *string)
+{
+ QStringList splitList, element;
+ QString temp;
+ splitList = string->split(";", QString::SplitBehavior::SkipEmptyParts);
+ foreach(temp, splitList)
+ {
+ element = temp.split(":");
+ valueTable[element.at(0).toInt()] = element.at(1).toInt();
+ }
+}
+
+
+void LocalFunction::sumArgumentsFromString(QString *string)
+{
+ QStringList splitList;
+ QString temp;
+ QVector<int> v;
+ splitList = string->split(";", QString::SplitBehavior::SkipEmptyParts);
+ foreach(temp, splitList)
+ v.append(temp.toInt());
+ setSumArguments(v);
+}
+
+void LocalFunction::productArgumentsFromString(QString *string)
+{
+ QStringList splitList;
+ QString temp;
+ QVector<int> v;
+ splitList = string->split(";", QString::SplitBehavior::SkipEmptyParts);
+ foreach(temp, splitList)
+ v.append(temp.toInt());
+ setProductArguments(v);
+}
+
LocalFunction::LocalFunction()
{
functionMode = LocalFunction::FUNCTION_TYPE::SWITCH;
@@ -70,10 +161,10 @@
functionMode = LocalFunction::FUNCTION_TYPE::SWITCH;
}
-void LocalFunction::inti(int numberOfArguments, int maxArgumentVelue)
+void LocalFunction::init(int numberOfArguments, int alphabetSize)
{
numArg = numberOfArguments;
- maxArgVal = maxArgumentVelue;
+ maxArgVal = alphabetSize;
}
void LocalFunction::setSumArguments(QVector<int> arg)
@@ -119,6 +210,10 @@
void LocalFunction::setSwitchFunction(void)
{
+ sumArguments.clear();
+ productArguments.clear();
+ freeArguments.clear();
+ valueTable.clear();
functionMode = LocalFunction::FUNCTION_TYPE::SWITCH;
}
@@ -257,31 +352,22 @@
QString LocalFunction::toXmlString(void)
{
- int i, fillValue = mostPopularValue();
- QString index, value, data;
+ int i, fillValue;
+ QString data, index;
QDomDocument dom;
QDomElement root, element, subElement;
QDomText textData = dom.createTextNode("");
root = dom.createElement("LocalFunction");
-
root.setAttribute("ArgumentsNumber", numArg);
root.setAttribute("AlphabetSize", maxArgVal);
-
+ fillValue = mostPopularValue();
switch(functionMode)
{
case LocalFunction::FUNCTION_TYPE::SUM:
element = dom.createElement("Sum");
element.setAttribute("Fill", fillValue);
- for(i=0;i<numElements;i++)
- {
- if(valueTable[i]!=fillValue)
- {
- index.setNum(i);
- value.setNum(valueTable[i]);
- data = index + ":" + value + ";";
- textData.appendData(data);
- }
- }
+ data = valueTableToString(fillValue);
+ textData.setData(data);
element.appendChild(textData);
root.appendChild(element);
break;
@@ -289,16 +375,8 @@
case LocalFunction::FUNCTION_TYPE::PRODUCT:
element = dom.createElement("Product");
element.setAttribute("Fill", fillValue);
- for(i=0;i<numElements;i++)
- {
- if(valueTable[i]!=fillValue)
- {
- index.setNum(i);
- value.setNum(valueTable[i]);
- data = index + ":" + value + ";";
- textData.appendData(data);
- }
- }
+ data = valueTableToString(fillValue);
+ textData.setData(data);
element.appendChild(textData);
root.appendChild(element);
break;
@@ -306,22 +384,10 @@
case LocalFunction::FUNCTION_TYPE::MIXED_SUM_SWITCH:
element = dom.createElement("Mixed");
element.setAttribute("Fill", fillValue);
- for(i=0;i<sumArguments.size();++i)
- {
- index.setNum(sumArguments[i]);
- data += index + ";";
- }
+ data = sumArgumentsToString();
element.setAttribute("SumArguments", data);
- for(i=0;i<numElements;i++)
- {
- if(valueTable[i]!=fillValue)
- {
- index.setNum(i);
- value.setNum(valueTable[i]);
- data = index + ":" + value + ";";
- textData.appendData(data);
- }
- }
+ data = valueTableToString(fillValue);
+ textData.setData(data);
element.appendChild(textData);
root.appendChild(element);
break;
@@ -329,24 +395,10 @@
case LocalFunction::FUNCTION_TYPE::MIXED_PRODUCT_SWITCH:
element = dom.createElement("Mixed");
element.setAttribute("Fill", fillValue);
- for(i=0;i<productArguments.size();++i)
- {
- index.setNum(productArguments[i]);
- data += index + ";";
- }
+ data = productArgumentsToString();
element.setAttribute("ProductArguments", data);
-
- for(i=0;i<numElements;i++)
- {
- if(valueTable[i]!=fillValue)
- {
- index.setNum(i);
- value.setNum(valueTable[i]);
- data = index + ":" + value + ";";
- textData.appendData(data);
- }
- }
-
+ data = valueTableToString(fillValue);
+ textData.setData(data);
element.appendChild(textData);
root.appendChild(element);
@@ -355,21 +407,10 @@
case LocalFunction::FUNCTION_TYPE::SWITCH:
element = dom.createElement("Switch");
element.setAttribute("Fill", fillValue);
-
- for(i=0;i<numElements;i++)
- {
- if(valueTable[i]!=fillValue)
- {
- index.setNum(i);
- value.setNum(valueTable[i]);
- data = index + ":" + value + ";";
- textData.appendData(data);
- }
- }
-
+ data = valueTableToString(fillValue);
+ textData.setData(data);
element.appendChild(textData);
root.appendChild(element);
-
break;
case LocalFunction::FUNCTION_TYPE::SCRIPT:
@@ -383,3 +424,90 @@
dom.appendChild(root);
return dom.toString();
}
+
+bool LocalFunction::fromXmlString(QString *xmlString)
+{
+ QDomDocument doc;
+ QDomElement element;
+ doc.setContent(*xmlString);
+ element = doc.documentElement();
+ return fromDomElement(&element);
+}
+
+bool LocalFunction::fromDomElement(QDomElement *xmlElement)
+{
+ QDomElement element;
+ QDomText domText;
+ QString text;
+ if(xmlElement->tagName()=="LocalFunction")
+ {
+ init(xmlElement->attribute("ArgumentsNumber").toInt(), xmlElement->attribute("AlphabetSize").toInt());
+ element = xmlElement->firstChildElement();
+ if(element.tagName()=="Sum")
+ {
+ setFunctonType(LocalFunction::FUNCTION_TYPE::SUM);
+ resizeValueTable();
+ valueTable.fill(element.attribute("Fill").toInt());
+ text = element.text();
+ valueTableFromString(&text);
+ }
+ else
+ {
+ if(element.tagName()=="Product")
+ {
+ setFunctonType(LocalFunction::FUNCTION_TYPE::PRODUCT);
+ resizeValueTable();
+ valueTable.fill(element.attribute("Fill").toInt());
+ text = element.text();
+ valueTableFromString(&text);
+ }
+ else
+ {
+ if(element.tagName()=="Mixed")
+ {
+ if(element.hasAttribute("SumArguments"))
+ {
+ text = element.attribute("SumArguments");
+ sumArgumentsFromString(&text);
+ }
+ else
+ if(element.hasAttribute("ProductArguments"))
+ {
+ text = element.attribute("ProductArguments");
+ productArgumentsFromString(&text);
+ }
+ else
+ return 0;
+
+ resizeValueTable();
+ valueTable.fill(element.attribute("Fill").toInt());
+ text = element.text();
+ valueTableFromString(&text);
+ }
+ else
+ {
+ if(element.tagName()=="Switch")
+ {
+ setSwitchFunction();
+ resizeValueTable();
+ valueTable.fill(element.attribute("Fill").toInt());
+ text = element.text();
+ valueTableFromString(&text);
+ }
+ else
+ {
+ if(element.tagName()=="Script")
+ {
+ text = element.text();
+ setScript(text);
+ }
+ else
+ return 0;
+ }
+ }
+ }
+ }
+ return 1;
+ }
+ return 0;
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dhu...@us...> - 2006-12-05 18:37:59
|
Revision: 53
http://svn.sourceforge.net/qcell/?rev=53&view=rev
Author: dhubleizh
Date: 2006-12-05 10:37:10 -0800 (Tue, 05 Dec 2006)
Log Message:
-----------
- divided implementation from header
Modified Paths:
--------------
trunk/qcell/baseheaders/GenericParserPlugin.h
Added Paths:
-----------
trunk/qcell/basesources/GenericParserPlugin.cpp
Modified: trunk/qcell/baseheaders/GenericParserPlugin.h
===================================================================
--- trunk/qcell/baseheaders/GenericParserPlugin.h 2006-12-05 17:07:21 UTC (rev 52)
+++ trunk/qcell/baseheaders/GenericParserPlugin.h 2006-12-05 18:37:10 UTC (rev 53)
@@ -39,10 +39,7 @@
*
* @return A list of plugin types provided by this plugin
*/
- inline QStringList parserTypes() const
- {
- return supported_parser_types;
- }
+ inline QStringList parserTypes() const;
/**
* @brief Which file types this plugin parses
*
@@ -50,70 +47,10 @@
*
* @return A list of file types (extensions) parsed by this plugin
*/
- inline QStringList fileTypes(const QString type) const
- {
- if(supported_parser_types.contains(type))
- {
- return supported_file_types;
- }
- else {
- qDebug(tr("The plugin type %1 is not supported by this plugin.")
- .arg(type)
- .toAscii()
- );
+ inline QStringList fileTypes(const QString type) const;
- return QStringList();
- }
- }
+ QString parse(const QByteArray content, const QString type, const QString subtype="");
- QString parse(const QByteArray content, const QString type, const QString subtype="")
- {
- if(!supported_parser_types.contains(type))
- {
- // Constructing supported parser types
- QString types;
- for(int i =0 ; i < supported_parser_types.count()-1; i++)
- {
- types.append(supported_parser_types[i]);
- types.append(',');
-
- };
- types.append(supported_parser_types.last());
-
- qDebug(tr("This plugin doesn't support parsing of type %1. It supports %2.")
- .arg(type)
- .arg(types)
- .toAscii()
- );
-
- return QString();
- }
- else if(!supported_file_types.contains(subtype)){
-
- // Constructing supported file types
- QString subtypes;
- for(int i =0 ; i < supported_file_types.count()-1; i++)
- {
- subtypes.append(supported_file_types[i]);
- subtypes.append(',');
-
- };
- subtypes.append(supported_file_types.last());
-
- qDebug(tr("This plugin doesn't support parsing of type %1. It supports %2.")
- .arg(type)
- .arg(subtypes)
- .toAscii()
- );
-
- return QString();
-
- }
-
- return realParser(content, type, subtype);
-
- }
-
};
#endif
Added: trunk/qcell/basesources/GenericParserPlugin.cpp
===================================================================
--- trunk/qcell/basesources/GenericParserPlugin.cpp (rev 0)
+++ trunk/qcell/basesources/GenericParserPlugin.cpp 2006-12-05 18:37:10 UTC (rev 53)
@@ -0,0 +1,79 @@
+/**@file GenericParserPlugin.cpp
+ * @author czarny
+ * @version \xABversion\xBB
+ * @date
+ * Created: wto 05 gru 2006 20:23:24 CET \n
+ * Last Update: wto 05 gru 2006 20:23:24 CET
+ */
+
+#include "GenericParserPlugin.h"
+
+inline QStringList GenericParserPlugin::parserTypes() const
+{
+ return supported_parser_types;
+}
+
+inline QStringList GenericParserPlugin::fileTypes(const QString type) const
+{
+ if(supported_parser_types.contains(type))
+ {
+ return supported_file_types;
+ }
+ else {
+ qDebug(tr("The plugin type %1 is not supported by this plugin.")
+ .arg(type)
+ .toAscii()
+ );
+
+ return QStringList();
+ }
+}
+
+QString GenericParserPlugin::parse(const QByteArray content, const QString type, const QString subtype)
+{
+ if(!supported_parser_types.contains(type))
+ {
+ // Constructing supported parser types
+ QString types;
+ for(int i =0 ; i < supported_parser_types.count()-1; i++)
+ {
+ types.append(supported_parser_types[i]);
+ types.append(',');
+
+ };
+ types.append(supported_parser_types.last());
+
+ qDebug(tr("This plugin doesn't support parsing of type %1. It supports %2.")
+ .arg(type)
+ .arg(types)
+ .toAscii()
+ );
+
+ return QString();
+ }
+ else if(!supported_file_types.contains(subtype)){
+
+ // Constructing supported file types
+ QString subtypes;
+ for(int i =0 ; i < supported_file_types.count()-1; i++)
+ {
+ subtypes.append(supported_file_types[i]);
+ subtypes.append(',');
+
+ };
+ subtypes.append(supported_file_types.last());
+
+ qDebug(tr("This plugin doesn't support parsing of type %1. It supports %2.")
+ .arg(type)
+ .arg(subtypes)
+ .toAscii()
+ );
+
+ return QString();
+
+ }
+
+ return realParser(content, type, subtype);
+
+}
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <le...@us...> - 2007-01-17 11:59:52
|
Revision: 180
http://svn.sourceforge.net/qcell/?rev=180&view=rev
Author: lessm
Date: 2007-01-17 03:59:50 -0800 (Wed, 17 Jan 2007)
Log Message:
-----------
- mask tools add in 3D view
Modified Paths:
--------------
trunk/qcell/baseheaders/Renderer.h
trunk/qcell/baseheaders/simulationwindow.h
trunk/qcell/baseheaders/view3dtools.h
trunk/qcell/baseheaders/view3dtools.ui
trunk/qcell/basesources/Renderer.cpp
trunk/qcell/basesources/simulationwindow.cpp
trunk/qcell/basesources/view3dtools.cpp
Modified: trunk/qcell/baseheaders/Renderer.h
===================================================================
--- trunk/qcell/baseheaders/Renderer.h 2007-01-15 20:29:13 UTC (rev 179)
+++ trunk/qcell/baseheaders/Renderer.h 2007-01-17 11:59:50 UTC (rev 180)
@@ -70,6 +70,8 @@
QVector<int> localObserverCoords;
+ QVector<int> maskValue;
+
protected:
void initializeGL();
void paintGL();
@@ -139,9 +141,11 @@
void setObserverPosition(int x, int y, int z);
QList< QVector<int> > getSelectData(void);
+ void maskSet(int x, int y, int z);
protected slots:
void resizeDataEvent(void);
+
signals:
void objectSelected(int x, int y, int z);
Modified: trunk/qcell/baseheaders/simulationwindow.h
===================================================================
--- trunk/qcell/baseheaders/simulationwindow.h 2007-01-15 20:29:13 UTC (rev 179)
+++ trunk/qcell/baseheaders/simulationwindow.h 2007-01-17 11:59:50 UTC (rev 180)
@@ -123,7 +123,7 @@
void view3DselectedObject(int x, int y, int z);
-
+ void maskChange(int x, int y, int z);
public:
void storeSelectedData(void);
Modified: trunk/qcell/baseheaders/view3dtools.h
===================================================================
--- trunk/qcell/baseheaders/view3dtools.h 2007-01-15 20:29:13 UTC (rev 179)
+++ trunk/qcell/baseheaders/view3dtools.h 2007-01-17 11:59:50 UTC (rev 180)
@@ -11,17 +11,26 @@
public:
View3DTools(QWidget *parent = 0);
~View3DTools();
+ void setRange(int x, int y, int z);
private:
Ui::View3DToolsClass ui;
int viewMode;
+ int mx, my, mz;
protected slots:
void ViewChangePerspective(void);
void ViewChangeOrtho(void);
+ void xyPress(void);
+ void zyPress(void);
+ void xzPress(void);
+ void EnablePress(void);
+ void maskValueSet(int value);
+
signals:
void ViewModeUpdated(int mode);
+ void maskSet(int x, int y, int z);
};
#endif // VIEW3DTOOLS_H
Modified: trunk/qcell/baseheaders/view3dtools.ui
===================================================================
--- trunk/qcell/baseheaders/view3dtools.ui 2007-01-15 20:29:13 UTC (rev 179)
+++ trunk/qcell/baseheaders/view3dtools.ui 2007-01-17 11:59:50 UTC (rev 180)
@@ -6,7 +6,7 @@
<x>0</x>
<y>0</y>
<width>102</width>
- <height>76</height>
+ <height>205</height>
</rect>
</property>
<property name="windowTitle" >
@@ -60,6 +60,96 @@
</property>
</widget>
</widget>
+ <widget class="QGroupBox" name="SectionGroup" >
+ <property name="geometry" >
+ <rect>
+ <x>1</x>
+ <y>70</y>
+ <width>100</width>
+ <height>131</height>
+ </rect>
+ </property>
+ <property name="title" >
+ <string>Section</string>
+ </property>
+ <widget class="QSpinBox" name="maskValue" >
+ <property name="geometry" >
+ <rect>
+ <x>10</x>
+ <y>100</y>
+ <width>81</width>
+ <height>22</height>
+ </rect>
+ </property>
+ </widget>
+ <widget class="QToolButton" name="EnableButton" >
+ <property name="geometry" >
+ <rect>
+ <x>10</x>
+ <y>20</y>
+ <width>81</width>
+ <height>20</height>
+ </rect>
+ </property>
+ <property name="text" >
+ <string>Enable</string>
+ </property>
+ <property name="checkable" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QToolButton" name="xyButton" >
+ <property name="geometry" >
+ <rect>
+ <x>10</x>
+ <y>40</y>
+ <width>81</width>
+ <height>20</height>
+ </rect>
+ </property>
+ <property name="text" >
+ <string>xy</string>
+ </property>
+ <property name="checkable" >
+ <bool>true</bool>
+ </property>
+ <property name="checked" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QToolButton" name="zyButton" >
+ <property name="geometry" >
+ <rect>
+ <x>10</x>
+ <y>60</y>
+ <width>81</width>
+ <height>20</height>
+ </rect>
+ </property>
+ <property name="text" >
+ <string>zy</string>
+ </property>
+ <property name="checkable" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QToolButton" name="xzButton" >
+ <property name="geometry" >
+ <rect>
+ <x>10</x>
+ <y>80</y>
+ <width>81</width>
+ <height>20</height>
+ </rect>
+ </property>
+ <property name="text" >
+ <string>xz</string>
+ </property>
+ <property name="checkable" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </widget>
</widget>
<layoutdefault spacing="6" margin="11" />
<resources/>
Modified: trunk/qcell/basesources/Renderer.cpp
===================================================================
--- trunk/qcell/basesources/Renderer.cpp 2007-01-15 20:29:13 UTC (rev 179)
+++ trunk/qcell/basesources/Renderer.cpp 2007-01-17 11:59:50 UTC (rev 180)
@@ -451,6 +451,9 @@
editValue = 0;
localObserverCoords.resize(3);
showLocalObserver = 0;
+
+ maskValue.resize(3);
+ maskValue[0] = maskValue[1] = maskValue[2] = -1;
}
Renderer::~Renderer()
@@ -685,11 +688,28 @@
for(int z=0;z<storage.getSizeZ();++z)
{
+ if(maskValue[2]>-1)
+ if(maskValue[2]!=z)
+ {
+ counter += storage.getSizeY() * storage.getSizeX();
+ continue;
+ }
for(int y=storage.getSizeY();y>0;--y)
{
+ if(maskValue[1]>-1)
+ if(maskValue[1]!=storage.getSizeY()- y - 1)
+ {
+ counter += storage.getSizeY();
+ continue;
+ }
for(int x=0;x<storage.getSizeX();++x)
{
-
+ if(maskValue[0]>-1)
+ if(maskValue[0]!=x)
+ {
+ ++counter;
+ continue;
+ }
index = storage.getValueAt_i(counter);
if(index>=symbolsMap.size())
index = symbolsMap.size() - 1;
@@ -957,6 +977,13 @@
setOrtoPerspective();
}
+void Renderer::maskSet(int x, int y, int z)
+{
+ maskValue[0] = x;
+ maskValue[1] = y;
+ maskValue[2] = z;
+}
+
void Renderer::setOrtoPerspective(bool noClear)
{
float aspect = (float)width()/(float)height();
Modified: trunk/qcell/basesources/simulationwindow.cpp
===================================================================
--- trunk/qcell/basesources/simulationwindow.cpp 2007-01-15 20:29:13 UTC (rev 179)
+++ trunk/qcell/basesources/simulationwindow.cpp 2007-01-17 11:59:50 UTC (rev 180)
@@ -658,6 +658,9 @@
connect(renderer, SIGNAL(objectSelected(int, int, int)), SLOT(view3DselectedObject(int, int, int)));
storeCurentTable = NULL;
+
+ connect(view3DTools, SIGNAL(maskSet(int, int, int)), SLOT(maskChange(int, int, int)));
+
}
simulationWindow::~simulationWindow()
@@ -819,6 +822,9 @@
storeCurentTable = getStorage()->getDataPointer();
getStorage()->setForeignDataPointer(localView.getDataPointer(), 1);
}
+
+ view3DTools->setRange(getStorage()->getSizeX(), getStorage()->getSizeY(), getStorage()->getSizeZ());
+
//****************************************************
repaint();
}
@@ -1160,6 +1166,12 @@
}
}
+void simulationWindow::maskChange(int x, int y, int z)
+{
+ renderer->maskSet(x, y, z);
+ renderer->repaint();
+}
+
void simulationWindow::storeSelectedData(void)
{
int xofset=0, yofset=0, zofset=0;
Modified: trunk/qcell/basesources/view3dtools.cpp
===================================================================
--- trunk/qcell/basesources/view3dtools.cpp 2007-01-15 20:29:13 UTC (rev 179)
+++ trunk/qcell/basesources/view3dtools.cpp 2007-01-17 11:59:50 UTC (rev 180)
@@ -8,12 +8,45 @@
connect(ui.PerspectiveButton, SIGNAL(clicked(bool)), SLOT(ViewChangePerspective()));
connect(ui.OrthoButton, SIGNAL(clicked(bool)), SLOT(ViewChangeOrtho()));
+
+ connect(ui.xyButton, SIGNAL(clicked(bool)), SLOT(xyPress()));
+ connect(ui.zyButton, SIGNAL(clicked(bool)), SLOT(zyPress()));
+ connect(ui.xzButton, SIGNAL(clicked(bool)), SLOT(xzPress()));
+
+ connect(ui.EnableButton, SIGNAL(clicked(bool)), SLOT(EnablePress()));
+
+ connect(ui.maskValue, SIGNAL(valueChanged(int)), SLOT(maskValueSet(int)));
+ mx = my = mz = 0;
}
View3DTools::~View3DTools()
{
}
+void View3DTools::setRange(int x, int y, int z)
+{
+ mx = x;
+ my = y;
+ mz = z;
+
+ if(ui.xyButton->isChecked())
+ {
+ ui.maskValue->setMaximum(mz);
+ }
+
+ if(ui.zyButton->isChecked())
+ {
+ ui.maskValue->setMaximum(mx);
+ }
+
+ if(ui.xzButton->isChecked())
+ {
+ ui.maskValue->setMaximum(my);
+ }
+
+ maskValueSet(ui.maskValue->value());
+}
+
void View3DTools::ViewChangePerspective(void)
{
ui.PerspectiveButton->setChecked(1);
@@ -34,4 +67,64 @@
viewMode = 1;
emit ViewModeUpdated(1);
}
+}
+
+void View3DTools::xyPress(void)
+{
+ ui.xyButton->setChecked(1);
+ ui.zyButton->setChecked(0);
+ ui.xzButton->setChecked(0);
+ ui.maskValue->setMaximum(mz);
+ maskValueSet(ui.maskValue->value());
+}
+
+void View3DTools::zyPress(void)
+{
+ ui.xyButton->setChecked(0);
+ ui.zyButton->setChecked(1);
+ ui.xzButton->setChecked(0);
+ ui.maskValue->setMaximum(mx);
+ maskValueSet(ui.maskValue->value());
+}
+
+void View3DTools::xzPress(void)
+{
+ ui.xyButton->setChecked(0);
+ ui.zyButton->setChecked(0);
+ ui.xzButton->setChecked(1);
+ ui.maskValue->setMaximum(my);
+ maskValueSet(ui.maskValue->value());
+}
+
+void View3DTools::EnablePress(void)
+{
+ if(ui.EnableButton->isChecked())
+ {
+ maskValueSet(ui.maskValue->value());
+ }
+ else
+ {
+ emit maskSet(-1, -1, -1);
+ }
+}
+
+void View3DTools::maskValueSet(int value)
+{
+ if(ui.EnableButton->isChecked())
+ {
+ if(ui.xyButton->isChecked())
+ {
+ emit maskSet(-1, -1, value);
+ }
+
+ if(ui.zyButton->isChecked())
+ {
+ emit maskSet(value, -1, -1);
+ }
+
+ if(ui.xzButton->isChecked())
+ {
+ emit maskSet(-1, value, -1);
+ }
+ }
}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <le...@us...> - 2007-01-21 18:35:09
|
Revision: 222
http://svn.sourceforge.net/qcell/?rev=222&view=rev
Author: lessm
Date: 2007-01-21 10:35:01 -0800 (Sun, 21 Jan 2007)
Log Message:
-----------
- some changes in ElementalRulesWidget and work now
Modified Paths:
--------------
trunk/qcell/basesources/Calculator.cpp
trunk/qcell/basesources/simulationwindow.cpp
trunk/qcell/visgui/ElementalRulesWidget.cpp
trunk/qcell/visgui/ElementalRulesWidget.h
Modified: trunk/qcell/basesources/Calculator.cpp
===================================================================
--- trunk/qcell/basesources/Calculator.cpp 2007-01-21 18:17:50 UTC (rev 221)
+++ trunk/qcell/basesources/Calculator.cpp 2007-01-21 18:35:01 UTC (rev 222)
@@ -256,7 +256,6 @@
case baseDataTypes::BOOL:
case baseDataTypes::CHAR:
case baseDataTypes::SHORT:
- /// @todo BUUUUMMM babol
case baseDataTypes::INT:
*((int *)temp) = localfunction->resolve(neighbourhood->valuesToVector_i());
break;
Modified: trunk/qcell/basesources/simulationwindow.cpp
===================================================================
--- trunk/qcell/basesources/simulationwindow.cpp 2007-01-21 18:17:50 UTC (rev 221)
+++ trunk/qcell/basesources/simulationwindow.cpp 2007-01-21 18:35:01 UTC (rev 222)
@@ -250,6 +250,7 @@
SYMBOL symbol;
QTableWidgetItem *item;
QProgressDialog progresDialog;
+ table2D->blockSignals(1);
if(forceUpdate)
{
progresDialog.setLabelText("Generating view pleas wait...");
@@ -356,6 +357,7 @@
progresDialog.setValue(y);
}
}
+ table2D->blockSignals(0);
}
void simulationWindow::update2DGraph(void)
@@ -379,6 +381,7 @@
QString tmpString;
SYMBOL symbol;
QTableWidgetItem *item;
+ table1D->blockSignals(1);
if(table1D->columnCount()!= renderer->getStorage()->getSizeX())
{
@@ -466,11 +469,13 @@
}
}
}
+ table1D->blockSignals(0);
}
void simulationWindow::update1DTableMem(void)
{
QTableWidgetItem *item, *memItem;
+ table1DMem->blockSignals(1);
table1DMem->setRowCount(table1DMem->rowCount()+1);
for(int x=0;x<renderer->getStorage()->getSizeX();++x)
{
@@ -480,6 +485,7 @@
}
if(table1DMem->rowCount()>30)
table1DMem->removeRow(0);
+ table1DMem->blockSignals(0);
}
void simulationWindow::updateSymbolTable(void)
Modified: trunk/qcell/visgui/ElementalRulesWidget.cpp
===================================================================
--- trunk/qcell/visgui/ElementalRulesWidget.cpp 2007-01-21 18:17:50 UTC (rev 221)
+++ trunk/qcell/visgui/ElementalRulesWidget.cpp 2007-01-21 18:35:01 UTC (rev 222)
@@ -10,10 +10,10 @@
ElementalRulesWidget::ElementalRulesWidget()
{
setupUi(this);
- treeWidget->setColumnCount(2);
+ rulesTree->setColumnCount(2);
QStringList labels;
labels << tr("Rule") << tr("Occur");
- treeWidget->setHeaderLabels(labels);
+ rulesTree->setHeaderLabels(labels);
}
void ElementalRulesWidget::addRule(int id, QVector<int> coordinates)
@@ -28,16 +28,12 @@
// Add top-level id
QTreeWidgetItem* item = new QTreeWidgetItem(QStringList(QString::number(id)));
item->addChild(new QTreeWidgetItem(values));
- treeWidget->addTopLevelItem(item);
+ rulesTree->addTopLevelItem(item);
}
void ElementalRulesWidget::addOccurance(int id, QVector<int> coordinates)
{
- QTreeWidgetItem* item = treeWidget->findItems(
- QString::number(id),
- Qt::MatchExactly)
- .first();
-
+ QTreeWidgetItem* item = rulesTree->findItems( QString::number(id), Qt::MatchExactly).first();
QStringList values("-");
values << parseCoordinates(coordinates);
item->addChild(new QTreeWidgetItem(values));
Modified: trunk/qcell/visgui/ElementalRulesWidget.h
===================================================================
--- trunk/qcell/visgui/ElementalRulesWidget.h 2007-01-21 18:17:50 UTC (rev 221)
+++ trunk/qcell/visgui/ElementalRulesWidget.h 2007-01-21 18:35:01 UTC (rev 222)
@@ -9,9 +9,10 @@
#ifndef __ELEMENTALRULESWIDGET_H__
#define __ELEMENTALRULESWIDGET_H__
-#include "ui_ElementalRules.h"
#include <QDockWidget>
#include <QStringList>
+#include <QTreeWidgetItem>
+#include "ui_ElementalRulesWidget.h"
class ElementalRulesWidget: public QWidget, public Ui::ElementalRulesForm
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dhu...@us...> - 2007-02-16 22:26:04
|
Revision: 338
http://svn.sourceforge.net/qcell/?rev=338&view=rev
Author: dhubleizh
Date: 2007-02-16 14:26:00 -0800 (Fri, 16 Feb 2007)
Log Message:
-----------
- anti FQT shit saving
- random colors for new symbols
Modified Paths:
--------------
trunk/qcell/basesources/simulationwindow.cpp
trunk/qcell/parsers/FQT/FQTParserPlugin.cpp
Modified: trunk/qcell/basesources/simulationwindow.cpp
===================================================================
--- trunk/qcell/basesources/simulationwindow.cpp 2007-02-16 22:20:54 UTC (rev 337)
+++ trunk/qcell/basesources/simulationwindow.cpp 2007-02-16 22:26:00 UTC (rev 338)
@@ -1056,6 +1056,7 @@
symbol.primitiveID = 0;
symbol.hide = 0;
int symbol_nr = renderer->getSymbolCount();
+ symbol.color = QColor(qrand() % 255, qrand() % 255, qrand() % 255);
if (symbol_nr < 10)
{
@@ -1070,10 +1071,10 @@
symbol.textSybmol = QChar((int)'a' + (symbol_nr - 10));
}
renderer->addSymbol(symbol);
- renderer->setSymbolColor(renderer->getSymbolCount()-1, QColor(255, 255, 255));
+ renderer->setSymbolColor(renderer->getSymbolCount()-1, symbol.color);
graphicsView2D->addSymbol(symbol);
- graphicsView2D->setSymbolColor(renderer->getSymbolCount()-1, QColor(255, 255, 255));
+ graphicsView2D->setSymbolColor(renderer->getSymbolCount()-1, symbol.color);
updateSymbolTable();
}
Modified: trunk/qcell/parsers/FQT/FQTParserPlugin.cpp
===================================================================
--- trunk/qcell/parsers/FQT/FQTParserPlugin.cpp 2007-02-16 22:20:54 UTC (rev 337)
+++ trunk/qcell/parsers/FQT/FQTParserPlugin.cpp 2007-02-16 22:26:00 UTC (rev 338)
@@ -320,7 +320,7 @@
lf.fromXmlString(&content);
// Check if we can use the generic type from the XML string
- if(!lf.fromXmlString(&content));
+ if(!lf.fromXmlString(&content))
{
qDebug(tr("Unable to parse out internal data!").toAscii());
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <le...@us...> - 2006-12-08 15:17:14
|
Revision: 56
http://svn.sourceforge.net/qcell/?rev=56&view=rev
Author: lessm
Date: 2006-12-08 07:17:09 -0800 (Fri, 08 Dec 2006)
Log Message:
-----------
- some bugs removed from CalculationData, LocalFunction, Neighbourhood classes
Modified Paths:
--------------
trunk/qcell/baseheaders/CalculationData.h
trunk/qcell/basesources/CalculationData.cpp
trunk/qcell/basesources/LocalFunction.cpp
trunk/qcell/basesources/Neighbourhood.cpp
Modified: trunk/qcell/baseheaders/CalculationData.h
===================================================================
--- trunk/qcell/baseheaders/CalculationData.h 2006-12-05 18:47:39 UTC (rev 55)
+++ trunk/qcell/baseheaders/CalculationData.h 2006-12-08 15:17:09 UTC (rev 56)
@@ -21,12 +21,13 @@
bool borderExist;
-//protected:
-public:
+protected:
+//public:
bool resize(const char *dataPointer=NULL);
void * getAddressAt(int x, int y, int z, int t);
void * getAddressAtBackBuffer(int x, int y, int z, int t);
void calculateBackBufferSize(void);
+ void copyData(void);
public:
@@ -53,7 +54,7 @@
void setValueAt_d(double val, int x, int y, int z);
void setValueAt_d(double val, int x, int y, int z, int t);
- void setDataType(baseDataTypes::DATA_TYPES type = baseDataTypes::CHAR);
+ void setDataType(baseDataTypes::DATA_TYPES type = baseDataTypes::DATA_TYPES::CHAR);
baseDataTypes::DATA_TYPES getDataType(void);
int getDataSize(void);
@@ -73,13 +74,12 @@
void fill(const char *dataPointer);
- void setCalculationSpace(void);
- void setCalculationSpace(int startX, int endX);
- void setCalculationSpace(int startX, int startY, int endX, int endY);
- void setCalculationSpace(int startX, int startY, int startZ, int endX, int endY, int endZ);
- void setCalculationSpace(int startX, int startY, int startZ, int startT, int endX, int endY, int endZ, int endT);
+ void setCalculationSpace(bool noDataCopy=0);
+ void setCalculationSpace(int startX, int endX, bool noDataCopy=0);
+ void setCalculationSpace(int startX, int startY, int endX, int endY, bool noDataCopy=0);
+ void setCalculationSpace(int startX, int startY, int startZ, int endX, int endY, int endZ, bool noDataCopy=0);
+ void setCalculationSpace(int startX, int startY, int startZ, int startT, int endX, int endY, int endZ, int endT, bool noDataCopy=0);
- void removeBorder(void);
bool haveBorder(void);
QString createXmlHeader(void);
@@ -96,8 +96,9 @@
void setValueAt_d_Back(double val, int x, int y, int z);
void setValueAt_d_Back(double val, int x, int y, int z, int t);
- void clearFrontBuffer_i(int val=0);
- void clearFrontBuffer_d(double val=0.0);
+ void fillData_i(int val=0);
+ void fillData_d(double val=0.0);
+
};
#endif
Modified: trunk/qcell/basesources/CalculationData.cpp
===================================================================
--- trunk/qcell/basesources/CalculationData.cpp 2006-12-05 18:47:39 UTC (rev 55)
+++ trunk/qcell/basesources/CalculationData.cpp 2006-12-08 15:17:09 UTC (rev 56)
@@ -1,4 +1,4 @@
-#include "../baseheaders/CalculationData.h"
+#include "CalculationData.h"
bool CalculationData::resize(const char *dataPointer)
{
@@ -29,7 +29,7 @@
switch(dataType)
{
case baseDataTypes::DATA_TYPES::BOOL:
- size = 0;
+ dSize = sizeof(char);
break;
case baseDataTypes::DATA_TYPES::CHAR:
@@ -67,7 +67,7 @@
break;
case baseDataTypes::DATA_TYPES::CHAR:
- dSize = 1;
+ dSize = sizeof(char);
break;
case baseDataTypes::DATA_TYPES::INT:
@@ -100,6 +100,8 @@
if(x<0)
x=0;
+ //int index = dSize * (x + y * backBufferSizeX + z * backBufferSizeX * backBufferSizeY + t * backBufferSizeX * backBufferSizeY * backBufferSizeZ);
+
return dataBorderFree + dSize * (x + y * backBufferSizeX + z * backBufferSizeX * backBufferSizeY + t * backBufferSizeX * backBufferSizeY * backBufferSizeZ);
}
@@ -108,16 +110,46 @@
switch(dimension)
{
case 4:
- backBufferSizeT = maxT - minT;
+ backBufferSizeT = (maxT - minT) + 1;
case 3:
- backBufferSizeZ = maxZ - minZ;
+ backBufferSizeZ = (maxZ - minZ) + 1;
case 2:
- backBufferSizeY = maxY - minY;
+ backBufferSizeY = (maxY - minY) + 1;
case 1:
- backBufferSizeX = maxX - minX;
+ backBufferSizeX = (maxX - minX) + 1;
}
+
+ if(maxX<0)
+ maxX=0;
+
+ if(maxY<0)
+ maxY=0;
+
+ if(maxZ<0)
+ maxZ=0;
+
+ if(maxT<0)
+ maxT=0;
}
+void CalculationData::copyData(void)
+{
+ int counterF=0, counterB=0;
+ for(int t=minT;t<=maxT;++t)
+ {
+ for(int z=minZ;z<=maxZ;++z)
+ {
+ for(int y=minY;y<=maxY;++y)
+ {
+ counterF += minX * size;
+ memcpy(dataBorderFree + counterB, data + counterF, backBufferSizeX * size);
+ counterF += (sizeX - minX) * size;
+ counterB += backBufferSizeX * size;
+ }
+ }
+ }
+}
+
CalculationData::CalculationData()
{
dataType = baseDataTypes::DATA_TYPES::NONE;
@@ -617,17 +649,17 @@
}
}
-void CalculationData::setCalculationSpace(void)
+void CalculationData::setCalculationSpace(bool noDataCopy)
{
minX = 0;
minY = 0;
minZ = 0;
minT = 0;
- maxX = sizeX;
- maxY = sizeY;
- maxZ = sizeZ;
- maxT = sizeT;
+ maxX = sizeX - 1;
+ maxY = sizeY - 1;
+ maxZ = sizeZ - 1;
+ maxT = sizeT - 1;
borderExist = 0;
if(dataBorderFree)
@@ -636,37 +668,53 @@
}
dataBorderFree = new char[getSizeInByte()];
calculateBackBufferSize();
+ if(!noDataCopy)
+ copyData();
}
-void CalculationData::setCalculationSpace(int startX, int endX)
+void CalculationData::setCalculationSpace(int startX, int endX, bool noDataCopy)
{
minX = startX;
maxX = endX;
+ minY = 0;
+ maxY = 0;
+ minZ = 0;
+ maxZ = 0;
+ minT = 0;
+ maxT = 0;
borderExist = 1;
if(dataBorderFree)
{
delete[] dataBorderFree;
}
- dataBorderFree = new char[(maxX - minX) * size];
+ dataBorderFree = new char[((maxX - minX) + 1) * size];
calculateBackBufferSize();
+ if(!noDataCopy)
+ copyData();
}
-void CalculationData::setCalculationSpace(int startX, int startY, int endX, int endY)
+void CalculationData::setCalculationSpace(int startX, int startY, int endX, int endY, bool noDataCopy)
{
minX = startX;
maxX = endX;
minY = startY;
maxY = endY;
+ minZ = 0;
+ maxZ = 0;
+ minT = 0;
+ maxT = 0;
borderExist = 1;
if(dataBorderFree)
{
delete[] dataBorderFree;
}
- dataBorderFree = new char[((maxX - minX) * (maxY - minY)) * size];
+ dataBorderFree = new char[(((maxX - minX) + 1) * ((maxY - minY) + 1)) * size];
calculateBackBufferSize();
+ if(!noDataCopy)
+ copyData();
}
-void CalculationData::setCalculationSpace(int startX, int startY, int startZ, int endX, int endY, int endZ)
+void CalculationData::setCalculationSpace(int startX, int startY, int startZ, int endX, int endY, int endZ, bool noDataCopy)
{
minX = startX;
maxX = endX;
@@ -674,16 +722,20 @@
maxY = endY;
minZ = startZ;
maxZ = endZ;
+ minT = 0;
+ maxT = 0;
borderExist = 1;
if(dataBorderFree)
{
delete[] dataBorderFree;
}
- dataBorderFree = new char[((maxX - minX) * (maxY - minY) * (maxZ - minZ)) * size];
+ dataBorderFree = new char[(((maxX - minX) + 1) * ((maxY - minY) + 1) * ((maxZ - minZ) + 1)) * size];
calculateBackBufferSize();
+ if(!noDataCopy)
+ copyData();
}
-void CalculationData::setCalculationSpace(int startX, int startY, int startZ, int startT, int endX, int endY, int endZ, int endT)
+void CalculationData::setCalculationSpace(int startX, int startY, int startZ, int startT, int endX, int endY, int endZ, int endT, bool noDataCopy)
{
minX = startX;
maxX = endX;
@@ -698,77 +750,12 @@
{
delete[] dataBorderFree;
}
- dataBorderFree = new char[((maxX - minX) * (maxY - minY) * (maxZ - minZ) * (maxT - minT)) * size];
+ dataBorderFree = new char[(((maxX - minX) + 1) * ((maxY - minY) + 1) * ((maxZ - minZ) + 1) * ((maxT - minT) + 1)) * size];
calculateBackBufferSize();
+ if(!noDataCopy)
+ copyData();
}
-void CalculationData::removeBorder(void)
-{
- char *temp;
- int newSize = 1, counter = 0;
- if(borderExist)
- {
- switch(dimension)
- {
-
- case 4:
- newSize *= maxT - minT;
-
- case 3:
- newSize *= maxZ - minZ;
-
- case 2:
- newSize *= maxY - minY;
-
- case 1:
- newSize *= maxX - minX;
- break;
-
- default:
- newSize = 0;
- }
-
- temp = new char[newSize * size];
-
- for(int t=minT;t<maxT;++t)
- {
- for(int z=minZ;z<maxZ;++z)
- {
- for(int y=minY;y<maxY;++y)
- {
- for(int x=minX;x<maxX;++x)
- {
- memcpy(temp + counter, getAddressAt(x, y, z, t), size);
- counter += size;
- }
- }
- }
- }
-
- switch(dimension)
- {
-
- case 4:
- sizeT = maxT - minT;
-
- case 3:
- sizeZ = maxZ - minZ;
-
- case 2:
- sizeY = maxY - minY;
-
- case 1:
- sizeX = maxX - minX;
- }
-
- delete[] data;
- data = temp;
- temp = NULL;
-
- }
- borderExist = 0;
-}
-
bool CalculationData::haveBorder(void)
{
return borderExist;
@@ -1079,7 +1066,7 @@
}
}
-void CalculationData::clearFrontBuffer_i(int val)
+void CalculationData::fillData_i(int val)
{
int dSize;
switch(dataType)
@@ -1113,7 +1100,7 @@
}
}
-void CalculationData::clearFrontBuffer_d(double val)
+void CalculationData::fillData_d(double val)
{
int dSize;
switch(dataType)
Modified: trunk/qcell/basesources/LocalFunction.cpp
===================================================================
--- trunk/qcell/basesources/LocalFunction.cpp 2006-12-05 18:47:39 UTC (rev 55)
+++ trunk/qcell/basesources/LocalFunction.cpp 2006-12-08 15:17:09 UTC (rev 56)
@@ -1,4 +1,4 @@
-#include "../baseheaders/LocalFunction.h"
+#include "LocalFunction.h"
void LocalFunction::resizeValueTable(void)
{
@@ -27,6 +27,7 @@
}
valueTable.resize(numElements);
+ valueTable.fill(0);
}
int LocalFunction::mostPopularValue(void)
@@ -165,6 +166,11 @@
{
numArg = numberOfArguments;
maxArgVal = alphabetSize;
+ valueTable.clear();
+ sumArguments.clear();
+ productArguments.clear();
+ freeArguments.clear();
+ functionMode = LocalFunction::FUNCTION_TYPE::SWITCH;
}
void LocalFunction::setSumArguments(QVector<int> arg)
@@ -268,7 +274,7 @@
bool LocalFunction::addFunctionValue(int value, QVector<int> args)
{
- int i, index = 0;
+ int i, index = 0, t;
if(valueTable.empty())
resizeValueTable();
switch(functionMode)
@@ -279,12 +285,16 @@
break;
case LocalFunction::FUNCTION_TYPE::MIXED_SUM_SWITCH:
- case LocalFunction::FUNCTION_TYPE::MIXED_PRODUCT_SWITCH:
+
+ t = freeArguments.size();
for(i=0;i<freeArguments.size();++i)
index += args[i+1] * pow(maxArgVal, i);
- index *= args[0];
+ index += args[0] * pow(maxArgVal, freeArguments.size());
break;
+ case LocalFunction::FUNCTION_TYPE::MIXED_PRODUCT_SWITCH:
+ break;
+
case LocalFunction::FUNCTION_TYPE::SWITCH:
for(i=0;i<numArg;++i)
index += args[i] * pow(maxArgVal, i);
@@ -296,7 +306,7 @@
int LocalFunction::resolve(QVector<int> args)
{
- int i, index = 0;
+ int i, index = 0, temp;
if(valueTable.empty())
resizeValueTable();
if(functionMode==LocalFunction::FUNCTION_TYPE::SCRIPT)
@@ -310,12 +320,19 @@
break;
case LocalFunction::FUNCTION_TYPE::MIXED_SUM_SWITCH:
- case LocalFunction::FUNCTION_TYPE::MIXED_PRODUCT_SWITCH:
for(i=0;i<freeArguments.size();++i)
- index += args[i+1] * pow(maxArgVal, i);
- index *= args[0];
+ index += args[freeArguments[i]] * pow(maxArgVal, i);
+
+ temp = 0;
+ for(i=0;i<sumArguments.size();++i)
+ temp += args[sumArguments[i]];
+
+ index += temp * pow(maxArgVal, freeArguments.size());
break;
+ case LocalFunction::FUNCTION_TYPE::MIXED_PRODUCT_SWITCH:
+ break;
+
case LocalFunction::FUNCTION_TYPE::SWITCH:
for(i=0;i<numArg;++i)
index += args[i] * pow(maxArgVal, i);
Modified: trunk/qcell/basesources/Neighbourhood.cpp
===================================================================
--- trunk/qcell/basesources/Neighbourhood.cpp 2006-12-05 18:47:39 UTC (rev 55)
+++ trunk/qcell/basesources/Neighbourhood.cpp 2006-12-08 15:17:09 UTC (rev 56)
@@ -1,4 +1,4 @@
-#include "../baseheaders/Neighbourhood.h"
+#include "Neighbourhood.h"
Neighbourhood::Neighbourhood()
{
@@ -302,18 +302,8 @@
break;
}
- int h;
- int a, b, c, d;
-
for(int i=0;i<neighbourVector.size();i++)
- {
- a = neighbourVector[i].x;
- b = neighbourVector[i].y;
- c = neighbourVector[i].z;
- d = neighbourVector[i].t;
- h = dataSize * (neighbourVector[i].x + neighbourVector[i].y * sizeX + neighbourVector[i].z * sizeX * sizeY + neighbourVector[i].t * sizeX * sizeY * sizeZ);
- neighbourVector[i].offset = h;
- }
+ neighbourVector[i].offset = dataSize * (neighbourVector[i].x + neighbourVector[i].y * sizeX + neighbourVector[i].z * sizeX * sizeY + neighbourVector[i].t * sizeX * sizeY * sizeZ);
}
void Neighbourhood::resolveValues(const char *address)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dhu...@us...> - 2006-12-11 10:50:59
|
Revision: 60
http://svn.sourceforge.net/qcell/?rev=60&view=rev
Author: dhubleizh
Date: 2006-12-11 02:50:57 -0800 (Mon, 11 Dec 2006)
Log Message:
-----------
- no more const functions (problems compiling later)
- inline functions need to be implemented in .h (WTF? This should work with cpp files as well!)
Modified Paths:
--------------
trunk/qcell/baseheaders/GenericParserPlugin.h
trunk/qcell/baseheaders/interfaces.h
trunk/qcell/basesources/GenericParserPlugin.cpp
Modified: trunk/qcell/baseheaders/GenericParserPlugin.h
===================================================================
--- trunk/qcell/baseheaders/GenericParserPlugin.h 2006-12-11 10:14:36 UTC (rev 59)
+++ trunk/qcell/baseheaders/GenericParserPlugin.h 2006-12-11 10:50:57 UTC (rev 60)
@@ -39,7 +39,10 @@
*
* @return A list of plugin types provided by this plugin
*/
- inline QStringList parserTypes() const;
+ inline QStringList parserTypes()
+ {
+ return supported_parser_types;
+ }
/**
* @brief Which file types this plugin parses
*
@@ -47,8 +50,23 @@
*
* @return A list of file types (extensions) parsed by this plugin
*/
- inline QStringList fileTypes(const QString type) const;
+ inline QStringList fileTypes(const QString type)
+ {
+ if(supported_parser_types.contains(type))
+ {
+ return supported_file_types;
+ }
+ else {
+ qDebug(tr("The plugin type %1 is not supported by this plugin.")
+ .arg(type)
+ .toAscii()
+ );
+ return QStringList();
+ }
+ }
+
+
QString parse(const QByteArray content, const QString type, const QString subtype="");
};
Modified: trunk/qcell/baseheaders/interfaces.h
===================================================================
--- trunk/qcell/baseheaders/interfaces.h 2006-12-11 10:14:36 UTC (rev 59)
+++ trunk/qcell/baseheaders/interfaces.h 2006-12-11 10:50:57 UTC (rev 60)
@@ -28,7 +28,7 @@
*
* @return A list of types supported by the parser
*/
- virtual QStringList parserTypes() const = 0;
+ virtual QStringList parserTypes() = 0;
/**
* @brief File types the plugin is able to parse
*
@@ -36,7 +36,7 @@
*
* @return A list of types(extensions) of files types parsed by the plugin
*/
- virtual QStringList fileTypes(const QString type) const = 0;
+ virtual QStringList fileTypes(const QString type) = 0;
/**
* @brief The main parsing function
Modified: trunk/qcell/basesources/GenericParserPlugin.cpp
===================================================================
--- trunk/qcell/basesources/GenericParserPlugin.cpp 2006-12-11 10:14:36 UTC (rev 59)
+++ trunk/qcell/basesources/GenericParserPlugin.cpp 2006-12-11 10:50:57 UTC (rev 60)
@@ -1,6 +1,6 @@
/**@file GenericParserPlugin.cpp
* @author czarny
- * @version \xABversion\xBB
+ * @version 0.1
* @date
* Created: wto 05 gru 2006 20:23:24 CET \n
* Last Update: wto 05 gru 2006 20:23:24 CET
@@ -8,27 +8,27 @@
#include "GenericParserPlugin.h"
-inline QStringList GenericParserPlugin::parserTypes() const
-{
- return supported_parser_types;
-}
+//QStringList GenericParserPlugin::parserTypes()
+//{
+// return supported_parser_types;
+//}
+//
+//QStringList GenericParserPlugin::fileTypes(const QString type)
+//{
+// if(supported_parser_types.contains(type))
+// {
+// return supported_file_types;
+// }
+// else {
+// qDebug(tr("The plugin type %1 is not supported by this plugin.")
+// .arg(type)
+// .toAscii()
+// );
+//
+// return QStringList();
+// }
+//}
-inline QStringList GenericParserPlugin::fileTypes(const QString type) const
-{
- if(supported_parser_types.contains(type))
- {
- return supported_file_types;
- }
- else {
- qDebug(tr("The plugin type %1 is not supported by this plugin.")
- .arg(type)
- .toAscii()
- );
-
- return QStringList();
- }
-}
-
QString GenericParserPlugin::parse(const QByteArray content, const QString type, const QString subtype)
{
if(!supported_parser_types.contains(type))
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <le...@us...> - 2006-12-11 16:48:49
|
Revision: 61
http://svn.sourceforge.net/qcell/?rev=61&view=rev
Author: lessm
Date: 2006-12-11 08:48:46 -0800 (Mon, 11 Dec 2006)
Log Message:
-----------
- massages roster added
- MasterServer tcp write bug removed
Modified Paths:
--------------
trunk/qcell/baseheaders/Client.h
trunk/qcell/baseheaders/MasterServer.h
trunk/qcell/baseheaders/MasterServerInterface.h
trunk/qcell/basesources/Client.cpp
trunk/qcell/basesources/MasterServer.cpp
trunk/qcell/client/main.cpp
trunk/qcell/requests/requests.cpp
trunk/qcell/requests/requests.h
Modified: trunk/qcell/baseheaders/Client.h
===================================================================
--- trunk/qcell/baseheaders/Client.h 2006-12-11 10:50:57 UTC (rev 60)
+++ trunk/qcell/baseheaders/Client.h 2006-12-11 16:48:46 UTC (rev 61)
@@ -70,6 +70,8 @@
bool unregisterClient();
+ QString requestMessageRoster(void);
+
signals:
void kill();
@@ -84,6 +86,7 @@
void registerTimePass();
void pingTimePass();
+public slots:
};
#endif
Modified: trunk/qcell/baseheaders/MasterServer.h
===================================================================
--- trunk/qcell/baseheaders/MasterServer.h 2006-12-11 10:50:57 UTC (rev 60)
+++ trunk/qcell/baseheaders/MasterServer.h 2006-12-11 16:48:46 UTC (rev 61)
@@ -15,6 +15,7 @@
#include <QLibrary>
#include <QTcpServer>
#include <QDataStream>
+#include <QStringList>
#include "ClientInfo.h"
#include "MasterServerPlugin.h"
#include "MasterServerInterface.h"
@@ -40,6 +41,9 @@
QList<MasterServerPlugin *> uiPluginList;
QList<MasterServerPlugin *> comPluginList;
+ QList<message> messageList;
+ int messageListId;
+
QString pingMessage;
QTimer pingTimer;
int serverPingTime;
@@ -56,7 +60,6 @@
bool loadServerConfig(QString file);
bool parseServerConfig(QDomElement *xmlConfig);
-
protected slots:
void datagramRecived();
void parseDatagram(QByteArray datagram, QTcpSocket *socket=NULL);
@@ -81,7 +84,8 @@
int getUsersListId(void);
QList<ClientInfo> * getClientList(void);
-
+ QList<message> * getMassageList(void);
+ void addMessage(QString msg, QString type);
MasterServerInterface * getServerInterface(void);
void run();
@@ -120,6 +124,8 @@
virtual ClientInfo * getClientPointer(int id);
virtual bool sendMessage(ClientInfo client, QString *message);
+ virtual QList<message> * getMassageList(void);
+ virtual void addMessage(QString msg, QString type="");
virtual void addInfoToLog(QString string);
virtual void addWarningToLog(QString string);
Modified: trunk/qcell/baseheaders/MasterServerInterface.h
===================================================================
--- trunk/qcell/baseheaders/MasterServerInterface.h 2006-12-11 10:50:57 UTC (rev 60)
+++ trunk/qcell/baseheaders/MasterServerInterface.h 2006-12-11 16:48:46 UTC (rev 61)
@@ -8,6 +8,12 @@
#define CLIENT_REMOVE 1
#define CLIENT_REGISTERED 2
+struct message
+{
+ int id;
+ QString body;
+ QString type;
+};
class MasterServerInterface : public QObject
{
@@ -42,6 +48,9 @@
virtual bool sendMessage(ClientInfo client, QString *message)=0;
+ virtual QList<message> * getMassageList(void)=0;
+ virtual void addMessage(QString msg, QString type="")=0;
+
// some log methods
virtual void addInfoToLog(QString string)=0;
virtual void addWarningToLog(QString string)=0;
Modified: trunk/qcell/basesources/Client.cpp
===================================================================
--- trunk/qcell/basesources/Client.cpp 2006-12-11 10:50:57 UTC (rev 60)
+++ trunk/qcell/basesources/Client.cpp 2006-12-11 16:48:46 UTC (rev 61)
@@ -321,6 +321,32 @@
return 0;
}
+QString Client::requestMessageRoster(void)
+{
+ QDomDocument doc;
+ QDomElement root, filters;
+ QString out;
+
+ root = doc.createElement("ClientMessage");
+ root.setAttribute("Message", "RosterRequest");
+
+ doc.appendChild(root);
+ QTcpSocket *socket = connectToMasterServer();
+ socket->write(doc.toString().toAscii());
+
+
+ if(socket)
+ {
+ if(socket->waitForReadyRead())
+ {
+ out = socket->readAll();
+ }
+ socket->close();
+ delete socket;
+ }
+ return out;
+}
+
//protected slots:
void Client::processMessages()
@@ -367,5 +393,4 @@
else
++pingTry;
-}
-
+}
\ No newline at end of file
Modified: trunk/qcell/basesources/MasterServer.cpp
===================================================================
--- trunk/qcell/basesources/MasterServer.cpp 2006-12-11 10:50:57 UTC (rev 60)
+++ trunk/qcell/basesources/MasterServer.cpp 2006-12-11 16:48:46 UTC (rev 61)
@@ -232,9 +232,11 @@
{
i->startPing();
i->incCounter();
- tmpString.setNum(getUsersListId());
- tmpString +="\" />";
- sendMessage(i[0], pingMessage + tmpString);
+
+ tmpString = pingMessage;
+ tmpString.arg(i[0].getId()).arg(messageListId);
+
+ sendMessage(i[0], tmpString);
i++;
}
else
@@ -260,6 +262,10 @@
{
socket->waitForReadyRead(serverPingTime/2);
parseDatagram(socket->readAll(), socket);
+ if(!socket->waitForDisconnected(1000))
+ {
+ socket->close();
+ }
delete socket;
}
}
@@ -274,12 +280,13 @@
serverSend = new QUdpSocket(this);
tcpServer = new QTcpServer(this);
srand(curentTime.hour() + curentTime.minute() + curentTime.second());
- pingMessage = "<ServerMessage Message=\"Ping\" UsersListId=\"";
+ pingMessage = "<ServerMessage Message=\"Ping\" UsersListId=\"%1\" MessageListId=\"%2\" />";
serverPingTime = PING_TIME;
pingTimer.setInterval(serverPingTime);
connect(&pingTimer, SIGNAL(timeout()), SLOT(pingClients()));
usersListId = -1;
serverInterface = new ServerInterface(this);
+ messageListId = 0;
}
MasterServer::~MasterServer()
@@ -461,6 +468,33 @@
return &clientsList;
}
+QList<message> * MasterServer::getMassageList(void)
+{
+ return &messageList;
+}
+
+void MasterServer::addMessage(QString msg, QString type)
+{
+ message m;
+ m.body = msg;
+ m.type = type;
+ if(messageList.size()==0)
+ {
+ m.id = 0;
+ messageList.insert(0, m);
+ }
+ else
+ {
+ m.id = messageList.first().id + 1;
+ if(m.id<0)
+ m.id = 0;
+ messageListId = m.id;
+ messageList.insert(0, m);
+ while(messageList.size()>100)
+ messageList.removeLast();
+ }
+}
+
MasterServerInterface * MasterServer::getServerInterface(void)
{
return serverInterface;
@@ -549,6 +583,16 @@
return serverPointer->sendMessage(client, *message);
}
+QList<message> * ServerInterface::getMassageList(void)
+{
+ return serverPointer->getMassageList();
+}
+
+void ServerInterface::addMessage(QString msg, QString type)
+{
+ serverPointer->addMessage(msg, type);
+}
+
void ServerInterface::addInfoToLog(QString string)
{
std::cout<<"II:"<<logCounter<<" : "<<string.toStdString()<<std::endl;
Modified: trunk/qcell/client/main.cpp
===================================================================
--- trunk/qcell/client/main.cpp 2006-12-11 10:50:57 UTC (rev 60)
+++ trunk/qcell/client/main.cpp 2006-12-11 16:48:46 UTC (rev 61)
@@ -12,6 +12,7 @@
if(c.initClient())
{
a.connect(&c, SIGNAL(kill()), SLOT(quit()));
+ c.connect(&c, SIGNAL(serverRegistered()), SLOT(bleble()));
}
return a.exec();
}
Modified: trunk/qcell/requests/requests.cpp
===================================================================
--- trunk/qcell/requests/requests.cpp 2006-12-11 10:50:57 UTC (rev 60)
+++ trunk/qcell/requests/requests.cpp 2006-12-11 16:48:46 UTC (rev 61)
@@ -11,6 +11,111 @@
return out;
}
+QString requests::generateMassageList(void)
+{
+ message msg;
+ QString out, tmp;
+
+ out = "<MessageList CurrentMessageId=\"";
+ if(serverInterface->getMassageList()->size()>0)
+ {
+ tmp.setNum(serverInterface->getMassageList()->first().id);
+ out += tmp + "\">";
+
+ foreach(msg, *(serverInterface->getMassageList()))
+ out += msg.body;
+ }
+ else
+ {
+ tmp.setNum(-1);
+ out += tmp + "\">";
+ }
+ out += "<\\MessageList>";
+ return out;
+}
+
+QString requests::generateMassageList(int lastId)
+{
+ message msg;
+ QString out, tmp;
+
+ out = "<MessageList CurrentMessageId=\"";
+ if(serverInterface->getMassageList()->size()>0)
+ {
+ tmp.setNum(serverInterface->getMassageList()->first().id);
+ out += tmp + "\">";
+
+ foreach(msg, *(serverInterface->getMassageList()))
+ {
+ if(lastId==msg.id)
+ break;
+ out += msg.body;
+ }
+ }
+ else
+ {
+ tmp.setNum(-1);
+ out += tmp + "\">";
+ }
+ out += "<\\MessageList>";
+ return out;
+}
+
+QString requests::generateMassageList(QString type)
+{
+ message msg;
+ QString out, tmp;
+
+ out = "<MessageList CurrentMessageId=\"";
+ if(serverInterface->getMassageList()->size()>0)
+ {
+ tmp.setNum(serverInterface->getMassageList()->first().id);
+ out += tmp + "\">";
+
+ foreach(msg, *(serverInterface->getMassageList()))
+ {
+ if(type==msg.type || msg.type.isEmpty())
+ out += msg.body;
+ }
+ }
+ else
+ {
+ tmp.setNum(-1);
+ out += tmp + "\">";
+ }
+ out += "<\\MessageList>";
+ return out;
+}
+
+QString requests::generateMassageList(int lastId, QString type)
+{
+ message msg;
+ QString out, tmp;
+
+ out = "<MessageList CurrentMessageId=\"";
+ if(serverInterface->getMassageList()->size()>0)
+ {
+ tmp.setNum(serverInterface->getMassageList()->first().id);
+ out += tmp + "\">";
+
+ foreach(msg, *(serverInterface->getMassageList()))
+ {
+ if(lastId==msg.id)
+ break;
+
+ if(type==msg.type || msg.type.isEmpty())
+ out += msg.body;
+ }
+ }
+ else
+ {
+ tmp.setNum(-1);
+ out += tmp + "\">";
+ }
+ out += "<\\MessageList>";
+ return out;
+}
+
// public:
requests::requests(MasterServerInterface *iPointer) : MasterServerPlugin(iPointer)
@@ -25,45 +130,56 @@
bool requests::execute(QDomElement *xml, QTcpSocket *socket)
{
- bool out=false;
- ClientInfo info, *infoPointer;
+ QString temp;
+ QDomDocument doc;
QDomElement child;
- QString temp;
-
- serverInterface->addErrorToLog(xml->text());
-
- //if(socket==NULL)
- //{
- /*
+ if(socket)
+ {
if(xml->tagName()=="ClientMessage")
{
- if(xml->attribute("Message")=="RegisterRequest")
+ if(xml->attribute("Message")=="RosterRequest")
{
- child = xml->firstChildElement("ClientData");
- if(child.isNull())
- return false;
- info.setClientType(child.attribute("Type"));
- info.setClientAddress(child.attribute("Address"));
- info.setClientPort(child.attribute("ListenPort").toInt());
-
- serverInterface->registerUser(&info);
- out = true;
+ child = xml->firstChildElement();
+ if(!child.isNull())
+ {
+ if(child.tagName()=="Filters")
+ {
+ if(child.hasAttribute("Id") && child.hasAttribute("Type"))
+ {
+ temp = generateMassageList(child.attribute("Id").toInt(), child.attribute("Type"));
+ }
+ else
+ if(child.hasAttribute("Id"))
+ {
+ temp = generateMassageList(child.attribute("Id").toInt());
+ }
+ else
+ if(child.hasAttribute("Type"))
+ {
+ temp = generateMassageList(child.attribute("Type"));
+ }
+ else
+ temp = generateMassageList();
+ }
+ }
+ else
+ temp = generateMassageList();
+ socket->write(temp.toAscii());
+ return true;
}
-
- if(xml->attribute("Message")=="Pong")
+ if(xml->attribute("Message")=="AddToRoster")
{
- infoPointer = serverInterface->getClientPointer(xml->attribute("ClientId").toInt());
- if(infoPointer)
+ child = xml->firstChildElement();
+ if(!child.isNull())
{
- infoPointer->endPing();
- infoPointer->resetCounter();
- out = true;
+ doc.appendChild(child);
+ serverInterface->addMessage(doc.toString(), xml->attribute("Type"));
+ return true;
}
}
}
- */
- //}
- return true;
+ }
+ return false;
}
QString requests::getPluginInfo()
Modified: trunk/qcell/requests/requests.h
===================================================================
--- trunk/qcell/requests/requests.h 2006-12-11 10:50:57 UTC (rev 60)
+++ trunk/qcell/requests/requests.h 2006-12-11 16:48:46 UTC (rev 61)
@@ -20,6 +20,11 @@
QString createUserList(ClientInfo info);
QDomElement addClient(QDomDocument *doc, ClientInfo inf);
+ QString generateMassageList(void);
+ QString generateMassageList(int lastId);
+ QString generateMassageList(QString type);
+ QString generateMassageList(int lastId, QString type);
+
public:
requests(MasterServerInterface *iPointer);
~requests();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <le...@us...> - 2006-12-11 16:54:23
|
Revision: 62
http://svn.sourceforge.net/qcell/?rev=62&view=rev
Author: lessm
Date: 2006-12-11 08:54:21 -0800 (Mon, 11 Dec 2006)
Log Message:
-----------
- end line added at end
Modified Paths:
--------------
trunk/qcell/baseheaders/MasterServerInterface.h
trunk/qcell/basesources/Client.cpp
trunk/qcell/basesources/MasterServer.cpp
trunk/qcell/requests/requests.cpp
Modified: trunk/qcell/baseheaders/MasterServerInterface.h
===================================================================
--- trunk/qcell/baseheaders/MasterServerInterface.h 2006-12-11 16:48:46 UTC (rev 61)
+++ trunk/qcell/baseheaders/MasterServerInterface.h 2006-12-11 16:54:21 UTC (rev 62)
@@ -61,4 +61,4 @@
void clientListChange(int type, ClientInfo client);
};
-#endif
\ No newline at end of file
+#endif
Modified: trunk/qcell/basesources/Client.cpp
===================================================================
--- trunk/qcell/basesources/Client.cpp 2006-12-11 16:48:46 UTC (rev 61)
+++ trunk/qcell/basesources/Client.cpp 2006-12-11 16:54:21 UTC (rev 62)
@@ -393,4 +393,4 @@
else
++pingTry;
-}
\ No newline at end of file
+}
Modified: trunk/qcell/basesources/MasterServer.cpp
===================================================================
--- trunk/qcell/basesources/MasterServer.cpp 2006-12-11 16:48:46 UTC (rev 61)
+++ trunk/qcell/basesources/MasterServer.cpp 2006-12-11 16:54:21 UTC (rev 62)
@@ -613,4 +613,4 @@
void ServerInterface::emitSignal(int type, ClientInfo client)
{
emit clientListChange(type, client);
-}
\ No newline at end of file
+}
Modified: trunk/qcell/requests/requests.cpp
===================================================================
--- trunk/qcell/requests/requests.cpp 2006-12-11 16:48:46 UTC (rev 61)
+++ trunk/qcell/requests/requests.cpp 2006-12-11 16:54:21 UTC (rev 62)
@@ -195,4 +195,4 @@
MasterServerPlugin * getPlugin(MasterServerInterface *iPointer)
{
return new requests(iPointer);
-}
\ No newline at end of file
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dhu...@us...> - 2006-12-15 08:09:18
|
Revision: 64
http://svn.sourceforge.net/qcell/?rev=64&view=rev
Author: dhubleizh
Date: 2006-12-15 00:09:05 -0800 (Fri, 15 Dec 2006)
Log Message:
-----------
- new StorageInterface (initial)
- storage dir, Storage class implementing StorageInterface, some basic setup
Modified Paths:
--------------
trunk/qcell/visgui/MainWindow.cpp
trunk/qcell/visgui/MainWindow.h
trunk/qcell/visgui/main.cpp
trunk/qcell/visgui/visgui.pro
trunk/qcell/visgui/visgui_pl.qm
trunk/qcell/visgui/visgui_pl.ts
Added Paths:
-----------
trunk/qcell/baseheaders/StorageInterface.h
trunk/qcell/storage/
trunk/qcell/storage/Storage.cpp
trunk/qcell/storage/Storage.h
trunk/qcell/storage/storage.pro
Added: trunk/qcell/baseheaders/StorageInterface.h
===================================================================
--- trunk/qcell/baseheaders/StorageInterface.h (rev 0)
+++ trunk/qcell/baseheaders/StorageInterface.h 2006-12-15 08:09:05 UTC (rev 64)
@@ -0,0 +1,77 @@
+/**@file StorageInterface.h
+ * @author czarny
+ * @version 0.1
+ * @date
+ * Created: pi? 15 gru 2006 08:27:20 CET \n
+ * Last Update: pi? 15 gru 2006 08:27:20 CET
+ */
+
+#ifndef __STORAGEINTERFACE_H__
+#define __STORAGEINTERFACE_H__
+
+#include <QtPlugin>
+#include "Neighbourhood.h"
+#include "LocalFunction.h"
+
+class StorageInterface
+{
+public:
+ /**
+ * @brief Compiler warning stopper
+ */
+ virtual ~StorageInterface(){ };
+
+ /**
+ * @brief Get data from Storage
+ *
+ * @param request XML describing the request parameters
+ *
+ * @return An QByteArray of data correspinding with the request
+ */
+ virtual QByteArray loadData(QString request) = 0;
+ /**
+ * @brief Returns the whole block of data
+ *
+ * @return A block of data
+ */
+ virtual QByteArray loadWholeData() = 0;
+ /**
+ * @brief Saves given data according to the request
+ *
+ * @param request Coordinates to save to
+ * @param data Raw data
+ */
+ virtual void saveData(QString request, QByteArray data) = 0;
+ /**
+ * @brief Saves whole data block
+ *
+ * @param data Raw data
+ */
+ virtual void saveWholeWhole(QByteArray data) = 0;
+
+
+ /**
+ * @brief Retrievs Neighbourhood given by request
+ *
+ * @param request XML identyfing a Neighbourhood
+ *
+ * @return Neighbourhood
+ */
+ virtual Neighbourhood loadNeighbourhood(QString request) = 0;
+
+
+ /**
+ * @brief Returns a LocalFunction described by the request
+ *
+ * @param request An XML description of the LocalFunction
+ *
+ * @return LocalFunction
+ */
+ virtual LocalFunction loadLocalFunction(QString request) = 0;
+
+};
+
+Q_DECLARE_INTERFACE(StorageInterface,
+ "QCell.StorageInterface/1.0")
+#endif
+
Added: trunk/qcell/storage/Storage.cpp
===================================================================
--- trunk/qcell/storage/Storage.cpp (rev 0)
+++ trunk/qcell/storage/Storage.cpp 2006-12-15 08:09:05 UTC (rev 64)
@@ -0,0 +1,40 @@
+/**@file Storage.cpp
+ * @author czarny
+ * @version 0.1
+ * @date
+ * Created: pi? 15 gru 2006 08:54:08 CET \n
+ * Last Update: pi? 15 gru 2006 08:54:08 CET
+ */
+
+#include "Storage.h"
+
+QByteArray Storage::loadData(QString request)
+{
+
+}
+
+QByteArray Storage::loadWholeData()
+{
+
+}
+
+void Storage::saveData(QString request, QByteArray data)
+{
+
+}
+
+void Storage::saveWholeWhole(QByteArray data)
+{
+
+}
+
+Neighbourhood Storage::loadNeighbourhood(QString request)
+{
+
+}
+
+LocalFunction Storage::loadLocalFunction(QString request)
+{
+
+}
+
Added: trunk/qcell/storage/Storage.h
===================================================================
--- trunk/qcell/storage/Storage.h (rev 0)
+++ trunk/qcell/storage/Storage.h 2006-12-15 08:09:05 UTC (rev 64)
@@ -0,0 +1,30 @@
+/**@file Storage.h
+ * @author czarny
+ * @version 0.1
+ * @date
+ * Created: pi? 15 gru 2006 08:21:33 CET \n
+ * Last Update: pi? 15 gru 2006 08:21:33 CET
+ */
+
+#ifndef __STORAGE_H__
+#define __STORAGE_H__
+
+#include "StorageInterface.h"
+#include <QByteArray>
+
+class Storage : public QObject, public StorageInterface
+{
+ Q_OBJECT
+ Q_INTERFACES(StorageInterface)
+
+ QByteArray loadData(QString request);
+ QByteArray loadWholeData();
+ void saveData(QString request, QByteArray data);
+ void saveWholeWhole(QByteArray data);
+ Neighbourhood loadNeighbourhood(QString request);
+ LocalFunction loadLocalFunction(QString request);
+
+};
+
+#endif
+
Added: trunk/qcell/storage/storage.pro
===================================================================
--- trunk/qcell/storage/storage.pro (rev 0)
+++ trunk/qcell/storage/storage.pro 2006-12-15 08:09:05 UTC (rev 64)
@@ -0,0 +1,14 @@
+TEMPLATE = lib
+CONFIG += plugin
+QT += xml
+INCLUDEPATH = ../baseheaders
+DESTDIR = ../../libs
+TARGET = storage
+
+HEADERS = Storage.h
+
+SOURCES = Storage.cpp
+
+TRANSLATIONS = Storage_pl.ts
+
+
Modified: trunk/qcell/visgui/MainWindow.cpp
===================================================================
--- trunk/qcell/visgui/MainWindow.cpp 2006-12-15 07:31:46 UTC (rev 63)
+++ trunk/qcell/visgui/MainWindow.cpp 2006-12-15 08:09:05 UTC (rev 64)
@@ -10,9 +10,59 @@
MainWindow::MainWindow(QWidget* parent)
{
+ // GUI setup
setupUi(this);
+
+ // Plugin parsing
+ /// @todo get that code out of here!
+ ParserInterface* iParser;
+ QStringList parser_types, file_types;
+
+ // We check each static plugin if it is a parser plugin
+ // and if it is we register each parsing fucntion
+ // according to supported types and file extensions
+ foreach(QObject* plugin, QPluginLoader::staticInstances())
+ {
+ iParser = qobject_cast<ParserInterface *>(plugin);
+ // If this is a parser plugin
+ if(iParser)
+ {
+ // Get supported parser types
+ parser_types = iParser->parserTypes();
+ // For each type supported by the plugin alocate
+ // pointers accordingly
+ foreach(QString type, parser_types)
+ {
+ if(type == "Neighbourhood")
+ {
+ file_types = iParser->fileTypes("Neighbourhood");
+ foreach(QString extension, file_types)
+ {
+ neighbourhood_parsers[extension] = iParser;
+ }
+ }
+ if(type == "Function")
+ {
+ file_types = iParser->fileTypes("Function");
+ foreach(QString extension, file_types)
+ {
+ function_parsers[extension] = iParser;
+ }
+ }
+ if(type == "World")
+ {
+ file_types = iParser->fileTypes("World");
+ foreach(QString extension, file_types)
+ {
+ world_parsers[extension] = iParser;
+ }
+ }
}
+ }
+ }
+}
+
void MainWindow::on_action_About_activated()
{
QDialog* dialog = new QDialog(this);
@@ -27,3 +77,115 @@
// TODO: Some saving checking
QCoreApplication::exit();
}
+
+void MainWindow::on_action_Neighbourhood_activated()
+{
+ if(neighbourhood_parsers.count() == 0)
+ {
+ QMessageBox::warning(
+ /*parent*/ this,
+ /*title*/ tr("Plugins warning"),
+ /*message*/ tr("There are no plugins loaded to handle Neighbourhood parsing.")
+ );
+
+ return;
+
+ }
+
+ QFileDialog fd(
+ /*parent*/ this,
+ /*cation*/ tr("Open Neighbourhood")
+ );
+
+ fd.setFileMode(QFileDialog::ExistingFile);
+
+ QStringList filters;
+ QString filter;
+ // Add filter in format %{name} files (*.%{name})
+ foreach(QString key, neighbourhood_parsers.keys())
+ {
+ // Don't shorten this, as it is made for translations
+ // purposes
+ filter = key + " " + tr("files") + " (*." + key + ")";
+ filters << filter;
+ }
+ fd.setFilters(filters);
+
+ fd.exec();
+
+}
+
+void MainWindow::on_action_Function_activated()
+{
+ if(function_parsers.count() == 0)
+ {
+ QMessageBox::warning(
+ /*parent*/ this,
+ /*title*/ tr("Plugins warning"),
+ /*message*/ tr("There are no plugins loaded to handle Function parsing.")
+ );
+
+ return;
+
+ }
+
+ QFileDialog fd(
+ /*parent*/ this,
+ /*cation*/ tr("Open Function")
+ );
+
+ fd.setFileMode(QFileDialog::ExistingFile);
+
+ QStringList filters;
+ QString filter;
+ // Add filter in format %{name} files (*.%{name})
+ foreach(QString key, function_parsers.keys())
+ {
+ // Don't shorten this, as it is made for translations
+ // purposes
+ filter = key + " " + tr("files") + " (*." + key + ")";
+ filters << filter;
+ }
+ fd.setFilters(filters);
+
+ fd.exec();
+
+}
+
+void MainWindow::on_action_World_activated()
+{
+ if(world_parsers.count() == 0)
+ {
+ QMessageBox::warning(
+ /*parent*/ this,
+ /*title*/ tr("Plugins warning"),
+ /*message*/ tr("There are no plugins loaded to handle World parsing.")
+ );
+
+ return;
+
+ }
+
+ QFileDialog fd(
+ /*parent*/ this,
+ /*cation*/ tr("Open World")
+ );
+
+ fd.setFileMode(QFileDialog::ExistingFile);
+
+ QStringList filters;
+ QString filter;
+ // Add filter in format %{name} files (*.%{name})
+ foreach(QString key, world_parsers.keys())
+ {
+ // Don't shorten this, as it is made for translations
+ // purposes
+ filter = key + " " + tr("files") + " (*." + key + ")";
+ filters << filter;
+ }
+ fd.setFilters(filters);
+
+ fd.exec();
+
+}
+
Modified: trunk/qcell/visgui/MainWindow.h
===================================================================
--- trunk/qcell/visgui/MainWindow.h 2006-12-15 07:31:46 UTC (rev 63)
+++ trunk/qcell/visgui/MainWindow.h 2006-12-15 08:09:05 UTC (rev 64)
@@ -11,20 +11,35 @@
#include "ui_MainWindow.h"
#include "ui_AboutDialog.h"
+#include <QPluginLoader>
+#include "GenericParserPlugin.h"
+#include <QFileDialog>
+#include <QMessageBox>
#include <iostream>
using namespace std;
+typedef QString (*parser_fun)(QByteArray content, QString type, QString subtype);
+
class MainWindow : public QMainWindow, private Ui::MainWindow
{
Q_OBJECT
public:
- MainWindow(QWidget* parent = 0);
+ MainWindow(QWidget* parent = 0);
private slots:
- void on_action_About_activated();
- void on_action_Quit_activated();
+ void on_action_About_activated();
+ void on_action_Quit_activated();
+ void on_action_Neighbourhood_activated();
+ void on_action_Function_activated();
+ void on_action_World_activated();
+
+private:
+ QMap<QString, ParserInterface*> neighbourhood_parsers;
+ QMap<QString, ParserInterface*> function_parsers;
+ QMap<QString, ParserInterface*> world_parsers;
+
};
#endif
Modified: trunk/qcell/visgui/main.cpp
===================================================================
--- trunk/qcell/visgui/main.cpp 2006-12-15 07:31:46 UTC (rev 63)
+++ trunk/qcell/visgui/main.cpp 2006-12-15 08:09:05 UTC (rev 64)
@@ -8,6 +8,8 @@
using namespace std;
Q_IMPORT_PLUGIN(NFileParser);
+//Q_IMPORT_PLUGIN(FQTFileParser);
+//Q_IMPORT_PLUGIN(KIFileParser);
int main(int argc, char* argv[])
{
@@ -17,28 +19,16 @@
if(c.initClient())
{
}
-
QString locale = QLocale::system().name();
QTranslator translator;
translator.load(QString("visgui_") + locale);
app.installTranslator(&translator);
- foreach(QObject* plugin, QPluginLoader::staticInstances())
- {
- ParserInterface* iParser = qobject_cast<ParserInterface *>(plugin);
- if(iParser)
- {
- QStringList lista = iParser->fileTypes();
- QString str = lista[0];
- cout << str.toStdString() << endl;
- }
- }
-
MainWindow mw;
mw.show();
-
+
return app.exec();
}
Modified: trunk/qcell/visgui/visgui.pro
===================================================================
--- trunk/qcell/visgui/visgui.pro 2006-12-15 07:31:46 UTC (rev 63)
+++ trunk/qcell/visgui/visgui.pro 2006-12-15 08:09:05 UTC (rev 64)
@@ -3,16 +3,22 @@
CONFIG += thread warn_on debug
QT += network xml
+INCLUDEPATH = ../baseheaders
+
FORMS = MainWindow.ui \
AboutDialog.ui
HEADERS = MainWindow.h \
../baseheaders/Client.h \
../baseheaders/ClientInfo.h \
- ../baseheaders/interfaces.h
-SOURCES = main.cpp \
+ ../baseheaders/interfaces.h \
+ ../baseheaders/GenericParserPlugin.h \
+ ../baseheaders/Neighbourhood.h
+SOURCES = ../basesources/GenericParserPlugin.cpp \
+ main.cpp \
MainWindow.cpp \
../basesources/Client.cpp \
- ../basesources/ClientInfo.cpp
+ ../basesources/ClientInfo.cpp \
+ ../basesources/Neighbourhood.cpp
LIBS = -L../libs -lN
Modified: trunk/qcell/visgui/visgui_pl.qm
===================================================================
(Binary files differ)
Modified: trunk/qcell/visgui/visgui_pl.ts
===================================================================
--- trunk/qcell/visgui/visgui_pl.ts 2006-12-15 07:31:46 UTC (rev 63)
+++ trunk/qcell/visgui/visgui_pl.ts 2006-12-15 08:09:05 UTC (rev 64)
@@ -14,6 +14,19 @@
</message>
</context>
<context>
+ <name>GenericParserPlugin</name>
+ <message>
+ <location filename="../baseheaders/GenericParserPlugin.h" line="61"/>
+ <source>The plugin type %1 is not supported by this plugin.</source>
+ <translation>Typ wtyczki %1 nie jest wspierany przez te wtyczkę.</translation>
+ </message>
+ <message>
+ <location filename="../basesources/GenericParserPlugin.cpp" line="67"/>
+ <source>This plugin doesn't support parsing of type %1. It supports %2.</source>
+ <translation>Ta wtyczka nie obsługuję parsowania typu %1. Wspiera typ %2.</translation>
+ </message>
+</context>
+<context>
<name>MainWindow</name>
<message>
<location filename="MainWindow.ui" line="13"/>
@@ -121,5 +134,20 @@
<source>Shows info about the program.</source>
<translation>Pokazuje informacje o programie.</translation>
</message>
+ <message>
+ <location filename="MainWindow.cpp" line="71"/>
+ <source>Open Neighbourhood</source>
+ <translation>Otwórz Sąsiedztwo</translation>
+ </message>
+ <message>
+ <location filename="MainWindow.cpp" line="80"/>
+ <source> files (*.</source>
+ <translation type="obsolete"> pliki</translation>
+ </message>
+ <message>
+ <location filename="MainWindow.cpp" line="82"/>
+ <source>files</source>
+ <translation>pliki</translation>
+ </message>
</context>
</TS>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dhu...@us...> - 2006-12-15 09:10:53
|
Revision: 65
http://svn.sourceforge.net/qcell/?rev=65&view=rev
Author: dhubleizh
Date: 2006-12-15 01:10:52 -0800 (Fri, 15 Dec 2006)
Log Message:
-----------
- added name parameter to toXmlString
- added name atrribute to generated XML to distinguish files in database
Modified Paths:
--------------
trunk/qcell/baseheaders/Neighbourhood.h
trunk/qcell/basesources/Neighbourhood.cpp
Modified: trunk/qcell/baseheaders/Neighbourhood.h
===================================================================
--- trunk/qcell/baseheaders/Neighbourhood.h 2006-12-15 08:09:05 UTC (rev 64)
+++ trunk/qcell/baseheaders/Neighbourhood.h 2006-12-15 09:10:52 UTC (rev 65)
@@ -49,7 +49,7 @@
bool fromXmlString(QString *xmlString);
bool fromDomElement(QDomElement *xmlElement);
- QString toXmlString();
+ QString toXmlString(QString name);
int getNeighbourNumber(void);
bool getBoolValueOf(int index);
int getIntValueOf(int index);
Modified: trunk/qcell/basesources/Neighbourhood.cpp
===================================================================
--- trunk/qcell/basesources/Neighbourhood.cpp 2006-12-15 08:09:05 UTC (rev 64)
+++ trunk/qcell/basesources/Neighbourhood.cpp 2006-12-15 09:10:52 UTC (rev 65)
@@ -220,12 +220,13 @@
return 0;
}
-QString Neighbourhood::toXmlString()
+QString Neighbourhood::toXmlString(QString name)
{
QDomDocument doc;
QDomElement root, element;
NContainer temp;
root = doc.createElement("Neighbourhood");
+ root.setAttribute( "name", name );
doc.appendChild(root);
foreach(temp, neighbourVector)
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dhu...@us...> - 2006-12-15 09:23:44
|
Revision: 66
http://svn.sourceforge.net/qcell/?rev=66&view=rev
Author: dhubleizh
Date: 2006-12-15 01:23:43 -0800 (Fri, 15 Dec 2006)
Log Message:
-----------
- the idea of filename in Neighbourhood wasn't good
- better implement that somewhere upper
Modified Paths:
--------------
trunk/qcell/baseheaders/Neighbourhood.h
trunk/qcell/basesources/Neighbourhood.cpp
Modified: trunk/qcell/baseheaders/Neighbourhood.h
===================================================================
--- trunk/qcell/baseheaders/Neighbourhood.h 2006-12-15 09:10:52 UTC (rev 65)
+++ trunk/qcell/baseheaders/Neighbourhood.h 2006-12-15 09:23:43 UTC (rev 66)
@@ -49,7 +49,7 @@
bool fromXmlString(QString *xmlString);
bool fromDomElement(QDomElement *xmlElement);
- QString toXmlString(QString name);
+ QString toXmlString();
int getNeighbourNumber(void);
bool getBoolValueOf(int index);
int getIntValueOf(int index);
Modified: trunk/qcell/basesources/Neighbourhood.cpp
===================================================================
--- trunk/qcell/basesources/Neighbourhood.cpp 2006-12-15 09:10:52 UTC (rev 65)
+++ trunk/qcell/basesources/Neighbourhood.cpp 2006-12-15 09:23:43 UTC (rev 66)
@@ -220,13 +220,12 @@
return 0;
}
-QString Neighbourhood::toXmlString(QString name)
+QString Neighbourhood::toXmlString()
{
QDomDocument doc;
QDomElement root, element;
NContainer temp;
root = doc.createElement("Neighbourhood");
- root.setAttribute( "name", name );
doc.appendChild(root);
foreach(temp, neighbourVector)
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|