Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_45630965
zoompipeline
提交
1da9a28c
zoompipeline
项目概览
weixin_45630965
/
zoompipeline
与 Fork 源项目一致
Fork自
colorEagleStdio / zoompipeline
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
zoompipeline
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
1da9a28c
编写于
4月 13, 2014
作者:
丁劲犇
😸
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add debug method, to display the HEX data
上级
c225ff8f
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
105 addition
and
13 deletion
+105
-13
DatabaseMod/smartlink_svr.sqlite
DatabaseMod/smartlink_svr.sqlite
+0
-0
ZoomPipeline_FuncSvr/database/databaseresource.cpp
ZoomPipeline_FuncSvr/database/databaseresource.cpp
+32
-2
ZoomPipeline_FuncSvr/database/databaseresource.h
ZoomPipeline_FuncSvr/database/databaseresource.h
+7
-3
ZoomPipeline_FuncSvr/pipeline/zp_pipeline.cpp
ZoomPipeline_FuncSvr/pipeline/zp_pipeline.cpp
+35
-4
ZoomPipeline_FuncSvr/pipeline/zp_pipeline.h
ZoomPipeline_FuncSvr/pipeline/zp_pipeline.h
+6
-1
ZoomPipeline_FuncSvr/pipeline/zp_plworkingthread.cpp
ZoomPipeline_FuncSvr/pipeline/zp_plworkingthread.cpp
+16
-0
ZoomPipeline_FuncSvr/pipeline/zp_plworkingthread.h
ZoomPipeline_FuncSvr/pipeline/zp_plworkingthread.h
+5
-2
ZoomPipeline_FuncSvr/smartlink/st_clientnode_applayer.cpp
ZoomPipeline_FuncSvr/smartlink/st_clientnode_applayer.cpp
+4
-1
未找到文件。
DatabaseMod/smartlink_svr.sqlite
浏览文件 @
1da9a28c
无法预览此类型文件
ZoomPipeline_FuncSvr/database/databaseresource.cpp
浏览文件 @
1da9a28c
...
...
@@ -11,8 +11,14 @@ namespace ZPDatabase{
{
bTerm
=
false
;
}
//!Get an database connection belong to current thread.
//!if database does not exist, it will be added using dbtype
/**
* @brief Get an database connection belong to current thread.
* if database does not exist, it will be added using dbtype
* @fn DatabaseResource::databse
* @param strDBName the database name
* @return QSqlDatabase return the database object
*/
QSqlDatabase
DatabaseResource
::
databse
(
const
QString
&
strDBName
)
{
QMutexLocker
locker
(
&
m_mutex_reg
);
...
...
@@ -58,6 +64,22 @@ namespace ZPDatabase{
m_dbNames
.
remove
(
strDBName
)
;
}
/**
* @brief add a database connection resource
*
* @fn DatabaseResource::addConnection
* @param connName the user-specified name standing for this connection
* @param type the Qt-Sql database driver name, QPSQL, QMYSQL, etc.
* @param HostAddr the host address will connect to.
* @param port the port will connect to.
* @param dbName the database schema name
* @param User username
* @param Pass password
* @param ExtraOptions some extra options.
* @param testSQL if this para is not empty, confirmConnection will call this SQL to confirm the db is OK,
* for example, select 1+1 , will return 2 if db is ok.
* @return bool succeed : true
*/
bool
DatabaseResource
::
addConnection
(
const
QString
&
connName
,
const
QString
&
type
,
...
...
@@ -114,6 +136,14 @@ namespace ZPDatabase{
m_dbNames
.
remove
(
connName
)
;
return
false
;
}
/**
* @brief this method runs in a special guarding thread
* to confirm the connection resource is still OK
* see DatabaseResource::run()
* @fn DatabaseResource::confirmConnection
* @param connName the connection name which to be tested.
* @return bool the check result.
*/
bool
DatabaseResource
::
confirmConnection
(
const
QString
&
connName
)
{
QMutexLocker
locker
(
&
m_mutex_reg
);
...
...
ZoomPipeline_FuncSvr/database/databaseresource.h
浏览文件 @
1da9a28c
...
...
@@ -7,10 +7,14 @@
#include <QString>
#include <QMutex>
#include <QThread>
//!this class provide an database reource,
//!In different thread, workers can get existing db connections
//! immediately without re-creation operations.
namespace
ZPDatabase
{
/**
* @brief this class provide an database reource pool.In different thread, workers can get existing db connections
* immediately without re-creation operations. The working thread does not maintain db connections, instead of
* maintaining, it just using db resources from DatabaseResource
* @class DatabaseResource databaseresource.h "ZoomPipeline_FuncSvr/database/databaseresource.h"
*/
class
DatabaseResource
:
public
QThread
{
Q_OBJECT
...
...
ZoomPipeline_FuncSvr/pipeline/zp_pipeline.cpp
浏览文件 @
1da9a28c
...
...
@@ -6,6 +6,13 @@ namespace ZPTaskEngine{
m_nExistingThreads
=
0
;
}
/**
* @brief Add nThreads to the thread pool
*
* @fn zp_pipeline::addThreads
* @param nThreads how many threads you want to add.
* @return int current threads count after add.
*/
int
zp_pipeline
::
addThreads
(
int
nThreads
)
{
if
(
nThreads
>=
1
&&
nThreads
<=
128
)
...
...
@@ -31,7 +38,13 @@ namespace ZPTaskEngine{
return
m_vec_workingThreads
.
size
();
}
//remove n threads and kill them.nthreads=-1 means kill all.
/**
* @brief remove n threads and kill them.nthreads=-1 means kill all.
*
* @fn zp_pipeline::removeThreads
* @param nThreads how many threads to kill
* @return int the threads count after del
*/
int
zp_pipeline
::
removeThreads
(
int
nThreads
)
{
int
nsz
=
m_vec_workingThreads
.
size
();
...
...
@@ -47,8 +60,13 @@ namespace ZPTaskEngine{
return
m_vec_workingThreads
.
size
();
}
//Threads call this function to get next task, task will be popped from list.
/**
* @brief Threads call this function to get next task, task will be popped from list.
*
* @fn zp_pipeline::popTask
* @param bValid return whether this task is valid
* @return zp_plTaskBase the top-task in queue
*/
zp_plTaskBase
*
zp_pipeline
::
popTask
(
bool
*
bValid
)
{
*
bValid
=
false
;
...
...
@@ -64,7 +82,13 @@ namespace ZPTaskEngine{
return
funcres
;
}
//Call this function to insert func
/**
* @brief Call this function to insert an task into queue.
* task will be put into the tail of the fifo
* @fn zp_pipeline::pushTask
* @param task the pointer to this task object
* @param bFire if true, will fire an deal-event immediately
*/
void
zp_pipeline
::
pushTask
(
zp_plTaskBase
*
task
,
bool
bFire
)
{
m_mutex_protect
.
lock
();
...
...
@@ -111,6 +135,13 @@ namespace ZPTaskEngine{
return
idle
;
}
/**
* @brief this slot will be called when a task is finished,
* in this method, it will check whether the queue is still not empty
* and fire the event to deal with next job.
* @fn zp_pipeline::on_finished_task
* @param task
*/
void
zp_pipeline
::
on_finished_task
(
zp_plWorkingThread
*
task
)
{
int
res
=
0
;
...
...
ZoomPipeline_FuncSvr/pipeline/zp_pipeline.h
浏览文件 @
1da9a28c
...
...
@@ -9,7 +9,7 @@
#include <QThread>
#include "zp_plworkingthread.h"
#include "zp_pltaskbase.h"
/*!
/*
*
!
The pipe line will process each task item group by group.
quit your task as soon as possible, so that other tasks can get more cpu time.
*/
...
...
@@ -18,6 +18,11 @@ namespace ZPTaskEngine{
class
zp_plWorkingThread
;
/**
* @brief the task engine class. hold some threads to do fifo-like tasks.
*
* @class zp_pipeline zp_pipeline.h "ZoomPipeline_FuncSvr/pipeline/zp_pipeline.h"
*/
class
zp_pipeline
:
public
QObject
{
Q_OBJECT
...
...
ZoomPipeline_FuncSvr/pipeline/zp_plworkingthread.cpp
浏览文件 @
1da9a28c
...
...
@@ -11,6 +11,15 @@ namespace ZPTaskEngine{
m_bBusy
=
false
;
}
/**
* @brief This slot mark this zp_plWorkingThread object
* as stopped. when tasks belong to this zp_plWorkingThread has been
* finished, it will quit.
*
* @fn zp_plWorkingThread::setStopMark
* @param obj the zp_plWorkingThread object recieved by signal-slot system.
* this method will omit zp_plWorkingThread objs except for it self.
*/
void
zp_plWorkingThread
::
setStopMark
(
zp_plWorkingThread
*
obj
)
{
if
(
obj
!=
this
)
...
...
@@ -23,6 +32,13 @@ namespace ZPTaskEngine{
QThread
::
currentThread
()
->
quit
();
}
/**
* @brief Call zp_plTaskBase::popTask to fetch new tasks.
*
* @fn zp_plWorkingThread::FetchNewTask
* @param obj the zp_plWorkingThread object recieved by signal-slot system.
* this method will omit zp_plWorkingThread objs except for it self.
*/
void
zp_plWorkingThread
::
FetchNewTask
(
zp_plWorkingThread
*
obj
)
{
...
...
ZoomPipeline_FuncSvr/pipeline/zp_plworkingthread.h
浏览文件 @
1da9a28c
...
...
@@ -6,8 +6,11 @@
namespace
ZPTaskEngine
{
class
zp_pipeline
;
//Working thread, reading functions from queue,
//running tasks
/**
* @brief /Working thread, reading functions from queue,
* call the tasks' "run" method, doing actual works.
* @class zp_plWorkingThread zp_plworkingthread.h "ZoomPipeline_FuncSvr/pipeline/zp_plworkingthread.h"
*/
class
zp_plWorkingThread
:
public
QObject
{
Q_OBJECT
...
...
ZoomPipeline_FuncSvr/smartlink/st_clientnode_applayer.cpp
浏览文件 @
1da9a28c
...
...
@@ -135,6 +135,7 @@ namespace SmartLink{
{
//then , Start deal to-server messages
//Server - deal messages
emit
evt_Message
(
"Debug:"
+
m_currentBlock
.
toHex
());
if
(
m_currentHeader
.
destin_id
==
0x00000001
)
{
if
(
this
->
m_bLoggedIn
==
false
||
this
->
m_bUUIDRecieved
==
false
)
...
...
@@ -229,7 +230,8 @@ namespace SmartLink{
bool
st_clientNodeAppLayer
::
Deal_ToServer_Handshakes
()
{
bool
res
=
true
;
//qDebug()<<m_currentHeader.data_length<<"\n";
//qDebug()<<this->m_currentBlock.toHex()<<"\n";
if
(
m_currentHeader
.
data_length
<
sizeof
(
SMARTLINK_MSG_APP
::
tag_app_layer_header
))
return
false
;
if
(
m_currentMessageSize
<
sizeof
(
SMARTLINK_MSG
)
-
1
+
sizeof
(
SMARTLINK_MSG_APP
::
tag_app_layer_header
))
...
...
@@ -250,6 +252,7 @@ namespace SmartLink{
return
false
;
}
//do
qDebug
()
<<
m_current_app_header
.
header
.
MsgType
<<
"
\n
"
;
switch
(
m_current_app_header
.
header
.
MsgType
)
{
case
0x1000
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录