1 Star 0 Fork 121

blog/kbengine

forked from likecg/kbengine 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
data_download.hpp 2.55 KB
一键复制 编辑 原始数据 按行查看 历史
liquidx 提交于 2013-06-09 15:10 +08:00 . added ProxySender.
/*
This source file is part of KBEngine
For the latest info, see http://www.kbengine.org/
Copyright (c) 2008-2012 KBEngine.
KBEngine is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
KBEngine is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with KBEngine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __DATA_DOWNLOAD__
#define __DATA_DOWNLOAD__
#include "helper/debug_helper.hpp"
#include "cstdkbe/cstdkbe.hpp"
#include "cstdkbe/memorystream.hpp"
#include "thread/threadtask.hpp"
#include "network/message_handler.hpp"
namespace KBEngine{
class DataDownloads;
class DataDownload : public thread::TPTask
{
public:
DataDownload(PyObjectPtr objptr,
const std::string & descr, int16 id);
virtual ~DataDownload();
virtual bool checkDescr(){ return true; }
void pDataDownloads(DataDownloads* pDataDownloads){ pDataDownloads_ = pDataDownloads; }
DataDownloads* pDataDownloads(){ return pDataDownloads_; }
virtual thread::TPTask::TPTaskState presentMainThread();
void entityID(ENTITY_ID entityID){ entityID_ = entityID; }
ENTITY_ID entityID(){ return entityID_; }
bool send(const Mercury::MessageHandler& msgHandler, Mercury::Bundle* pBundle);
void id(int16 i){ id_ = i; }
int16 id()const{ return id_; }
uint32 totalBytes()const{ return totalBytes_; }
virtual char* getOutStream(){ return stream_; }
virtual int8 type() = 0;
protected:
PyObjectPtr objptr_;
std::string descr_;
int16 id_;
DataDownloads* pDataDownloads_;
bool sentStart_;
uint32 totalBytes_;
// ܹ͵ֽ
uint32 totalSentBytes_;
uint32 remainSent_;
uint32 currSent_;
char* stream_;
ENTITY_ID entityID_;
bool error_;
};
class StringDataDownload : public DataDownload
{
public:
StringDataDownload(PyObjectPtr objptr,
const std::string & descr, int16 id);
virtual ~StringDataDownload();
virtual bool process();
virtual char* getOutStream();
virtual int8 type();
};
class FileDataDownload : public DataDownload
{
public:
FileDataDownload(PyObjectPtr objptr,
const std::string & descr, int16 id);
virtual ~FileDataDownload();
virtual bool process();
virtual int8 type();
protected:
std::string path_;
};
}
#endif
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/blog/kbengine.git
git@gitee.com:blog/kbengine.git
blog
kbengine
kbengine
a1b691f57f98fa0bff1bcfb0210ebd07e318c0cd

搜索帮助