当前位置: 首页>>代码示例>>C++>>正文


C++ KBE_ASSERT函数代码示例

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


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


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