本文整理汇总了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();
}
示例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_);
}
}
示例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;
}
示例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;
}
示例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"));
}
示例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 );
}
示例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;
}
示例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;
}
示例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;
}
示例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;
};
}
}
示例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);
}
示例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_++;
}
示例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);
}
示例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;
}
示例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);
}