您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ COMPONENT_NAME_EX函数代码示例

51自学网 2021-06-01 20:03:39
  C++
这篇教程C++ COMPONENT_NAME_EX函数代码示例写得很实用,希望能帮到您。

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

在下文中一共展示了COMPONENT_NAME_EX函数的23个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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");}
开发者ID:Jimlan,项目名称:kbengine,代码行数:35,


示例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()));	}}
开发者ID:aabbox,项目名称:kbengine,代码行数:36,


示例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");}
开发者ID:aabbox,项目名称:kbengine,代码行数:49,


示例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());}
开发者ID:nagisun,项目名称:kbengine,代码行数:33,


示例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());}
开发者ID:KitoHo,项目名称:kbengine,代码行数:33,


示例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);}
开发者ID:AddictXQ,项目名称:kbengine,代码行数:8,


示例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");}
开发者ID:ChowZenki,项目名称:kbengine,代码行数:29,


示例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);	}}
开发者ID:KitoHo,项目名称:kbengine,代码行数:58,


示例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}
开发者ID:sdsgwangpeng,项目名称:kbengine,代码行数:19,


示例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);	}}
开发者ID:fengqk,项目名称:kbengine,代码行数:50,


示例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");}
开发者ID:AllenWangxiao,项目名称:kbengine,代码行数:19,


示例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));	}}
开发者ID:Ollydbg,项目名称:kbengine,代码行数:19,


示例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;	}}
开发者ID:KitoHo,项目名称:kbengine,代码行数:39,


示例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;	}}
开发者ID:nagisun,项目名称:kbengine,代码行数:39,


示例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;}
开发者ID:hyperfact,项目名称:kbengine,代码行数:101,


示例16: findComponent

//-------------------------------------------------------------------------------------		int Components::connectComponent(COMPONENT_TYPE componentType, int32 uid, COMPONENT_ID componentID, bool printlog){	Components::ComponentInfos* pComponentInfos = findComponent(componentType, uid, componentID);	if (pComponentInfos == NULL)	{		if (printlog)		{			ERROR_MSG(fmt::format("Components::connectComponent: not found componentType={}, uid={}, componentID={}!/n",				COMPONENT_NAME_EX(componentType), uid, componentID));		}		return -1;	}	Network::EndPoint * pEndpoint = Network::EndPoint::createPoolObject();	pEndpoint->socket(SOCK_STREAM);	if (!pEndpoint->good())	{		if (printlog)		{			ERROR_MSG("Components::connectComponent: couldn't create a socket/n");		}		Network::EndPoint::reclaimPoolObject(pEndpoint);		return -1;	}	pEndpoint->addr(*pComponentInfos->pIntAddr);	int ret = pEndpoint->connect(pComponentInfos->pIntAddr->port, pComponentInfos->pIntAddr->ip);	if(ret == 0)	{		Network::Channel* pChannel = Network::Channel::createPoolObject();		bool ret = pChannel->initialize(*_pNetworkInterface, pEndpoint, Network::Channel::INTERNAL);		if(!ret)		{			if (printlog)			{				ERROR_MSG(fmt::format("Components::connectComponent: initialize({}) is failed!/n",					pChannel->c_str()));			}			pChannel->destroy();			Network::Channel::reclaimPoolObject(pChannel);			return -1;		}		pComponentInfos->pChannel = pChannel;		pComponentInfos->pChannel->componentID(componentID);		if(!_pNetworkInterface->registerChannel(pComponentInfos->pChannel))		{			if (printlog)			{				ERROR_MSG(fmt::format("Components::connectComponent: registerChannel({}) is failed!/n",					pComponentInfos->pChannel->c_str()));			}			pComponentInfos->pChannel->destroy();			Network::Channel::reclaimPoolObject(pComponentInfos->pChannel);			// 此时不可强制释放内存,destroy中已经对其减引用			// SAFE_RELEASE(pComponentInfos->pChannel);			pComponentInfos->pChannel = NULL;			return -1;		}		else		{			Network::Bundle* pBundle = Network::Bundle::createPoolObject();			if(componentType == BASEAPPMGR_TYPE)			{				(*pBundle).newMessage(BaseappmgrInterface::onRegisterNewApp);								BaseappmgrInterface::onRegisterNewAppArgs11::staticAddToBundle((*pBundle), getUserUID(), getUsername(), 					componentType_, componentID_, 					g_componentGlobalOrder, g_componentGroupOrder,					_pNetworkInterface->intaddr().ip, _pNetworkInterface->intaddr().port,					_pNetworkInterface->extaddr().ip, _pNetworkInterface->extaddr().port, g_kbeSrvConfig.getConfig().externalAddress);			}			else if(componentType == CELLAPPMGR_TYPE)			{				(*pBundle).newMessage(CellappmgrInterface::onRegisterNewApp);								CellappmgrInterface::onRegisterNewAppArgs11::staticAddToBundle((*pBundle), getUserUID(), getUsername(), 					componentType_, componentID_, 					g_componentGlobalOrder, g_componentGroupOrder,					_pNetworkInterface->intaddr().ip, _pNetworkInterface->intaddr().port,					_pNetworkInterface->extaddr().ip, _pNetworkInterface->extaddr().port, g_kbeSrvConfig.getConfig().externalAddress);			}			else if(componentType == CELLAPP_TYPE)			{				(*pBundle).newMessage(CellappInterface::onRegisterNewApp);								CellappInterface::onRegisterNewAppArgs11::staticAddToBundle((*pBundle), getUserUID(), getUsername(), 					componentType_, componentID_, 					g_componentGlobalOrder, g_componentGroupOrder,						_pNetworkInterface->intaddr().ip, _pNetworkInterface->intaddr().port,					_pNetworkInterface->extaddr().ip, _pNetworkInterface->extaddr().port, g_kbeSrvConfig.getConfig().externalAddress);			}			else if(componentType == BASEAPP_TYPE)//.........这里部分代码省略.........
开发者ID:aabbox,项目名称:kbengine,代码行数:101,


示例17: getDescription

//-------------------------------------------------------------------------------------PyObject* RealEntityMethod::callmethod(PyObject* args, PyObject* kwds){	MethodDescription* methodDescription = getDescription();	if(methodDescription->checkArgs(args))	{		MemoryStream* mstream = MemoryStream::ObjPool().createObject();		methodDescription->addToStream(mstream, args);		Mercury::Bundle* pForwardBundle = Mercury::Bundle::ObjPool().createObject();				(*pForwardBundle).newMessage(CellappInterface::onRemoteRealMethodCall);		(*pForwardBundle) << ghostEntityID_;				if(mstream->wpos() > 0)			(*pForwardBundle).append(mstream->data(), mstream->wpos());		if(Mercury::g_trace_packet > 0)		{			if(Mercury::g_trace_packet_use_logfile)				DebugHelper::getSingleton().changeLogger("packetlogs");			DEBUG_MSG(boost::format("RealEntityMethod::callmethod: pushUpdateData: CellappInterface::onRemoteRealMethodCall(%3%(%1%)::%2%)/n") % 				ghostEntityID_ % methodDescription->getName() % scriptName_);			switch(Mercury::g_trace_packet)			{			case 1:					mstream->hexlike();					break;			case 2:					mstream->textlike();				break;			default:				mstream->print_storage();				break;			};			if(Mercury::g_trace_packet_use_logfile)					DebugHelper::getSingleton().changeLogger(COMPONENT_NAME_EX(g_componentType));		}		// 记录这个事件产生的数据量大小		g_publicCellEventHistoryStats.trackEvent(scriptName_, 			methodDescription->getName(), 			pForwardBundle->currMsgLength(), 			"::");		MemoryStream::ObjPool().reclaimObject(mstream);				GhostManager* gm = Cellapp::getSingleton().pGhostManager();		if(gm)		{			gm->pushMessage(realCell_, pForwardBundle);		}		else		{			Mercury::Bundle::ObjPool().reclaimObject(pForwardBundle);		}	}	S_Return;}
开发者ID:cookcat,项目名称:kbengine,代码行数:63,


示例18: switch

//-------------------------------------------------------------------------------------bool Componentbridge::findInterfaces(){	int8 findComponentTypes[] = {UNKNOWN_COMPONENT_TYPE, UNKNOWN_COMPONENT_TYPE, UNKNOWN_COMPONENT_TYPE, UNKNOWN_COMPONENT_TYPE, 								UNKNOWN_COMPONENT_TYPE, UNKNOWN_COMPONENT_TYPE, UNKNOWN_COMPONENT_TYPE, UNKNOWN_COMPONENT_TYPE};	switch(componentType_)	{	case CELLAPP_TYPE:		findComponentTypes[0] = MESSAGELOG_TYPE;		findComponentTypes[1] = RESOURCEMGR_TYPE;		findComponentTypes[2] = DBMGR_TYPE;		findComponentTypes[3] = CELLAPPMGR_TYPE;		findComponentTypes[4] = BASEAPPMGR_TYPE;		break;	case BASEAPP_TYPE:		findComponentTypes[0] = MESSAGELOG_TYPE;		findComponentTypes[1] = RESOURCEMGR_TYPE;		findComponentTypes[2] = DBMGR_TYPE;		findComponentTypes[3] = BASEAPPMGR_TYPE;		findComponentTypes[4] = CELLAPPMGR_TYPE;		break;	case BASEAPPMGR_TYPE:		findComponentTypes[0] = MESSAGELOG_TYPE;		findComponentTypes[1] = DBMGR_TYPE;		findComponentTypes[2] = CELLAPPMGR_TYPE;		break;	case CELLAPPMGR_TYPE:		findComponentTypes[0] = MESSAGELOG_TYPE;		findComponentTypes[1] = DBMGR_TYPE;		findComponentTypes[2] = BASEAPPMGR_TYPE;		break;	case LOGINAPP_TYPE:		findComponentTypes[0] = MESSAGELOG_TYPE;		findComponentTypes[1] = DBMGR_TYPE;		findComponentTypes[2] = BASEAPPMGR_TYPE;		break;	case DBMGR_TYPE:		findComponentTypes[0] = MESSAGELOG_TYPE;		break;	default:		if(componentType_ != MESSAGELOG_TYPE && componentType_ != MACHINE_TYPE)			findComponentTypes[0] = MESSAGELOG_TYPE;		break;	};	int ifind = 0;	srand(KBEngine::getSystemTime());	uint16 nport = KBE_PORT_START + (rand() % 1000);	while(findComponentTypes[ifind] != UNKNOWN_COMPONENT_TYPE)	{		if(dispatcher().isBreakProcessing())			return false;		int8 findComponentType = findComponentTypes[ifind];		INFO_MSG("Componentbridge::process: finding %s.../n",			COMPONENT_NAME_EX((COMPONENT_TYPE)findComponentType));				Mercury::BundleBroadcast bhandler(networkInterface_, nport);		if(!bhandler.good())		{			KBEngine::sleep(10);			nport = KBE_PORT_START + (rand() % 1000);			continue;		}		if(bhandler.pCurrPacket() != NULL)		{			bhandler.pCurrPacket()->resetPacket();		}		bhandler.newMessage(MachineInterface::onFindInterfaceAddr);		MachineInterface::onFindInterfaceAddrArgs6::staticAddToBundle(bhandler, getUserUID(), getUsername(), 			componentType_, findComponentType, networkInterface_.intaddr().ip, bhandler.epListen().addr().port);		if(!bhandler.broadcast())		{			ERROR_MSG("Componentbridge::process: broadcast error!/n");			return false;		}			MachineInterface::onBroadcastInterfaceArgs8 args;		if(bhandler.receive(&args, 0, 1000000))		{			if(args.componentType == UNKNOWN_COMPONENT_TYPE)			{				//INFO_MSG("Componentbridge::process: not found %s, try again.../n",				//	COMPONENT_NAME_EX(findComponentType));								KBEngine::sleep(1000);								// 如果是这些辅助组件没找到则跳过				if(findComponentType == MESSAGELOG_TYPE || findComponentType == RESOURCEMGR_TYPE)				{					WARNING_MSG("Componentbridge::process: not found %s!/n",						COMPONENT_NAME_EX((COMPONENT_TYPE)findComponentType));					findComponentTypes[ifind] = -1; // 跳过标志//.........这里部分代码省略.........
开发者ID:shinsuo,项目名称:kbengine,代码行数:101,


示例19: PyErr_Format

//-------------------------------------------------------------------------------------PyObject* EntityRemoteMethod::tp_call(PyObject* self, PyObject* args, 	PyObject* kwds)	{		EntityRemoteMethod* rmethod = static_cast<EntityRemoteMethod*>(self);	MethodDescription* methodDescription = rmethod->getDescription();	EntityMailboxAbstract* mailbox = rmethod->getMailbox();	if(!mailbox->isClient())	{		return RemoteEntityMethod::tp_call(self, args, kwds);	}	Entity* pEntity = Cellapp::getSingleton().findEntity(mailbox->id());	if(pEntity == NULL || pEntity->pWitness() == NULL)	{		//WARNING_MSG(fmt::format("EntityRemoteMethod::callClientMethod: not found entity({})./n", 		//	mailbox->id()));		return RemoteEntityMethod::tp_call(self, args, kwds);	}	Network::Channel* pChannel = pEntity->pWitness()->pChannel();	if(!pChannel)	{		PyErr_Format(PyExc_AssertionError, "%s:EntityRemoteMethod(%s)::tp_call: no client, srcEntityID(%d)./n",			pEntity->scriptName(), methodDescription->getName(), pEntity->id());				PyErr_PrintEx(0);		return RemoteEntityMethod::tp_call(self, args, kwds);	}		// 如果是调用客户端方法, 我们记录事件并且记录带宽	if(methodDescription->checkArgs(args))	{		Network::Bundle* pBundle = pChannel->createSendBundle();		mailbox->newMail((*pBundle));		MemoryStream* mstream = MemoryStream::createPoolObject();		methodDescription->addToStream(mstream, args);		if(mstream->wpos() > 0)			(*pBundle).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("EntityRemoteMethod::tp_call: pushUpdateData: ClientInterface::onRemoteMethodCall({}::{})/n",				pEntity->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));																						}		// 记录这个事件产生的数据量大小		g_privateClientEventHistoryStats.trackEvent(pEntity->scriptName(), 			methodDescription->getName(), 			pBundle->currMsgLength(), 			"::");				pEntity->pWitness()->sendToClient(ClientInterface::onRemoteMethodCall, pBundle);		MemoryStream::reclaimPoolObject(mstream);	}		S_Return;}	
开发者ID:5432935,项目名称:kbengine,代码行数:80,


示例20: INFO_MSG

//-------------------------------------------------------------------------------------void GlobalDataServer::broadcastDataChange(Mercury::Channel* pChannel, COMPONENT_TYPE componentType, 										const std::string& key, const std::string& value, bool isDelete){	INFO_MSG(boost::format("GlobalDataServer::broadcastDataChange: writer(%1%), key_size=%2%, val_size=%3%, isdelete=%4%./n") %		COMPONENT_NAME_EX(componentType) % key.size() % value.size() % (int)isDelete);	std::vector<COMPONENT_TYPE>::iterator iter = concernComponentTypes_.begin();	for(; iter != concernComponentTypes_.end(); iter++)	{		COMPONENT_TYPE ct = (*iter);		Components::COMPONENTS& channels = Components::getSingleton().getComponents(ct);		Components::COMPONENTS::iterator iter1 = channels.begin();				for(; iter1 != channels.end(); iter1++)		{			Mercury::Channel* lpChannel = iter1->pChannel;			KBE_ASSERT(lpChannel != NULL);			if(pChannel == lpChannel)				continue;			Mercury::Bundle* pBundle = Mercury::Bundle::ObjPool().createObject();			switch(dataType_)			{			case GLOBAL_DATA:				if(componentType == CELLAPP_TYPE)				{					(*pBundle).newMessage(CellappInterface::onBroadcastGlobalDataChange);				}				else if(componentType == BASEAPP_TYPE)				{					(*pBundle).newMessage(BaseappInterface::onBroadcastGlobalDataChange);				}				else				{					KBE_ASSERT(false && "componentType is error!/n");				}				break;			case GLOBAL_BASES:				(*pBundle).newMessage(BaseappInterface::onBroadcastGlobalBasesChange);				break;			case CELLAPP_DATA:				(*pBundle).newMessage(CellappInterface::onBroadcastCellAppDataChange);				break;			default:				KBE_ASSERT(false && "dataType is error!/n");				break;			};						(*pBundle) << isDelete;			ArraySize slen = key.size();			(*pBundle) << slen;			(*pBundle).assign(key.data(), slen);			if(!isDelete)			{				slen = value.size();				(*pBundle) << slen;				(*pBundle).assign(value.data(), slen);			}			(*pBundle).send(*lpChannel->endpoint());			Mercury::Bundle::ObjPool().reclaimObject(pBundle);		}	}}
开发者ID:fengqk,项目名称:kbengine,代码行数:69,


示例21: free

//-------------------------------------------------------------------------------------bool Script::install(const wchar_t* pythonHomeDir, std::wstring pyPaths, 	const char* moduleName, COMPONENT_TYPE componentType){	std::wstring pySysPaths = SCRIPT_PATH;	wchar_t* pwpySysResPath = strutil::char2wchar(const_cast<char*>(Resmgr::getSingleton().getPySysResPath().c_str()));	strutil::kbe_replace(pySysPaths, L"../../res/", pwpySysResPath);	pyPaths += pySysPaths;	free(pwpySysResPath);#if KBE_PLATFORM == PLATFORM_WIN32	Py_SetPythonHome(const_cast<wchar_t*>(pythonHomeDir));								// 先设置python的环境变量#else	std::wstring fs = L";";	std::wstring rs = L":";	size_t pos = 0; 	while(true)	{ 		pos = pyPaths.find(fs, pos);		if (pos == std::wstring::npos) break;		pyPaths.replace(pos, fs.length(), rs);	}  	Py_SetPath(pyPaths.c_str()); 	char* tmpchar = strutil::wchar2char(const_cast<wchar_t*>(pyPaths.c_str()));	DEBUG_MSG(boost::format("Script::install: paths=%1%./n") % tmpchar);	free(tmpchar);	#endif	// Initialise python	// Py_VerboseFlag = 2;	Py_FrozenFlag = 1;	// Warn if tab and spaces are mixed in indentation.	// Py_TabcheckFlag = 1;	Py_NoSiteFlag = 1;	Py_IgnoreEnvironmentFlag = 1;	Py_Initialize();                      											// python解释器的初始化      if (!Py_IsInitialized())    {    	ERROR_MSG("Script::install::Py_Initialize is failed!/n");        return false;    } #if KBE_PLATFORM == PLATFORM_WIN32	PySys_SetPath(pyPaths.c_str());#endif	PyObject *m = PyImport_AddModule("__main__");	module_ = PyImport_AddModule(moduleName);										// 添加一个脚本基础模块	if (module_ == NULL)		return false;		const char* componentName = COMPONENT_NAME_EX(componentType);	if (PyModule_AddStringConstant(module_, "component", componentName))	{		ERROR_MSG(boost::format("Script::init: Unable to set KBEngine.component to %1%/n") %			componentName );		return false;	}		// 注册产生uuid方法到py	APPEND_SCRIPT_MODULE_METHOD(module_,		genUUID64,			__py_genUUID64,					METH_VARARGS,			0);	if(!install_py_dlls())	{		ERROR_MSG("Script::init: install_py_dlls() is failed!/n");		return false;	}#ifndef KBE_SINGLE_THREADED	s_pOurInitTimeModules = PyDict_Copy( PySys_GetObject( "modules" ) );	s_pMainThreadState = PyThreadState_Get();	s_defaultContext = s_pMainThreadState;	PyEval_InitThreads();	KBEConcurrency::setMainThreadIdleFunctions(		&Script::releaseLock, &Script::acquireLock );#endif	ScriptStdOutErr::installScript(NULL);											// 安装py重定向模块	ScriptStdOutErrHook::installScript(NULL);	static struct PyModuleDef moduleDesc =   	{  			 PyModuleDef_HEAD_INIT,  			 moduleName,  			 "This module is created by KBEngine!",  			 -1,  			 NULL  	};  	PyModule_Create(&moduleDesc);													// 初始化基础模块	PyObject_SetAttrString(m, moduleName, module_);									// 将模块对象加入main	pyStdouterr_ = new ScriptStdOutErr();											// 重定向python输出	pyStdouterrHook_ = new ScriptStdOutErrHook();	//.........这里部分代码省略.........
开发者ID:CoolJie2001,项目名称:kbengine,代码行数:101,


示例22: getDescription

//-------------------------------------------------------------------------------------PyObject* ClientsRemoteEntityMethod::callmethod(PyObject* args, PyObject* kwds){	// 获取entityAOI范围内其他entity	// 向这些entity的client推送这个方法的调用	MethodDescription* methodDescription = getDescription();	Entity* pEntity = Cellapp::getSingleton().findEntity(id_);	if(pEntity == NULL || /*pEntity->pWitness() == NULL ||*/		pEntity->isDestroyed() /*|| pEntity->clientMailbox() == NULL*/)	{		//WARNING_MSG(boost::format("EntityRemoteMethod::callClientMethod: not found entity(%1%)./n") % 		//	mailbox->id());		S_Return;	}		const std::list<ENTITY_ID>& entities = pEntity->witnesses();	if(otherClients_)	{		if(pEntity->witnessesSize() == 0)			S_Return;	}		// 先发给自己	if(methodDescription->checkArgs(args))	{		MemoryStream* mstream = MemoryStream::ObjPool().createObject();		methodDescription->addToStream(mstream, args);		if((!otherClients_ && (pEntity->pWitness() || (pEntity->clientMailbox()))))		{			Mercury::Bundle* pBundle = Mercury::Bundle::ObjPool().createObject();			pEntity->clientMailbox()->newMail((*pBundle));			if(mstream->wpos() > 0)				(*pBundle).append(mstream->data(), mstream->wpos());			if(Mercury::g_trace_packet > 0)			{				if(Mercury::g_trace_packet_use_logfile)					DebugHelper::getSingleton().changeLogger("packetlogs");				DEBUG_MSG(boost::format("ClientsRemoteEntityMethod::callmethod: pushUpdateData: ClientInterface::onRemoteMethodCall(%1%::%2%)/n") % 					pEntity->scriptName() % methodDescription->getName());																													switch(Mercury::g_trace_packet)																					{																												case 1:																												mstream->hexlike();																								break;																										case 2:																												mstream->textlike();																								break;																										default:																											mstream->print_storage();																						break;																										};																												if(Mercury::g_trace_packet_use_logfile)						DebugHelper::getSingleton().changeLogger(COMPONENT_NAME_EX(g_componentType));																							}			//mailbox->postMail((*pBundle));			pEntity->pWitness()->sendToClient(ClientInterface::onRemoteMethodCall, pBundle);			//Mercury::Bundle::ObjPool().reclaimObject(pBundle);			// 记录这个事件产生的数据量大小			g_publicClientEventHistoryStats.trackEvent(pEntity->scriptName(), 				methodDescription->getName(), 				pBundle->currMsgLength(), 				"::");		}				// 广播给其他人		std::list<ENTITY_ID>::const_iterator iter = entities.begin();		for(; iter != entities.end(); iter++)		{			Entity* pAoiEntity = Cellapp::getSingleton().findEntity((*iter));			if(pAoiEntity == NULL || pAoiEntity->pWitness() == NULL || pAoiEntity->isDestroyed())				continue;						EntityMailbox* mailbox = pAoiEntity->clientMailbox();			if(mailbox == NULL)				continue;			Mercury::Channel* pChannel = mailbox->getChannel();			if(pChannel == NULL)				continue;			if(!pAoiEntity->pWitness()->entityInAOI(pEntity->id()))				continue;			Mercury::Bundle* pSendBundle = Mercury::Bundle::ObjPool().createObject();			Mercury::Bundle* pForwardBundle = Mercury::Bundle::ObjPool().createObject();						pAoiEntity->pWitness()->addSmartAOIEntityMessageToBundle(pForwardBundle, ClientInterface::onRemoteMethodCall, 					ClientInterface::onRemoteMethodCallOptimized, pEntity->id());//.........这里部分代码省略.........
开发者ID:KitoHo,项目名称:kbengine,代码行数:101,


示例23: name

	const char* name(){return COMPONENT_NAME_EX(componentType_);}
开发者ID:321543223,项目名称:kbengine,代码行数:1,



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


C++ COMPUTE_DBG函数代码示例
C++ COMPILE_TIME_ASSERT函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。