TarzaNN
TarzaNN neural network simulator
C:/Users/albertlr/projects/TarzaNN/TarzaNN/Node.h
Go to the documentation of this file.
00001 #ifndef NODE_H_INCLUDED
00002 #define NODE_H_INCLUDED
00003 #include <vector>
00004 
00005 #include "NodeAbstract.h"
00006 #include "FeaturePlaneAbstract.h"
00007 
00008 #include <q3socketdevice.h>
00009 #include <q3serversocket.h>
00010 #include <QTextStream>
00011 #include <QThread>
00012 #include <stdlib.h>
00013 
00014 using namespace std;
00015 
00016 class Node;
00017 
00019 class ClientSocket:public QThread{
00020    public:
00021     ClientSocket( Node* n, int sock)  :node(n){
00022                 qsd=new Q3SocketDevice(sock, Q3SocketDevice::Stream);
00023     }
00024     ~ClientSocket(){}
00025 
00026         Q3SocketDevice* qsd;
00027 
00028     void run(){
00029                 int b;
00030                 
00031                 while (1) {
00032                         b=qsd->waitForMore(1);
00033                         if(b)
00034                                 readClient();
00035                 }
00036         }
00037         
00038         void readClient();
00039 private:
00040         Node* node;
00041 };
00042 
00046 class Node : public Q3ServerSocket, public NodeAbstract{
00047     Q_OBJECT
00048 public:
00049     Node(int port, QObject* parent=0);
00050     void newConnection( int socket );
00051 
00052     ~Node();
00053     void setFPList( vector<FeaturePlaneAbstract*>* fpList);
00054     vector<FeaturePlaneAbstract*>* _featurePlaneList;
00055         
00056         void printType();
00057         bool isLocal();
00058 };
00059 #endif //NODE_H_INCLUDED
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines