本文整理汇总了C++中mercury::Channel::endpoint方法的典型用法代码示例。如果您正苦于以下问题:C++ Channel::endpoint方法的具体用法?C++ Channel::endpoint怎么用?C++ Channel::endpoint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mercury::Channel
的用法示例。
在下文中一共展示了Channel::endpoint方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onDataChanged
//-------------------------------------------------------------------------------------
void GlobalDataClient::onDataChanged(std::string& key, std::string& value, bool isDelete)
{
Components::COMPONENTS& channels = Components::getSingleton().getComponents(serverComponentType_);
Components::COMPONENTS::iterator iter1 = channels.begin();
uint8 dataType = dataType_;
ArraySize slen = 0;
for(; iter1 != channels.end(); iter1++)
{
Mercury::Channel* lpChannel = iter1->pChannel;
KBE_ASSERT(lpChannel != NULL);
Mercury::Bundle* pBundle = Mercury::Bundle::ObjPool().createObject();
(*pBundle).newMessage(DbmgrInterface::onBroadcastGlobalDataChange);
(*pBundle) << dataType;
(*pBundle) << isDelete;
slen = key.size();
(*pBundle) << slen;
(*pBundle).assign(key.data(), slen);
if(!isDelete)
{
slen = value.size();
(*pBundle) << slen;
(*pBundle).assign(value.data(), slen);
}
(*pBundle) << g_componentType;
(*pBundle).send(*lpChannel->endpoint());
Mercury::Bundle::ObjPool().reclaimObject(pBundle);
}
}
示例2: broadcastDataChange
//-------------------------------------------------------------------------------------
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);
}
}
}