本文整理汇总了C++中COMPONENT_NAME_EX函数的典型用法代码示例。如果您正苦于以下问题:C++ COMPONENT_NAME_EX函数的具体用法?C++ COMPONENT_NAME_EX怎么用?C++ COMPONENT_NAME_EX使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了COMPONENT_NAME_EX函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
//-------------------------------------------------------------------------------------
void Components::removeComponentFromChannel(Mercury::Channel * pChannel)
{
int ifind = 0;
while(ALL_COMPONENT_TYPES[ifind] != UNKNOWN_COMPONENT_TYPE)
{
COMPONENT_TYPE componentType = ALL_COMPONENT_TYPES[ifind++];
COMPONENTS& components = getComponents(componentType);
COMPONENTS::iterator iter = components.begin();
for(; iter != components.end();)
{
if((*iter).pChannel == pChannel)
{
//SAFE_RELEASE((*iter).pIntAddr);
//SAFE_RELEASE((*iter).pExtAddr);
// (*iter).pChannel->decRef();
WARNING_MSG(boost::format("Components::removeComponentFromChannel: %1% : %2%.\n") %
COMPONENT_NAME_EX(componentType) % (*iter).cid);
#if KBE_PLATFORM == PLATFORM_WIN32
printf("[WARNING]: %s.\n", (boost::format("Components::removeComponentFromChannel: %1% : %2%.\n") %
COMPONENT_NAME_EX(componentType) % (*iter).cid).str().c_str());
#endif
iter = components.erase(iter);
return;
}
else
iter++;
}
}
// KBE_ASSERT(false && "channel is not found!\n");
}
示例2: getComponents
//-------------------------------------------------------------------------------------
void Components::delComponent(int32 uid, COMPONENT_TYPE componentType,
COMPONENT_ID componentID, bool ignoreComponentID, bool shouldShowLog)
{
COMPONENTS& components = getComponents(componentType);
COMPONENTS::iterator iter = components.begin();
for(; iter != components.end();)
{
if((uid < 0 || (*iter).uid == uid) && (ignoreComponentID == true || (*iter).cid == componentID))
{
INFO_MSG(fmt::format("Components::delComponent[{}] componentID={}, component:totalcount={}.\n",
COMPONENT_NAME_EX(componentType), componentID, components.size()));
ComponentInfos* componentInfos = &(*iter);
//SAFE_RELEASE((*iter).pIntAddr);
//SAFE_RELEASE((*iter).pExtAddr);
//(*iter).pChannel->decRef();
if(_pHandler)
_pHandler->onRemoveComponent(componentInfos);
iter = components.erase(iter);
if(!ignoreComponentID)
return;
}
else
iter++;
}
if(shouldShowLog)
{
ERROR_MSG(fmt::format("Components::delComponent::not found [{}] component:totalcount:{}\n",
COMPONENT_NAME_EX(componentType), components.size()));
}
}
示例3: while
//-------------------------------------------------------------------------------------
void Components::removeComponentByChannel(Network::Channel * pChannel, bool isShutingdown)
{
int ifind = 0;
while(ALL_COMPONENT_TYPES[ifind] != UNKNOWN_COMPONENT_TYPE)
{
COMPONENT_TYPE componentType = ALL_COMPONENT_TYPES[ifind++];
COMPONENTS& components = getComponents(componentType);
COMPONENTS::iterator iter = components.begin();
for(; iter != components.end();)
{
if((*iter).pChannel == pChannel)
{
//SAFE_RELEASE((*iter).pIntAddr);
//SAFE_RELEASE((*iter).pExtAddr);
// (*iter).pChannel->decRef();
if (!isShutingdown && g_componentType != LOGGER_TYPE)
{
ERROR_MSG(fmt::format("Components::removeComponentByChannel: {} : {}, Abnormal exit! {}\n",
COMPONENT_NAME_EX(componentType), (*iter).cid, kbe_strerror()));
#if KBE_PLATFORM == PLATFORM_WIN32
printf("[ERROR]: %s.\n", (fmt::format("Components::removeComponentByChannel: {} : {}, Abnormal exit! {}\n",
COMPONENT_NAME_EX(componentType), (*iter).cid, kbe_strerror())).c_str());
#endif
}
else
{
INFO_MSG(fmt::format("Components::removeComponentByChannel: {} : {}, Normal exit!\n",
COMPONENT_NAME_EX(componentType), (*iter).cid));
}
ComponentInfos* componentInfos = &(*iter);
if(_pHandler)
_pHandler->onRemoveComponent(componentInfos);
iter = components.erase(iter);
return;
}
else
iter++;
}
}
// KBE_ASSERT(false && "channel is not found!\n");
}
示例4: ERROR_MSG
//-------------------------------------------------------------------------------------
void ServerApp::onAppActiveTick(Network::Channel* pChannel, COMPONENT_TYPE componentType, COMPONENT_ID componentID)
{
if(componentType != CLIENT_TYPE)
if(pChannel->isExternal())
return;
Network::Channel* pTargetChannel = NULL;
if(componentType != CONSOLE_TYPE && componentType != CLIENT_TYPE)
{
Components::ComponentInfos* cinfos =
Components::getSingleton().findComponent(componentType, KBEngine::getUserUID(), componentID);
if(cinfos == NULL || cinfos->pChannel == NULL)
{
ERROR_MSG(fmt::format("ServerApp::onAppActiveTick[{:p}]: {}:{} not found.\n",
(void*)pChannel, COMPONENT_NAME_EX(componentType), componentID));
return;
}
pTargetChannel = cinfos->pChannel;
pTargetChannel->updateLastReceivedTime();
}
else
{
pChannel->updateLastReceivedTime();
pTargetChannel = pChannel;
}
//DEBUG_MSG("ServerApp::onAppActiveTick[%x]: %s:%"PRAppID" lastReceivedTime:%"PRIu64" at %s.\n",
// pChannel, COMPONENT_NAME_EX(componentType), componentID, pChannel->lastReceivedTime(), pTargetChannel->c_str());
}
示例5: ERROR_MSG
//-------------------------------------------------------------------------------------
void ServerApp::onAppActiveTick(Mercury::Channel* pChannel, COMPONENT_TYPE componentType, COMPONENT_ID componentID)
{
if(componentType != CLIENT_TYPE)
if(pChannel->isExternal())
return;
Mercury::Channel* pTargetChannel = NULL;
if(componentType != CONSOLE_TYPE && componentType != CLIENT_TYPE)
{
Components::ComponentInfos* cinfos =
Componentbridge::getComponents().findComponent(componentType, KBEngine::getUserUID(), componentID);
if(cinfos == NULL || cinfos->pChannel == NULL)
{
ERROR_MSG(boost::format("ServerApp::onAppActiveTick[%1%]: %2%:%3% not found.\n") %
pChannel % COMPONENT_NAME_EX(componentType) % componentID);
return;
}
pTargetChannel = cinfos->pChannel;
pTargetChannel->updateLastReceivedTime();
}
else
{
pChannel->updateLastReceivedTime();
pTargetChannel = pChannel;
}
//DEBUG_MSG("ServerApp::onAppActiveTick[%x]: %s:%"PRAppID" lastReceivedTime:%"PRIu64" at %s.\n",
// pChannel, COMPONENT_NAME_EX(componentType), componentID, pChannel->lastReceivedTime(), pTargetChannel->c_str());
}
示例6: ERROR_MSG
//-------------------------------------------------------------------------------------
void ServerApp::onIdentityillegal(COMPONENT_TYPE componentType, COMPONENT_ID componentID, uint32 pid, const char* pAddr)
{
ERROR_MSG(fmt::format("ServerApp::onIdentityillegal: The current process and {}(componentID={} ->conflicted???, pid={}, addr={}) conflict, the process will exit!\n",
COMPONENT_NAME_EX((COMPONENT_TYPE)componentType), componentID, pid, pAddr));
this->shutDown(1.f);
}
示例7: while
//-------------------------------------------------------------------------------------
void Components::removeComponentFromChannel(Mercury::Channel * pChannel)
{
int ifind = 0;
while(ALL_COMPONENT_TYPES[ifind] != UNKNOWN_COMPONENT_TYPE)
{
COMPONENT_TYPE componentType = ALL_COMPONENT_TYPES[ifind++];
COMPONENTS& components = getComponents(componentType);
COMPONENTS::iterator iter = components.begin();
for(; iter != components.end();)
{
if((*iter).pChannel == pChannel)
{
//SAFE_RELEASE((*iter).pIntAddr);
//SAFE_RELEASE((*iter).pExtAddr);
// (*iter).pChannel->decRef();
WARNING_MSG("Components::removeComponentFromChannel: %s : %"PRAppID".\n", COMPONENT_NAME_EX(componentType), (*iter).cid);
iter = components.erase(iter);
return;
}
else
iter++;
}
}
// KBE_ASSERT(false && "channel is not found!\n");
}
示例8: localtime
//-------------------------------------------------------------------------------------
void Messagelog::writeLog(Mercury::Channel* pChannel, KBEngine::MemoryStream& s)
{
uint32 logtype;
COMPONENT_TYPE componentType = UNKNOWN_COMPONENT_TYPE;
COMPONENT_ID componentID = 0;
COMPONENT_ORDER componentOrder = 0;
int64 t;
GAME_TIME kbetime = 0;
std::string str;
std::stringstream logstream;
s >> logtype;
s >> componentType;
s >> componentID;
s >> componentOrder;
s >> t >> kbetime;
s >> str;
time_t tt = static_cast<time_t>(t);
tm* aTm = localtime(&tt);
// YYYY year
// MM month (2 digits 01-12)
// DD day (2 digits 01-31)
// HH hour (2 digits 00-23)
// MM minutes (2 digits 00-59)
// SS seconds (2 digits 00-59)
if(aTm == NULL)
{
ERROR_MSG("Messagelog::writeLog: log is error!\n");
return;
}
char timebuf[MAX_BUF];
kbe_snprintf(timebuf, MAX_BUF, " [%-4d-%02d-%02d %02d:%02d:%02d %02d] ", aTm->tm_year+1900, aTm->tm_mon+1,
aTm->tm_mday, aTm->tm_hour, aTm->tm_min, aTm->tm_sec, kbetime);
logstream << KBELOG_TYPE_NAME_EX(logtype);
logstream << " ";
logstream << COMPONENT_NAME_EX_1(componentType);
logstream << " ";
logstream << componentID;
logstream << " ";
logstream << (int)componentOrder;
logstream << timebuf;
logstream << "- ";
logstream << str;
DebugHelper::getSingleton().changeLogger(COMPONENT_NAME_EX(componentType));
PRINT_MSG(logstream.str());
DebugHelper::getSingleton().changeLogger("default");
LOG_WATCHERS::iterator iter = logWatchers_.begin();
for(; iter != logWatchers_.end(); iter++)
{
iter->second.onMessage(logtype, componentType, componentID, componentOrder, t, kbetime, str, logstream);
}
}
示例9: kbe_snprintf
//-------------------------------------------------------------------------------------
void DebugHelper::initHelper(COMPONENT_TYPE componentType)
{
#ifndef NO_USE_LOG4CXX
g_logger = log4cxx::Logger::getLogger(COMPONENT_NAME_EX(componentType));
char helpConfig[256];
if(componentType == CLIENT_TYPE)
{
kbe_snprintf(helpConfig, 256, "log4j.properties");
}
else
{
kbe_snprintf(helpConfig, 256, "server/log4cxx_properties/%s.properties", COMPONENT_NAME_EX(componentType));
}
log4cxx::PropertyConfigurator::configure(Resmgr::getSingleton().matchRes(helpConfig).c_str());
#endif
}
示例10: free
void StatusWindow::addApp(Components::ComponentInfos& cinfos)
{
std::stringstream stream;
stream << cinfos.cid;
CString str;
std::string tstr;
stream >> tstr;
wchar_t* ws = KBEngine::strutil::char2wchar(tstr.c_str());
str = ws;
free(ws);
bool found = false;
for(int icount = 0; icount < m_statusList.GetItemCount(); icount++)
{
CString s = m_statusList.GetItemText(icount, 2);
if(str == s)
{
found = true;
break;
}
}
if(!found)
{
CString suid;
suid.Format(L"%u", cinfos.uid);
m_statusList.InsertItem(0, suid);
static int ndata = 0;
m_statusList.SetItemData(0, ndata++);
CString cname;
ws = KBEngine::strutil::char2wchar(COMPONENT_NAME_EX(cinfos.componentType));
cname = ws;
free(ws);
m_statusList.SetItemText(0, 1, cname);
m_statusList.SetItemText(0, 2, str);
ws = KBEngine::strutil::char2wchar(cinfos.pIntAddr->c_str());
str = ws;
free(ws);
m_statusList.SetItemText(0, 7, str);
ws = KBEngine::strutil::char2wchar(cinfos.username);
str = ws;
free(ws);
m_statusList.SetItemText(0, 8, str);
}
}
示例11: getChannel
//-------------------------------------------------------------------------------------
void EntityMailbox::c_str(char* s, size_t size)
{
const char * mailboxName =
(type_ == MAILBOX_TYPE_CELL) ? "Cell" :
(type_ == MAILBOX_TYPE_BASE) ? "Base" :
(type_ == MAILBOX_TYPE_CLIENT) ? "Client" :
(type_ == MAILBOX_TYPE_BASE_VIA_CELL) ? "BaseViaCell" :
(type_ == MAILBOX_TYPE_CLIENT_VIA_CELL) ? "ClientViaCell" :
(type_ == MAILBOX_TYPE_CELL_VIA_BASE) ? "CellViaBase" :
(type_ == MAILBOX_TYPE_CLIENT_VIA_BASE) ? "ClientViaBase" : "???";
Network::Channel* pChannel = getChannel();
kbe_snprintf(s, size, "%s id:%d, utype:%u, component=%s[%" PRIu64 "], addr: %s.",
mailboxName, id_, utype_,
COMPONENT_NAME_EX(ENTITY_MAILBOX_COMPONENT_TYPE_MAPPING[type_]),
componentID_, (pChannel && pChannel->pEndPoint()) ? pChannel->addr().c_str() : "None");
}
示例12: if
//-------------------------------------------------------------------------------------
void Dbmgr::onGlobalDataClientLogon(Mercury::Channel* pChannel, COMPONENT_TYPE componentType)
{
if(BASEAPP_TYPE == componentType)
{
pBaseAppData_->onGlobalDataClientLogon(pChannel, componentType);
pGlobalData_->onGlobalDataClientLogon(pChannel, componentType);
}
else if(CELLAPP_TYPE == componentType)
{
pGlobalData_->onGlobalDataClientLogon(pChannel, componentType);
pCellAppData_->onGlobalDataClientLogon(pChannel, componentType);
}
else
{
ERROR_MSG(boost::format("Dbmgr::onGlobalDataClientLogon: nonsupport %1%!\n") %
COMPONENT_NAME_EX(componentType));
}
}
示例13: INFO_MSG
//-------------------------------------------------------------------------------------
void ServerApp::onRegisterNewApp(Mercury::Channel* pChannel, int32 uid, std::string& username,
int8 componentType, uint64 componentID, int8 globalorderID, int8 grouporderID,
uint32 intaddr, uint16 intport, uint32 extaddr, uint16 extport, std::string& extaddrEx)
{
if(pChannel->isExternal())
return;
INFO_MSG(boost::format("ServerApp::onRegisterNewApp: uid:%1%, username:%2%, componentType:%3%, "
"componentID:%4%, globalorderID=%10%, grouporderID=%11%, intaddr:%5%, intport:%6%, extaddr:%7%, extport:%8%, from %9%.\n") %
uid %
username.c_str() %
COMPONENT_NAME_EX((COMPONENT_TYPE)componentType) %
componentID %
inet_ntoa((struct in_addr&)intaddr) %
ntohs(intport) %
(extaddr != 0 ? inet_ntoa((struct in_addr&)extaddr) : "nonsupport") %
ntohs(extport) %
pChannel->c_str() %
((int32)globalorderID) %
((int32)grouporderID));
Components::ComponentInfos* cinfos = Componentbridge::getComponents().findComponent((
KBEngine::COMPONENT_TYPE)componentType, uid, componentID);
pChannel->componentID(componentID);
if(cinfos == NULL)
{
Componentbridge::getComponents().addComponent(uid, username.c_str(),
(KBEngine::COMPONENT_TYPE)componentType, componentID, globalorderID, grouporderID, intaddr, intport, extaddr, extport, extaddrEx, 0,
0.f, 0.f, 0, 0, 0, 0, 0, pChannel);
}
else
{
KBE_ASSERT(cinfos->pIntAddr->ip == intaddr && cinfos->pIntAddr->port == intport);
cinfos->pChannel = pChannel;
}
}
示例14: INFO_MSG
//-------------------------------------------------------------------------------------
void ServerApp::onRegisterNewApp(Network::Channel* pChannel, int32 uid, std::string& username,
COMPONENT_TYPE componentType, COMPONENT_ID componentID, COMPONENT_ORDER globalorderID, COMPONENT_ORDER grouporderID,
uint32 intaddr, uint16 intport, uint32 extaddr, uint16 extport, std::string& extaddrEx)
{
if(pChannel->isExternal())
return;
INFO_MSG(fmt::format("ServerApp::onRegisterNewApp: uid:{0}, username:{1}, componentType:{2}, "
"componentID:{3}, globalorderID={9}, grouporderID={10}, intaddr:{4}, intport:{5}, extaddr:{6}, extport:{7}, from {8}.\n",
uid,
username.c_str(),
COMPONENT_NAME_EX((COMPONENT_TYPE)componentType),
componentID,
inet_ntoa((struct in_addr&)intaddr),
ntohs(intport),
(extaddr != 0 ? inet_ntoa((struct in_addr&)extaddr) : "nonsupport"),
ntohs(extport),
pChannel->c_str(),
((int32)globalorderID),
((int32)grouporderID)));
Components::ComponentInfos* cinfos = Components::getSingleton().findComponent((
KBEngine::COMPONENT_TYPE)componentType, uid, componentID);
pChannel->componentID(componentID);
if(cinfos == NULL)
{
Components::getSingleton().addComponent(uid, username.c_str(),
(KBEngine::COMPONENT_TYPE)componentType, componentID, globalorderID, grouporderID, intaddr, intport, extaddr, extport, extaddrEx, 0,
0.f, 0.f, 0, 0, 0, 0, 0, pChannel);
}
else
{
KBE_ASSERT(cinfos->pIntAddr->ip == intaddr && cinfos->pIntAddr->port == intport);
cinfos->pChannel = pChannel;
}
}
示例15: PyErr_Format
//.........这里部分代码省略.........
{
PyErr_Format(PyExc_AssertionError, "%s::clientEntity(%s): no client, srcEntityID(%d).\n",
srcEntity->scriptName(), methodDescription_->getName(), srcEntity->id());
PyErr_PrintEx(0);
return 0;
}
Network::Channel* pChannel = srcEntity->pWitness()->pChannel();
if(!pChannel)
{
PyErr_Format(PyExc_AssertionError, "%s::clientEntity(%s): no client, srcEntityID(%d).\n",
srcEntity->scriptName(), methodDescription_->getName(), srcEntity->id());
PyErr_PrintEx(0);
return 0;
}
EntityRef* pEntityRef = srcEntity->pWitness()->getAOIEntityRef(clientEntityID_);
Entity* e = (pEntityRef && ((pEntityRef->flags() & (ENTITYREF_FLAG_ENTER_CLIENT_PENDING | ENTITYREF_FLAG_LEAVE_CLIENT_PENDING)) <= 0))
? pEntityRef->pEntity() : NULL;
if(e == NULL)
{
PyErr_Format(PyExc_AssertionError, "%s::clientEntity(%s): not found entity(%d), srcEntityID(%d).\n",
srcEntity->scriptName(), methodDescription_->getName(), clientEntityID_, srcEntity->id());
PyErr_PrintEx(0);
return 0;
}
MethodDescription* methodDescription = getDescription();
if(methodDescription->checkArgs(args))
{
MemoryStream* mstream = MemoryStream::createPoolObject();
methodDescription->addToStream(mstream, args);
Network::Bundle* pSendBundle = pChannel->createSendBundle();
NETWORK_ENTITY_MESSAGE_FORWARD_CLIENT_START(srcEntity->id(), (*pSendBundle));
int ialiasID = -1;
const Network::MessageHandler& msgHandler =
srcEntity->pWitness()->getAOIEntityMessageHandler(ClientInterface::onRemoteMethodCall,
ClientInterface::onRemoteMethodCallOptimized, clientEntityID_, ialiasID);
ENTITY_MESSAGE_FORWARD_CLIENT_START(pSendBundle, msgHandler, aOIEntityMessage);
if(ialiasID != -1)
{
KBE_ASSERT(msgHandler.msgID == ClientInterface::onRemoteMethodCallOptimized.msgID);
(*pSendBundle) << (uint8)ialiasID;
}
else
{
KBE_ASSERT(msgHandler.msgID == ClientInterface::onRemoteMethodCall.msgID);
(*pSendBundle) << clientEntityID_;
}
if(mstream->wpos() > 0)
(*pSendBundle).append(mstream->data(), (int)mstream->wpos());
if(Network::g_trace_packet > 0)
{
if(Network::g_trace_packet_use_logfile)
DebugHelper::getSingleton().changeLogger("packetlogs");
DEBUG_MSG(fmt::format("ClientEntityMethod::callmethod: pushUpdateData: ClientInterface::onRemoteOtherEntityMethodCall({}::{})\n",
srcEntity->scriptName(), methodDescription->getName()));
switch(Network::g_trace_packet)
{
case 1:
mstream->hexlike();
break;
case 2:
mstream->textlike();
break;
default:
mstream->print_storage();
break;
};
if(Network::g_trace_packet_use_logfile)
DebugHelper::getSingleton().changeLogger(COMPONENT_NAME_EX(g_componentType));
}
ENTITY_MESSAGE_FORWARD_CLIENT_END(pSendBundle, msgHandler, aOIEntityMessage);
// 记录这个事件产生的数据量大小
g_publicClientEventHistoryStats.trackEvent(srcEntity->scriptName(),
(std::string(e->scriptName()) + "." + methodDescription->getName()),
pSendBundle->currMsgLength(),
"::");
srcEntity->pWitness()->sendToClient(ClientInterface::onRemoteMethodCallOptimized, pSendBundle);
MemoryStream::reclaimPoolObject(mstream);
}
S_Return;
}