• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ kbengine::MemoryStream类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中kbengine::MemoryStream的典型用法代码示例。如果您正苦于以下问题:C++ MemoryStream类的具体用法?C++ MemoryStream怎么用?C++ MemoryStream使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了MemoryStream类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: onLoginAccountCB

//-------------------------------------------------------------------------------------
void BillingHandler_ThirdParty::onLoginAccountCB(KBEngine::MemoryStream& s)
{
	std::string loginName, accountName, password, postdatas, getdatas;
	COMPONENT_ID cid;
	SERVER_ERROR_CODE success = SERVER_ERR_OP_FAILED;

	s >> cid >> loginName >> accountName >> password >> success;
	s.readBlob(postdatas);
	s.readBlob(getdatas);

	if(!success)
	{
		accountName = "";
	}

	Components::ComponentInfos* cinfos = Components::getSingleton().findComponent(LOGINAPP_TYPE, cid);
	if(cinfos == NULL || cinfos->pChannel == NULL)
	{
		ERROR_MSG("BillingHandler_ThirdParty::onCreateAccountCB: loginapp not found!\n");
		return;
	}

	dbThreadPool_.addTask(new DBTaskAccountLogin(cinfos->pChannel->addr(), 
		loginName, accountName, password, success, postdatas, getdatas));
}
开发者ID:Anehta,项目名称:kbengine,代码行数:26,代码来源:billinghandler.cpp


示例2: onExecScriptCommand

//-------------------------------------------------------------------------------------
void PythonApp::onExecScriptCommand(Network::Channel* pChannel, KBEngine::MemoryStream& s)
{
	std::string cmd;
	s.readBlob(cmd);

	PyObject* pycmd = PyUnicode_DecodeUTF8(cmd.data(), cmd.size(), NULL);
	if(pycmd == NULL)
	{
		SCRIPT_ERROR_CHECK();
		return;
	}

	DEBUG_MSG(fmt::format("PythonApp::onExecScriptCommand: size({}), command={}.\n", 
		cmd.size(), cmd));

	std::string retbuf = "";
	PyObject* pycmd1 = PyUnicode_AsEncodedString(pycmd, "utf-8", NULL);
	script_.run_simpleString(PyBytes_AsString(pycmd1), &retbuf);

	if(retbuf.size() == 0)
	{
		retbuf = "\r\n";
	}

	// 将结果返回给客户端
	Network::Bundle* pBundle = Network::Bundle::ObjPool().createObject();
	ConsoleInterface::ConsoleExecCommandCBMessageHandler msgHandler;
	(*pBundle).newMessage(msgHandler);
	ConsoleInterface::ConsoleExecCommandCBMessageHandlerArgs1::staticAddToBundle((*pBundle), retbuf);
	pChannel->send(pBundle);

	Py_DECREF(pycmd);
	Py_DECREF(pycmd1);
}
开发者ID:nichunen,项目名称:kbengine,代码行数:35,代码来源:python_app.cpp


示例3: onReceiveWatcherData

void CWatcherWindow::onReceiveWatcherData(KBEngine::MemoryStream& s)
{
	uint8 type = 0;
	s >> type;

	if(type == 0)
	{
		KBEngine::WatcherPaths watcherPaths;

		while(s.length() > 0)
		{
			std::string path;
			s >> path;

			std::string name;
			s >> name;

			KBEngine::WATCHER_ID id = 0;
			s >> id;

			KBEngine::WATCHER_VALUE_TYPE type;
			s >> type;

			KBEngine::WatcherObject* wo = watcherPaths.addWatcherFromStream(path, name, id, type, &s);
			addHeader(name);
			addItem(wo);
		};
	}
开发者ID:1564143452,项目名称:kbengine,代码行数:28,代码来源:WatcherWindow.cpp


示例4: onAccountLogin

//-------------------------------------------------------------------------------------
void BillingSystem::onAccountLogin(Mercury::Channel* pChannel, KBEngine::MemoryStream& s) 
{
	std::string loginName, accountName, password, datas;
	COMPONENT_ID cid;

	s >> cid >> loginName >> password;
	s.readBlob(datas);

	lockthread();

	REQLOGIN_MAP::iterator iter = reqAccountLogin_requests_.find(loginName);
	if(iter != reqAccountLogin_requests_.end())
	{
		unlockthread();
		return;
	}

	LoginAccountTask* pinfo = new LoginAccountTask();
	pinfo->commitName = loginName;
	pinfo->accountName = loginName;
	pinfo->getDatas = "";
	pinfo->password = password;
	pinfo->postDatas = datas;
	pinfo->success = false;
	pinfo->baseappID = cid;
	pinfo->dbmgrID = pChannel->componentID();
	pinfo->address = pChannel->addr();

	reqAccountLogin_requests_[pinfo->commitName] = pinfo;
	unlockthread();

	this->threadPool().addTask(pinfo);
}
开发者ID:fengqk,项目名称:kbengine,代码行数:34,代码来源:billingsystem.cpp


示例5: charge

//-------------------------------------------------------------------------------------
void BillingHandler_ThirdParty::charge(Network::Channel* pChannel, KBEngine::MemoryStream& s)
{
	std::string chargeID;
	std::string datas;
	CALLBACK_ID cbid;
	DBID dbid;

	s >> chargeID;
	s >> dbid;
	s.readBlob(datas);
	s >> cbid;

	INFO_MSG(fmt::format("BillingHandler_ThirdParty::charge: chargeID={0}, dbid={3}, cbid={1}, datas={2}!\n",
		chargeID, cbid, datas, dbid));

	KBE_ASSERT(pBillingChannel_);

	Network::Bundle::SmartPoolObjectPtr bundle = Network::Bundle::createSmartPoolObj();

	(*(*bundle)).newMessage(BillingSystemInterface::charge);
	(*(*bundle)) << pChannel->componentID();
	(*(*bundle)) << chargeID;
	(*(*bundle)) << dbid;
	(*(*bundle)).appendBlob(datas);
	(*(*bundle)) << cbid;

	if(pBillingChannel_->isDestroyed())
	{
		if(!this->reconnect())
			return;
	}

	(*(*bundle)).send(Dbmgr::getSingleton().networkInterface(), pBillingChannel_);
}
开发者ID:Anehta,项目名称:kbengine,代码行数:35,代码来源:billinghandler.cpp


示例6: charge

//-------------------------------------------------------------------------------------
void InterfacesHandler_Interfaces::charge(Network::Channel* pChannel, KBEngine::MemoryStream& s)
{
	Network::Channel* pInterfacesChannel = Dbmgr::getSingleton().networkInterface().findChannel(g_kbeSrvConfig.interfacesAddr());
	KBE_ASSERT(pInterfacesChannel);

	if(pInterfacesChannel->isDestroyed())
	{
		if(!this->reconnect())
			return;
	}

	std::string chargeID;
	std::string datas;
	CALLBACK_ID cbid;
	DBID dbid;

	s >> chargeID;
	s >> dbid;
	s.readBlob(datas);
	s >> cbid;

	INFO_MSG(fmt::format("InterfacesHandler_Interfaces::charge: chargeID={0}, dbid={3}, cbid={1}, datas={2}!\n",
		chargeID, cbid, datas, dbid));

	Network::Bundle* pBundle = Network::Bundle::createPoolObject();

	(*pBundle).newMessage(InterfacesInterface::charge);
	(*pBundle) << pChannel->componentID();
	(*pBundle) << chargeID;
	(*pBundle) << dbid;
	(*pBundle).appendBlob(datas);
	(*pBundle) << cbid;
	pInterfacesChannel->send(pBundle);
}
开发者ID:hyperfact,项目名称:kbengine,代码行数:35,代码来源:interfaces_handler.cpp


示例7: onChargeCB

//-------------------------------------------------------------------------------------
void InterfacesHandler_Interfaces::onChargeCB(KBEngine::MemoryStream& s)
{
	std::string chargeID;
	std::string datas;
	CALLBACK_ID cbid;
	COMPONENT_ID cid;
	DBID dbid;
	SERVER_ERROR_CODE retcode;

	s >> cid;
	s >> chargeID;
	s >> dbid;
	s.readBlob(datas);
	s >> cbid;
	s >> retcode;

	INFO_MSG(fmt::format("InterfacesHandler_Interfaces::onChargeCB: chargeID={0}, dbid={3}, cbid={1}, cid={4}, datas={2}!\n",
		chargeID, cbid, datas, dbid, cid));

	Components::ComponentInfos* cinfos = Components::getSingleton().findComponent(BASEAPP_TYPE, cid);
	if (cid == 0 || cinfos == NULL || cinfos->pChannel == NULL || cinfos->pChannel->isDestroyed())
	{
		ERROR_MSG(fmt::format("InterfacesHandler_Interfaces::onChargeCB: baseapp not found!, chargeID={}, cid={}.\n", 
			chargeID, cid));

		// 此时应该随机找一个baseapp调用onLoseChargeCB
		bool found = false;

		Components::COMPONENTS& components = Components::getSingleton().getComponents(BASEAPP_TYPE);
		for (Components::COMPONENTS::iterator iter = components.begin(); iter != components.end(); ++iter)
		{
			cinfos = &(*iter);
			if (cinfos == NULL || cinfos->pChannel == NULL || cinfos->pChannel->isDestroyed())
			{
				continue;
			}

			WARNING_MSG(fmt::format("InterfacesHandler_Interfaces::onChargeCB: , chargeID={}, not found cid={}, forward to component({}) processing!\n",
				chargeID, cid, cinfos->cid));

			found = true;
			break;
		}

		if (!found)
			return;
	}

	Network::Bundle* pBundle = Network::Bundle::createPoolObject();

	(*pBundle).newMessage(BaseappInterface::onChargeCB);
	(*pBundle) << chargeID;
	(*pBundle) << dbid;
	(*pBundle).appendBlob(datas);
	(*pBundle) << cbid;
	(*pBundle) << retcode;

	cinfos->pChannel->send(pBundle);
}
开发者ID:hyperfact,项目名称:kbengine,代码行数:60,代码来源:interfaces_handler.cpp


示例8: executeRawDatabaseCommand

//-------------------------------------------------------------------------------------
void Dbmgr::executeRawDatabaseCommand(Mercury::Channel* pChannel, 
									  KBEngine::MemoryStream& s)
{
	dbThreadPool_.addTask(new DBTaskExecuteRawDatabaseCommand(pChannel->addr(), s));
	s.opfini();

	numExecuteRawDatabaseCommand_++;
}
开发者ID:fengqk,项目名称:kbengine,代码行数:9,代码来源:dbmgr.cpp


示例9: onBroadcastGlobalDataChanged

//-------------------------------------------------------------------------------------
void Dbmgr::onBroadcastGlobalDataChanged(Mercury::Channel* pChannel, KBEngine::MemoryStream& s)
{
	uint8 dataType;
	std::string key, value;
	bool isDelete;
	COMPONENT_TYPE componentType;
	
	s >> dataType;
	s >> isDelete;

	s.readBlob(key);

	if(!isDelete)
	{
		s.readBlob(value);
	}

	s >> componentType;

	switch(dataType)
	{
	case GlobalDataServer::GLOBAL_DATA:
		if(isDelete)
			pGlobalData_->del(pChannel, componentType, key);
		else
			pGlobalData_->write(pChannel, componentType, key, value);
		break;
	case GlobalDataServer::BASEAPP_DATA:
		if(isDelete)
			pBaseAppData_->del(pChannel, componentType, key);
		else
			pBaseAppData_->write(pChannel, componentType, key, value);
		break;
	case GlobalDataServer::CELLAPP_DATA:
		if(isDelete)
			pCellAppData_->del(pChannel, componentType, key);
		else
			pCellAppData_->write(pChannel, componentType, key, value);
		break;
	default:
		KBE_ASSERT(false && "dataType is error!\n");
		break;
	};
}
开发者ID:Ollydbg,项目名称:kbengine,代码行数:45,代码来源:dbmgr.cpp


示例10: onExecuteRawDatabaseCommandCB

//-------------------------------------------------------------------------------------
void Cellapp::onExecuteRawDatabaseCommandCB(Mercury::Channel* pChannel, KBEngine::MemoryStream& s)
{
	std::string err;
	CALLBACK_ID callbackID = 0;
	uint32 nrows = 0;
	uint32 nfields = 0;
	uint64 affectedRows = 0;

	PyObject* pResultSet = NULL;
	PyObject* pAffectedRows = NULL;
	PyObject* pErrorMsg = NULL;

	s >> callbackID;
	s >> err;

	if(err.size() <= 0)
	{
		s >> nfields;

		pErrorMsg = Py_None;
		Py_INCREF(pErrorMsg);

		if(nfields > 0)
		{
			pAffectedRows = Py_None;
			Py_INCREF(pAffectedRows);

			s >> nrows;

			pResultSet = PyList_New(nrows);
			for (uint32 i = 0; i < nrows; ++i)
			{
				PyObject* pRow = PyList_New(nfields);
				for(uint32 j = 0; j < nfields; ++j)
				{
					std::string cell;
					s.readBlob(cell);

					PyObject* pCell = NULL;
						
					if(cell == "NULL")
					{
						Py_INCREF(Py_None);
						pCell = Py_None;
					}
					else
					{
						pCell = PyBytes_FromStringAndSize(cell.data(), cell.length());
					}

					PyList_SET_ITEM(pRow, j, pCell);
				}

				PyList_SET_ITEM(pResultSet, i, pRow);
			}
		}
开发者ID:linuxcentos1,项目名称:kbengine,代码行数:57,代码来源:cellapp.cpp


示例11: syncEntityStreamTemplate

//-------------------------------------------------------------------------------------
void Dbmgr::syncEntityStreamTemplate(Mercury::Channel* pChannel, KBEngine::MemoryStream& s)
{
	KBEAccountTable* pTable = 
		static_cast<KBEAccountTable*>(EntityTables::getSingleton().findKBETable("kbe_accountinfos"));

	KBE_ASSERT(pTable);

	pTable->accountDefMemoryStream(s);
	s.opfini();
}
开发者ID:Ollydbg,项目名称:kbengine,代码行数:11,代码来源:dbmgr.cpp


示例12: updateLogWatcherSetting

//-------------------------------------------------------------------------------------
void Logger::updateLogWatcherSetting(Network::Channel* pChannel, KBEngine::MemoryStream& s)
{
	LogWatcher* pLogwatcher = &logWatchers_[pChannel->addr()];
	if(!pLogwatcher->updateSetting(&s))
	{
		ERROR_MSG(fmt::format("Logger::updateLogWatcherSetting: addr={} is failed!\n",
			pChannel->addr().c_str()));

		logWatchers_.erase(pChannel->addr());
	}

	s.done();
}
开发者ID:ArcherPeng,项目名称:kbengine-cocos2dx,代码行数:14,代码来源:logger.cpp


示例13: onLoginAccountCB

//-------------------------------------------------------------------------------------
void InterfacesHandler_Interfaces::onLoginAccountCB(KBEngine::MemoryStream& s)
{
	std::string loginName, accountName, password, postdatas, getdatas;
	COMPONENT_ID cid;
	SERVER_ERROR_CODE success = SERVER_ERR_OP_FAILED;

	s >> cid >> loginName >> accountName >> password >> success;
	s.readBlob(postdatas);
	s.readBlob(getdatas);

	bool needCheckPassword = (success == SERVER_ERR_LOCAL_PROCESSING);

	if (success != SERVER_SUCCESS && success != SERVER_ERR_LOCAL_PROCESSING)
		accountName = "";
	else
		success = SERVER_SUCCESS;

	Components::ComponentInfos* cinfos = Components::getSingleton().findComponent(LOGINAPP_TYPE, cid);
	if(cinfos == NULL || cinfos->pChannel == NULL)
	{
		ERROR_MSG("InterfacesHandler_Interfaces::onLoginAccountCB: loginapp not found!\n");
		return;
	}

	std::string dbInterfaceName = Dbmgr::getSingleton().selectAccountDBInterfaceName(accountName);

	thread::ThreadPool* pThreadPool = DBUtil::pThreadPool(dbInterfaceName);
	if (!pThreadPool)
	{
		ERROR_MSG(fmt::format("InterfacesHandler_Interfaces::onLoginAccountCB: not found dbInterface({})!\n",
			dbInterfaceName));

		return;
	}

	pThreadPool->addTask(new DBTaskAccountLogin(cinfos->pChannel->addr(),
		loginName, accountName, password, success, postdatas, getdatas, needCheckPassword));
}
开发者ID:hyperfact,项目名称:kbengine,代码行数:39,代码来源:interfaces_handler.cpp


示例14: writeEntity

//-------------------------------------------------------------------------------------
void Dbmgr::writeEntity(Mercury::Channel* pChannel, 
						KBEngine::MemoryStream& s)
{
	ENTITY_ID eid;
	DBID entityDBID;
	COMPONENT_ID componentID;

	s >> componentID >> eid >> entityDBID;

	bufferedDBTasks_.addTask(new DBTaskWriteEntity(pChannel->addr(), componentID, eid, entityDBID, s));
	s.opfini();

	numWrittenEntity_++;
}
开发者ID:Ollydbg,项目名称:kbengine,代码行数:15,代码来源:dbmgr.cpp


示例15: onAccountLogin

//-------------------------------------------------------------------------------------
void Dbmgr::onAccountLogin(Mercury::Channel* pChannel, KBEngine::MemoryStream& s) 
{
	std::string loginName, password, datas;
	s >> loginName >> password;
	s.readBlob(datas);

	if(loginName.size() == 0)
	{
		ERROR_MSG("Dbmgr::onAccountLogin: loginName is empty.\n");
		return;
	}

	pBillingAccountHandler_->loginAccount(pChannel, loginName, password, datas);
}
开发者ID:Ollydbg,项目名称:kbengine,代码行数:15,代码来源:dbmgr.cpp


示例16:

inline void CallbackMgr<PyObjectPtr>::addToStream(KBEngine::MemoryStream& s)
{
	uint32 size = cbMap_.size();

	s << idAlloc_.lastID() << size;

	CALLBACKS::iterator iter = cbMap_.begin();
	for(; iter != cbMap_.end(); iter++)
	{
		s << iter->first;
		s.appendBlob(script::Pickler::pickle(iter->second.first.get()));
		s << iter->second.second;
	}
}
开发者ID:Anehta,项目名称:kbengine,代码行数:14,代码来源:callbackmgr.hpp


示例17: executeRawDatabaseCommand

//-------------------------------------------------------------------------------------
void Dbmgr::executeRawDatabaseCommand(Mercury::Channel* pChannel, 
									  KBEngine::MemoryStream& s)
{
	ENTITY_ID entityID = -1;
	s >> entityID;

	if(entityID == -1)
		dbThreadPool_.addTask(new DBTaskExecuteRawDatabaseCommand(pChannel->addr(), s));
	else
		bufferedDBTasks_.addTask(new DBTaskExecuteRawDatabaseCommandByEntity(pChannel->addr(), s, entityID));

	s.opfini();

	numExecuteRawDatabaseCommand_++;
}
开发者ID:Ollydbg,项目名称:kbengine,代码行数:16,代码来源:dbmgr.cpp


示例18: reqCreateAccount

//-------------------------------------------------------------------------------------
void Dbmgr::reqCreateAccount(Mercury::Channel* pChannel, KBEngine::MemoryStream& s)
{
	std::string registerName, password, datas;
	s >> registerName >> password;
	s.readBlob(datas);

	if(registerName.size() == 0)
	{
		ERROR_MSG("Dbmgr::reqCreateAccount: registerName is empty.\n");
		return;
	}

	pBillingHandler_->createAccount(pChannel, registerName, password, datas);
	numCreatedAccount_++;
}
开发者ID:fengqk,项目名称:kbengine,代码行数:16,代码来源:dbmgr.cpp


示例19: executeRawDatabaseCommand

//-------------------------------------------------------------------------------------
void Dbmgr::executeRawDatabaseCommand(Network::Channel* pChannel, 
									  KBEngine::MemoryStream& s)
{
	ENTITY_ID entityID = -1;
	s >> entityID;

	if(entityID == -1)
		DBUtil::pThreadPool()->addTask(new DBTaskExecuteRawDatabaseCommand(pChannel->addr(), s));
	else
		bufferedDBTasks_.addTask(new DBTaskExecuteRawDatabaseCommandByEntity(pChannel->addr(), s, entityID));

	s.done();

	numExecuteRawDatabaseCommand_++;
}
开发者ID:ArcherPeng,项目名称:kbengine-cocos2dx,代码行数:16,代码来源:dbmgr.cpp


示例20: onCreateAccountCB

//-------------------------------------------------------------------------------------
void InterfacesHandler_ThirdParty::onCreateAccountCB(KBEngine::MemoryStream& s)
{
    std::string registerName, accountName, password, postdatas, getdatas;
    COMPONENT_ID cid;
    SERVER_ERROR_CODE success = SERVER_ERR_OP_FAILED;

    s >> cid >> registerName >> accountName >> password >> success;
    s.readBlob(postdatas);
    s.readBlob(getdatas);

    if(success != SERVER_SUCCESS)
    {
        accountName = "";
    }

    Components::ComponentInfos* cinfos = Components::getSingleton().findComponent(LOGINAPP_TYPE, cid);
    if(cinfos == NULL || cinfos->pChannel == NULL)
    {
        ERROR_MSG("InterfacesHandler_ThirdParty::onCreateAccountCB: loginapp not found!\n");
        return;
    }

    std::string dbInterfaceName = Dbmgr::getSingleton().selectAccountDBInterfaceName(accountName);

    thread::ThreadPool* pThreadPool = DBUtil::pThreadPool(dbInterfaceName);
    if (!pThreadPool)
    {
        ERROR_MSG(fmt::format("InterfacesHandler_ThirdParty::onCreateAccountCB: not found dbInterface({})!\n",
                              dbInterfaceName));

        return;
    }

    pThreadPool->addTask(new DBTaskCreateAccount(cinfos->pChannel->addr(),
                         registerName, accountName, password, postdatas, getdatas));
}
开发者ID:waluoo,项目名称:kbengine,代码行数:37,代码来源:interfaces_handler.cpp



注:本文中的kbengine::MemoryStream类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ kcalcore::Todo类代码示例发布时间:2022-05-31
下一篇:
C++ kaguya::State类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap