diff --git a/ZoomPipeline_FuncSvr/ZoomPipeline_FuncSvr.pro b/ZoomPipeline_FuncSvr/ZoomPipeline_FuncSvr.pro index 839c96836de28e560a224039183fbcad864026e5..b2d44a2473be047349b03c989a9ed011cac1c600 100644 --- a/ZoomPipeline_FuncSvr/ZoomPipeline_FuncSvr.pro +++ b/ZoomPipeline_FuncSvr/ZoomPipeline_FuncSvr.pro @@ -5,7 +5,7 @@ #------------------------------------------------- QT += core gui network sql - +unix:QMAKE_CXXFLAGS += -std=c++11 greaterThan(QT_MAJOR_VERSION, 4): QT += widgets TARGET = ZoomPipeline_FuncSvr @@ -13,51 +13,51 @@ TEMPLATE = app SOURCES += main.cpp\ - zpmainframe.cpp \ - network/zp_tcpserver.cpp \ - network/zp_nettransthread.cpp \ - network/zp_netlistenthread.cpp \ - network/zp_net_threadpool.cpp \ - pipeline/zp_pipeline.cpp \ - smartlink/st_client_table.cpp \ - pipeline/zp_plworkingthread.cpp \ - pipeline/zp_pltaskbase.cpp \ - database/databaseresource.cpp \ - smartlink/st_clientnode_basetrans.cpp \ - smartlink/st_clientnode_app_imp.cpp \ - smartlink/st_clientnode_applayer.cpp \ - cluster/zp_clusterterm.cpp \ - dialogaddressinput.cpp \ - cluster/zp_clusternode.cpp \ - smartlink/st_cross_svr_node.cpp + zpmainframe.cpp \ + network/zp_tcpserver.cpp \ + network/zp_nettransthread.cpp \ + network/zp_netlistenthread.cpp \ + network/zp_net_threadpool.cpp \ + pipeline/zp_pipeline.cpp \ + smartlink/st_client_table.cpp \ + pipeline/zp_plworkingthread.cpp \ + pipeline/zp_pltaskbase.cpp \ + database/databaseresource.cpp \ + smartlink/st_clientnode_basetrans.cpp \ + smartlink/st_clientnode_app_imp.cpp \ + smartlink/st_clientnode_applayer.cpp \ + cluster/zp_clusterterm.cpp \ + dialogaddressinput.cpp \ + cluster/zp_clusternode.cpp \ + smartlink/st_cross_svr_node.cpp HEADERS += zpmainframe.h \ - network/zp_tcpserver.h \ - network/zp_nettransthread.h \ - network/zp_netlistenthread.h \ - network/zp_net_threadpool.h \ - pipeline/zp_pipeline.h \ - smartlink/st_client_table.h \ - pipeline/zp_plworkingthread.h \ - smartlink/st_message.h \ - pipeline/zp_pltaskbase.h \ - database/databaseresource.h \ - smartlink/st_msg_applayer.h \ - smartlink/st_clientnode_basetrans.h \ - smartlink/st_clientnode_applayer.h \ - cluster/zp_clusterterm.h \ - cluster/cross_svr_messages.h \ - dialogaddressinput.h \ - cluster/zp_clusternode.h \ - smartlink/st_cross_svr_msg.h \ - smartlink/st_cross_svr_node.h + network/zp_tcpserver.h \ + network/zp_nettransthread.h \ + network/zp_netlistenthread.h \ + network/zp_net_threadpool.h \ + pipeline/zp_pipeline.h \ + smartlink/st_client_table.h \ + pipeline/zp_plworkingthread.h \ + smartlink/st_message.h \ + pipeline/zp_pltaskbase.h \ + database/databaseresource.h \ + smartlink/st_msg_applayer.h \ + smartlink/st_clientnode_basetrans.h \ + smartlink/st_clientnode_applayer.h \ + cluster/zp_clusterterm.h \ + cluster/cross_svr_messages.h \ + dialogaddressinput.h \ + cluster/zp_clusternode.h \ + smartlink/st_cross_svr_msg.h \ + smartlink/st_cross_svr_node.h FORMS += zpmainframe.ui \ - dialogaddressinput.ui + dialogaddressinput.ui RESOURCES += \ - resource.qrc + resource.qrc OTHER_FILES += \ - ZoomPipeline_FuncSvr_zh_CN.ts + ZoomPipeline_FuncSvr_zh_CN.ts diff --git a/ZoomPipeline_FuncSvr/smartlink/st_client_table.cpp b/ZoomPipeline_FuncSvr/smartlink/st_client_table.cpp index 639034fc64b907a317ed0e8967874a7274925ab8..2c11f2d9428db5951d578aa8da8304920a32a50d 100644 --- a/ZoomPipeline_FuncSvr/smartlink/st_client_table.cpp +++ b/ZoomPipeline_FuncSvr/smartlink/st_client_table.cpp @@ -1,7 +1,10 @@ #include "st_client_table.h" #include "st_clientnode_applayer.h" #include +#include "st_cross_svr_node.h" +#include namespace SmartLink{ + using namespace std::placeholders; st_client_table::st_client_table( ZPNetwork::zp_net_Engine * NetEngine, ZPTaskEngine::zp_pipeline * taskeng, @@ -25,8 +28,11 @@ namespace SmartLink{ connect (m_pCluster,&ZP_Cluster::zp_ClusterTerm::evt_NewSvrDisconnected,this,&st_client_table::on_evt_NewSvrDisconnected,Qt::QueuedConnection); connect (m_pCluster,&ZP_Cluster::zp_ClusterTerm::evt_RemoteData_recieved,this,&st_client_table::on_evt_RemoteData_recieved,Qt::QueuedConnection); connect (m_pCluster,&ZP_Cluster::zp_ClusterTerm::evt_RemoteData_transferred,this,&st_client_table::on_evt_RemoteData_transferred,Qt::QueuedConnection); - Reg_st_cross_svr_node(m_pCluster); - + m_pCluster->SetNodeFactory( + std::bind(&st_client_table::cross_svr_node_factory, + this, + _1,_2,_3) + ); } int st_client_table::heartBeatingThrd() @@ -290,6 +296,14 @@ namespace SmartLink{ { } - + ZP_Cluster::zp_ClusterNode * st_client_table::cross_svr_node_factory( + ZP_Cluster::zp_ClusterTerm * pTerm, + QObject * psock, + QObject * parent) + { + st_cross_svr_node * pNode = new st_cross_svr_node(pTerm,psock,parent); + pNode->setClientTable(this); + return pNode; + } } diff --git a/ZoomPipeline_FuncSvr/smartlink/st_client_table.h b/ZoomPipeline_FuncSvr/smartlink/st_client_table.h index 2fa7bd31d8f850ec59eccc2eed4d3b2b2faf44ff..44639c9a3ff69913840e5d5715a5a0818f200759 100644 --- a/ZoomPipeline_FuncSvr/smartlink/st_client_table.h +++ b/ZoomPipeline_FuncSvr/smartlink/st_client_table.h @@ -5,7 +5,7 @@ #include #include #include -#include +#include #include "../network/zp_net_threadpool.h" #include "../pipeline/zp_pipeline.h" #include "./st_message.h" @@ -26,6 +26,7 @@ namespace SmartLink{ ,QObject *parent = 0); ~st_client_table(); + bool regisitClientUUID(st_clientNode_baseTrans *); st_clientNode_baseTrans * clientNodeFromUUID(quint32); st_clientNode_baseTrans * clientNodeFromSocket(QObject *); @@ -70,8 +71,12 @@ namespace SmartLink{ QString m_largeFileFolder; //cluster Nodes Map - std::hash_map m_hash_remoteClient2SvrName; - + std::unordered_map m_hash_remoteClient2SvrName; + //Cluster Node Factory + ZP_Cluster::zp_ClusterNode * cross_svr_node_factory( + ZP_Cluster::zp_ClusterTerm * /*pTerm*/, + QObject * /*psock*/, + QObject * /*parent*/); signals: diff --git a/ZoomPipeline_FuncSvr/smartlink/st_cross_svr_node.cpp b/ZoomPipeline_FuncSvr/smartlink/st_cross_svr_node.cpp index 83b9f8212b4430a9b7fb6b3730810c499d5fc0f2..d2414f235cc82bd794b5537a9c09f3188d13f3aa 100644 --- a/ZoomPipeline_FuncSvr/smartlink/st_cross_svr_node.cpp +++ b/ZoomPipeline_FuncSvr/smartlink/st_cross_svr_node.cpp @@ -1,18 +1,7 @@ #include "st_cross_svr_node.h" #include "../cluster/zp_clusterterm.h" +#include "st_client_table.h" namespace SmartLink{ - ZP_Cluster::zp_ClusterNode * st_cross_svr_node_factory( - ZP_Cluster::zp_ClusterTerm * pTerm, - QObject * psock, - QObject * parent) - { - return new st_cross_svr_node(pTerm,psock,parent); - } - - void Reg_st_cross_svr_node(ZP_Cluster::zp_ClusterTerm *pTerm ) - { - pTerm->SetNodeFactory(st_cross_svr_node_factory); - } st_cross_svr_node::st_cross_svr_node(ZP_Cluster::zp_ClusterTerm * pTerm, QObject * psock,QObject *parent) :ZP_Cluster::zp_ClusterNode(pTerm,psock,parent) @@ -22,5 +11,9 @@ namespace SmartLink{ { return ZP_Cluster::zp_ClusterNode::deal_user_data(array); } + void st_cross_svr_node::setClientTable(st_client_table * table) + { + this->m_pClientTable = table; + } } diff --git a/ZoomPipeline_FuncSvr/smartlink/st_cross_svr_node.h b/ZoomPipeline_FuncSvr/smartlink/st_cross_svr_node.h index daa0455332764ba2e746f72d8d58d09b390295dc..7df136ea1881dd71a7b9db8004ed42dba17c4894 100644 --- a/ZoomPipeline_FuncSvr/smartlink/st_cross_svr_node.h +++ b/ZoomPipeline_FuncSvr/smartlink/st_cross_svr_node.h @@ -2,22 +2,18 @@ #define ST_CROSS_SVR_NODE_H #include "../cluster/zp_clusternode.h" namespace SmartLink{ - - ZP_Cluster::zp_ClusterNode * st_cross_svr_node_factory( - ZP_Cluster::zp_ClusterTerm * /*pTerm*/, - QObject * /*psock*/, - QObject * /*parent*/); - - void Reg_st_cross_svr_node(ZP_Cluster::zp_ClusterTerm *pTerm ); - + class st_client_table; class st_cross_svr_node : public ZP_Cluster::zp_ClusterNode { Q_OBJECT public: st_cross_svr_node(ZP_Cluster::zp_ClusterTerm * pTerm, QObject * psock,QObject *parent); + void setClientTable(st_client_table * table); protected: //!virtual functions, dealing with the user-defined operations. virtual bool deal_user_data(const QByteArray &); + protected: + st_client_table * m_pClientTable; }; } #endif // ST_CROSS_SVR_NODE_H