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

C++ KBE_ASSERT函数代码示例

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

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



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

示例1: KBE_ASSERT

//-------------------------------------------------------------------------------------
void Cellappmgr::forwardMessage(Mercury::Channel* pChannel, MemoryStream& s)
{
	COMPONENT_ID sender_componentID, forward_componentID;

	s >> sender_componentID >> forward_componentID;
	Components::ComponentInfos* cinfos = Components::getSingleton().findComponent(forward_componentID);
	KBE_ASSERT(cinfos != NULL && cinfos->pChannel != NULL);

	Mercury::Bundle bundle;
	bundle.append((char*)s.data() + s.rpos(), s.opsize());
	bundle.send(this->getNetworkInterface(), cinfos->pChannel);
	s.opfini();
}
开发者ID:fengqk,项目名称:kbengine,代码行数:14,代码来源:cellappmgr.cpp


示例2: KBE_ASSERT

//-------------------------------------------------------------------------------------
void EventDispatcher::attachTo(EventDispatcher & parentDispatcher)
{
	KBE_ASSERT(pCouplingToParent_ == NULL);
	pCouplingToParent_ = new DispatcherCoupling(parentDispatcher, *this);

	int fd = pPoller_->getFileDescriptor();

	if (fd != -1)
	{
		parentDispatcher.registerFileDescriptor(fd, pPoller_);
		parentDispatcher.registerWriteFileDescriptor(fd, pPoller_);
	}
}
开发者ID:321543223,项目名称:kbengine,代码行数:14,代码来源:event_dispatcher.cpp


示例3: ERROR_MSG

//-------------------------------------------------------------------------------------
bool DBUtil::initInterface(DBInterface* pdbi)
{
	DBInterfaceInfo* pDBInfo = g_kbeSrvConfig.dbInterface(pdbi->name());
	if (!pDBInfo)
	{
		ERROR_MSG(fmt::format("DBUtil::initInterface: not found dbInterface({})\n",
			pdbi->name()));

		return false;
	}

	if (strcmp(pDBInfo->db_type, "mysql") == 0)
	{
		DBInterfaceMysql::initInterface(pdbi);
	}
	else if (strcmp(pDBInfo->db_type, "redis") == 0)
	{
		DBInterfaceRedis::initInterface(pdbi);
	}
	
	thread::ThreadPool* pThreadPool = pThreadPoolMaps_[pdbi->name()];
	KBE_ASSERT(pThreadPool);

	if (!pThreadPool->isInitialize())
	{
		if (!pThreadPool->createThreadPool(pDBInfo->db_numConnections,
			pDBInfo->db_numConnections, pDBInfo->db_numConnections))
			return false;
	}

	EntityTables& entityTables = EntityTables::findByInterfaceName(pdbi->name());
	bool ret = entityTables.load(pdbi);

	if(ret)
	{
		ret = pdbi->checkEnvironment();
	}
	
	if(ret)
	{
		ret = pdbi->checkErrors();
	}

	if (ret)
	{
		if (!pDBInfo->isPure)
			ret = entityTables.syncToDB(pdbi);
	}

	return ret;
}
开发者ID:Orav,项目名称:kbengine,代码行数:52,代码来源:db_interface.cpp


示例4: varchar

//-------------------------------------------------------------------------------------
bool KBEEmailVerificationTableMysql::syncToDB(DBInterface* dbi)
{
	bool ret = false;

	std::string sqlstr = "CREATE TABLE IF NOT EXISTS kbe_email_verification "
			"(accountName varchar(255) not null,"
			"type tinyint not null DEFAULT 0,"
			"datas varchar(255),"
			"code varchar(255), PRIMARY KEY idKey (code),"
			"logtime bigint(20) not null DEFAULT 0)"
		"ENGINE="MYSQL_ENGINE_TYPE;

	ret = dbi->query(sqlstr.c_str(), sqlstr.size(), true);
	KBE_ASSERT(ret);

	// 删除xx小时之前的记录
	sqlstr = fmt::format("delete from kbe_email_verification where logtime<{} and type={}", 
		KBEngine::StringConv::val2str(time(NULL) - g_kbeSrvConfig.emailAtivationInfo_.deadline), 
		((int)KBEEmailVerificationTable::V_TYPE_CREATEACCOUNT));

	ret = dbi->query(sqlstr.c_str(), sqlstr.size(), true);
	KBE_ASSERT(ret);

	sqlstr = fmt::format("delete from kbe_email_verification where logtime<{} and type={}", 
		KBEngine::StringConv::val2str(time(NULL) - g_kbeSrvConfig.emailResetPasswordInfo_.deadline),
		((int)KBEEmailVerificationTable::V_TYPE_RESETPASSWORD));

	ret = dbi->query(sqlstr.c_str(), sqlstr.size(), true);
	KBE_ASSERT(ret);

	sqlstr = fmt::format("delete from kbe_email_verification where logtime<{} and type={}", 
		KBEngine::StringConv::val2str(time(NULL) - g_kbeSrvConfig.emailBindInfo_.deadline), 
		((int)KBEEmailVerificationTable::V_TYPE_BIND_MAIL));

	ret = dbi->query(sqlstr.c_str(), sqlstr.size(), true);
	KBE_ASSERT(ret);
	return ret;
}
开发者ID:AddictXQ,项目名称:kbengine,代码行数:39,代码来源:kbe_table_mysql.cpp


示例5: KBE_ASSERT

//-------------------------------------------------------------------------------------
void Entity::onGetWitness(Mercury::Channel* pChannel)
{
	KBE_ASSERT(this->getBaseMailbox() != NULL && !this->hasWitness());
	PyObject* clientMailbox = PyObject_GetAttrString(this->getBaseMailbox(), "client");
	KBE_ASSERT(clientMailbox != Py_None);

	EntityMailbox* client = static_cast<EntityMailbox*>(clientMailbox);	
	// Py_INCREF(clientMailbox); 这里不需要增加引用, 因为每次都会产生一个新的对象
	setClientMailbox(client);

	pWitness_ = Witness::ObjPool().createObject();
	pWitness_->attach(this);

	Space* space = Spaces::findSpace(this->getSpaceID());
	if(space)
	{
		space->onEntityAttachWitness(this);
	}

	SCOPED_PROFILE(SCRIPTCALL_PROFILE);

	SCRIPT_OBJECT_CALL_ARGS0(this, const_cast<char*>("onGetWitness"));
}
开发者ID:fengqk,项目名称:kbengine,代码行数:24,代码来源:entity.cpp


示例6: while

//-------------------------------------------------------------------------------------
void ScriptCallbacks::releaseCallback( TimerHandle handle )
{
	int numErased = 0;

	Map::iterator iter = map_.begin();

	while (iter != map_.end())
	{
		KBE_ASSERT( iter->second.isSet() );

		if (handle == iter->second)
		{
			map_.erase( iter++ );
			++numErased;
		}
		else
		{
			iter++;
		}
	}

	KBE_ASSERT( numErased == 1 );
}
开发者ID:HeadClot,项目名称:kbengine,代码行数:24,代码来源:script_callbacks.cpp


示例7: KBE_ASSERT

//-------------------------------------------------------------------------------------
void EventDispatcher::detachFrom(EventDispatcher & parentDispatcher)
{
	int fd = pPoller_->getFileDescriptor();

	if (fd != -1)
	{
		parentDispatcher.deregisterFileDescriptor(fd);
		parentDispatcher.deregisterWriteFileDescriptor(fd);
	}

	KBE_ASSERT(pCouplingToParent_ != NULL);
	delete pCouplingToParent_;
	pCouplingToParent_ = NULL;
}
开发者ID:CoolJie2001,项目名称:kbengine,代码行数:15,代码来源:event_dispatcher.cpp


示例8: KBE_ASSERT

//-------------------------------------------------------------------------------------
bool NetworkInterface::registerChannel(Channel* pChannel)
{
	const Address & addr = pChannel->addr();
	KBE_ASSERT(addr.ip != 0);
	KBE_ASSERT(&pChannel->networkInterface() == this);
	ChannelMap::iterator iter = channelMap_.find(addr);
	Channel * pExisting = iter != channelMap_.end() ? iter->second : NULL;

	if(pExisting)
	{
		CRITICAL_MSG(fmt::format("NetworkInterface::registerChannel: channel {} is exist.\n",
		pChannel->c_str()));
		return false;
	}

	channelMap_[addr] = pChannel;

	if(pChannel->isExternal())
		numExtChannels_++;

	//INFO_MSG(fmt::format("NetworkInterface::registerChannel: new channel: {}.\n", pChannel->c_str()));
	return true;
}
开发者ID:aabbox,项目名称:kbengine,代码行数:24,代码来源:network_interface.cpp


示例9: varchar

//-------------------------------------------------------------------------------------
bool KBEAccountTableMysql::syncToDB(DBInterface* dbi)
{
	bool ret = false;

	std::string sqlstr = "CREATE TABLE IF NOT EXISTS kbe_accountinfos "
			"(accountName varchar(255) not null, PRIMARY KEY idKey (accountName),"
			"password varchar(255),"
			"entityDBID bigint(20) not null DEFAULT 0)"
		"ENGINE="MYSQL_ENGINE_TYPE;

	ret = dbi->query(sqlstr.c_str(), sqlstr.size(), true);
	KBE_ASSERT(ret);
	return ret;
}
开发者ID:mmorpg,项目名称:kbengine,代码行数:15,代码来源:kbe_table_mysql.cpp


示例10: THREAD_MUTEX_LOCK

//-------------------------------------------------------------------------------------
void ThreadPool::onMainThreadTick()
{
	std::vector<TPTask*> finitasks;

	THREAD_MUTEX_LOCK(finiTaskList_mutex_);

	if(finiTaskList_.size() == 0)
	{
		THREAD_MUTEX_UNLOCK(finiTaskList_mutex_);	
		return;
	}

	std::copy(finiTaskList_.begin(), finiTaskList_.end(), std::back_inserter(finitasks));   
	finiTaskList_.clear();
	THREAD_MUTEX_UNLOCK(finiTaskList_mutex_);	

	std::vector<TPTask*>::iterator finiiter  = finitasks.begin();

	for(; finiiter != finitasks.end(); )
	{
		thread::TPTask::TPTaskState state = (*finiiter)->presentMainThread();

		switch(state)
		{
		case thread::TPTask::TPTASK_STATE_COMPLETED:
			delete (*finiiter);
			finiiter = finitasks.erase(finiiter);
			--finiTaskList_count_;
			break;
			
		case thread::TPTask::TPTASK_STATE_CONTINUE_CHILDTHREAD:
			this->addTask((*finiiter));
			finiiter = finitasks.erase(finiiter);
			--finiTaskList_count_;
			break;
			
		case thread::TPTask::TPTASK_STATE_CONTINUE_MAINTHREAD:
			THREAD_MUTEX_LOCK(finiTaskList_mutex_);
			finiTaskList_.push_back((*finiiter));
			THREAD_MUTEX_UNLOCK(finiTaskList_mutex_);	
			++finiiter;
			break;
			
		default:
			KBE_ASSERT(false);
			break;
		};
	}
}
开发者ID:hyperfact,项目名称:kbengine,代码行数:50,代码来源:threadpool.cpp


示例11: KBE_ASSERT

//-------------------------------------------------------------------------------------
void EntityTables::addKBETable(EntityTable* pTable)
{
	TABLES_MAP::iterator iter = kbe_tables_.begin();

	for(; iter != kbe_tables_.end(); ++iter)
	{
		if(iter->first == pTable->tableName())
		{
			KBE_ASSERT(false && "table exist!\n");
			return;
		}
	}

	kbe_tables_[pTable->tableName()].reset(pTable);
}
开发者ID:AddictXQ,项目名称:kbengine,代码行数:16,代码来源:entity_table.cpp


示例12: KBE_ASSERT

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

	s >> componentID >> eid >> entityDBID;
	KBE_ASSERT(entityDBID > 0);

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

	s.opfini();

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


示例13: catch

//-------------------------------------------------------------------------------------
void DBTransaction::start()
{
	committed_ = false;

	try
	{
		dbi_->query(SQL_START_TRANSACTION, false);
	}
	catch (DBException & e)
	{
		bool ret = static_cast<DBInterfaceMysql*>(dbi_)->processException(e);
		KBE_ASSERT(ret);
	}

	static_cast<DBInterfaceMysql*>(dbi_)->inTransaction(true);
}
开发者ID:321543223,项目名称:kbengine,代码行数:17,代码来源:db_transaction.cpp


示例14: KBE_ASSERT

//-------------------------------------------------------------------------------------
void DBTransaction::commit()
{
	KBE_ASSERT(!committed_);

	uint64 startTime = timestamp();
	pdbi_->query(SQL_COMMIT, false);

	uint64 duration = timestamp() - startTime;
	if(duration > stampsPerSecond() * 0.2f)
	{
		WARNING_MSG(fmt::format("DBTransaction::commit(): took {:.2f} seconds\n", 
			(double(duration)/stampsPerSecondD())));
	}

	committed_ = true;
}
开发者ID:Orav,项目名称:kbengine,代码行数:17,代码来源:db_transaction.cpp


示例15: INFO_MSG

//-------------------------------------------------------------------------------------
void Cellappmgr::onCellappInitProgress(Network::Channel* pChannel, COMPONENT_ID cid, float progress)
{
	if(progress > 1.f)
	{
		INFO_MSG(fmt::format("Cellappmgr::onCellappInitProgress: cid={0}, progress={1}.\n",
			cid , (progress > 1.f ? 1.f : progress)));

		Components::ComponentInfos* cinfos = Components::getSingleton().findComponent(cid);
		if(cinfos)
			cinfos->state = COMPONENT_STATE_RUN;
	}

	KBE_ASSERT(cellapps_.find(cid) != cellapps_.end());

	cellapps_[cid].initProgress(progress);
}
开发者ID:lijia4423,项目名称:kbengine,代码行数:17,代码来源:cellappmgr.cpp


示例16: KBE_ASSERT

//-------------------------------------------------------------------------------------
int TCPPacket::recvFromEndPoint(EndPoint & ep, Address* pAddr)
{
	//KBE_ASSERT(MessageHandlers::pMainMessageHandlers != NULL && "Must set up a MainMessageHandlers!\n");
	KBE_ASSERT(maxBufferSize() > wpos());
	int len = ep.recv(data() + wpos(), (int)(size() - wpos()));
	
	if(len > 0) 
	{
		wpos((int)(wpos() + len));

		// 注意:必须在大于0的时候否则DEBUG_MSG将会导致WSAGetLastError返回0从而陷入死循环
		// DEBUG_MSG(fmt::format("TCPPacket::recvFromEndPoint: datasize={}, wpos={}.\n", len, wpos()));
	}

	return len; 
}
开发者ID:Weooh,项目名称:kbengine,代码行数:17,代码来源:tcp_packet.cpp


示例17: KBE_ASSERT

//-------------------------------------------------------------------------------------
bool EntityMailboxAbstract::postMail(Mercury::Bundle& bundle)
{
	KBE_ASSERT(Components::getSingleton().pNetworkInterface() != NULL);
	Mercury::Channel* pChannel = getChannel();

	if(pChannel && !pChannel->isDead())
	{
		bundle.send(*Components::getSingleton().pNetworkInterface(), pChannel);
		return true;
	}
	else
	{
		ERROR_MSG("EntityMailboxAbstract::postMail: invalid channel(%s)!\n", addr_.c_str());
	}

	return false;
}
开发者ID:guozanhua,项目名称:kbengine,代码行数:18,代码来源:entitymailboxabstract.cpp


示例18: KBE_ASSERT

//-------------------------------------------------------------------------------------
bool DBUtil::initThread(const std::string& dbinterfaceName)
{
	DBInterfaceInfo* pDBInfo = g_kbeSrvConfig.dbInterface(dbinterfaceName);
	if (strcmp(pDBInfo->db_type, "mysql") == 0)
	{
		if (!mysql_thread_safe()) 
		{
			KBE_ASSERT(false);
		}
		else
		{
			mysql_thread_init();
		}
	}
	
	return true;
}
开发者ID:Orav,项目名称:kbengine,代码行数:18,代码来源:db_interface.cpp


示例19: KBE_ASSERT

//-------------------------------------------------------------------------------------
bool DBUtil::initThread()
{
	ENGINE_COMPONENT_INFO& dbcfg = g_kbeSrvConfig.getDBMgr();
	if(strcmp(dbcfg.db_type, "mysql") == 0)
	{
		if (!mysql_thread_safe()) 
		{
			KBE_ASSERT(false);
		}
		else
		{
			mysql_thread_init();
		}
	}

	return true;
}
开发者ID:sdsgwangpeng,项目名称:kbengine,代码行数:18,代码来源:db_interface.cpp


示例20: KBE_ASSERT

//-------------------------------------------------------------------------------------
void BillingHandler_ThirdParty::eraseClientReq(Network::Channel* pChannel, std::string& logkey)
{
	KBE_ASSERT(pBillingChannel_);

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

	(*(*bundle)).newMessage(BillingSystemInterface::eraseClientReq);
	(*(*bundle)) << logkey;

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

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



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ KCMCACHE函数代码示例发布时间:2022-05-30
下一篇:
C++ KBD_IS_ACTIVE函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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