本文整理汇总了C++中myutil::IntSeq::insert方法的典型用法代码示例。如果您正苦于以下问题:C++ IntSeq::insert方法的具体用法?C++ IntSeq::insert怎么用?C++ IntSeq::insert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类myutil::IntSeq
的用法示例。
在下文中一共展示了IntSeq::insert方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: run
void UserNameWriterAdapter::run()
{
while(true)
{
MyUtil::IntSeq ids;
{
IceUtil::Monitor<IceUtil::Mutex>::Lock lock(_mutex);
if(_idSet.empty())
{
_mutex.wait();
}
ids.insert(ids.end(), _idSet.begin(), _idSet.end());
_idSet.clear();
}
for(MyUtil::IntSeq::const_iterator it = ids.begin(); it != ids.end(); ++it)
{
UserNameWriterPrx prx = getUserNameWriter(*it);
if(prx)
{
try
{
prx->reload(*it);
}catch(Ice::Exception& e)
{
MCE_WARN("UserNameWriterAdapter::run reload Exception id = " << *it <<" " << e.what());
}
}
}
}
}
示例2: run
void MiniGroupWriterAdapter::run() {
while (true) {
MyUtil::IntSeq userIds;
MyUtil::LongSeq miniGroupIds;
{
IceUtil::Monitor<IceUtil::Mutex>::Lock lock(_mutex);
if (_userIdSet.empty() && _miniGroupIdSet.empty()) {
_mutex.wait();
}
userIds.insert(userIds.end(), _userIdSet.begin(), _userIdSet.end());
_userIdSet.clear();
miniGroupIds.insert(miniGroupIds.end(), _miniGroupIdSet.begin(), _miniGroupIdSet.end());
_miniGroupIdSet.clear();
}
if (!userIds.empty()) {
try {
getMiniGroupWriterPrx(0)->reloadUsers(userIds);
} catch(Ice::Exception& e) {
MCE_WARN("[MiniGroupWriterAdapter::run] reloadUsers size = " << userIds.size());
}
}
if (!miniGroupIds.empty()) {
try {
getMiniGroupWriterPrx(0)->reloadMiniGroups(miniGroupIds);
} catch(Ice::Exception& e) {
MCE_WARN("[MiniGroupWriterAdapter::run] reloadMiniGroups size = " << miniGroupIds.size());
}
}
}
}
示例3: removeRoom
void RoomManagerI::removeRoom(const RoomIdPtr& rid, const Ice::Current&) {
IceUtil::RWRecMutex::WLock lock(_mutex);
MCE_DEBUG("RoomManagerI::removeRoom --> remove room, "
<< roomIdToString(rid));
Ice::Long hashcode = StrUtil::hashcode(roomIdToString(rid));
RoomClusterPtr rc = ServiceI::instance().findObject<RoomClusterPtr>(ROOM_CLUSTER, hashcode);
if (!rc) {
return;
}
rc->remove(rid);
MemberListPtr ml = ServiceI::instance().locateObject<MemberListPtr>(MEMBER_LIST, hashcode);
if (!ml) {
return;
}
Int2IntSeqMap memMap = ml->getMemberList(rid);
/* for (Int2IntSeqMap::iterator it = memMap.begin(); it != memMap.end(); ++it) {
for (size_t i = 0; i < it->second.size(); ++i) {
RoomListPtr rl = ServiceI::instance().findObject<RoomListPtr>(ROOM_LIST, it->second.at(i));
if (rl) {
rl->removeRoom(rid);
}
}
}
*/
ml->remove(rid);
Statement sql;
sql << "delete from room where roomid='" << roomIdToString(rid) << "'";
Statement sql2;
sql2 << "delete from room_member where roomid='" << roomIdToString(rid)
<< "'";
try {
QueryRunner("im_groupchat", CDbWServer).store(sql);
QueryRunner("im_groupchat", CDbWServer).store(sql2);
} catch(Ice::Exception& e) {
MCE_WARN(e << " at " << __FILE__ << ":" << __LINE__);
} catch (std::exception& e) {
MCE_WARN(e.what() << " at " << __FILE__ << ":" << __LINE__);
} catch (...) {
MCE_WARN("Unkown exception at " << __FILE__ << ":" << __LINE__);
}
MyUtil::IntSeq userIds;
for (Int2IntSeqMap::iterator it = memMap.begin(); it != memMap.end(); ++it) {
if(it->first < Member){
continue;
}
userIds.insert(userIds.end(), it->second.begin(), it->second.end());
}
UserRoomAdapter::instance().removeRoomIds(userIds, rid);
}
示例4: handle
//--------------------------------------------------------------------------------
void VertifyPipe::handle(const ObjectSeq& seq) {
//MCE_INFO("VertifyPipe::handle --> thread_id = " << pthread_self());
if (seq.empty()) {
return;
} else {
//MCE_DEBUG("VertifyPipe::handle --> objectseq size = " <<seq.size());
}
VerifySeq vSeq;
IntSeq needNotVerifyUsers;
for (size_t i = 0; i < seq.size(); ++i) {
MessagePtr m = MessagePtr::dynamicCast(seq.at(i));
//MCE_INFO("m->from = " << m->from->userId << " m->to = " << m->to->userId);
if( (m->type != MESSAGE && m->type != OFFLINE_MESSAGE) || (m->from->userId == 365734329 || m->to->userId == 365734329) ){//客服ID,不检查好友。
//MCE_INFO("VertifyPipe::handle --> m->from = " << m->from << " m->to = " << m->to);
needNotVerifyUsers.push_back(i);
continue;
}
VerifyPtr v = new Verify();
v->from = m->from->userId;
v->to = m->to->userId;
/*if(MESSAGE != m->type){
v->to = v->from;
}*/
v->type = m->type;
/* if (v->type == SYSTEM_MESSAGE) {
v->sysMsgType = m->from->endpoint;
}*/
v->index = i;
vSeq.push_back(v);
}
MyUtil::IntSeq indexSeq;
try{
indexSeq = TalkRightAdapter::instance().batchVerify(getIndex(), vSeq);
}catch(Ice::Exception& e){
MCE_WARN("VertifyPipe::handle-->TalkRightAdapter::batchVerify-->" << e);
}
indexSeq.insert(indexSeq.end(), needNotVerifyUsers.begin(), needNotVerifyUsers.end());
//MCE_DEBUG("VertifyPipe::handle -->indexSeq size:"<<indexSeq.size());
for (size_t i = 0; i < indexSeq.size(); ++i) {
MessagePtr m = MessagePtr::dynamicCast(seq.at(indexSeq.at(i)));
//MCE_DEBUG("VertifyPipe::handle --> "<<m->to->index);
if (m->to->index == 0 || m->to->index == 2 || m->to->index >1) {
//MCE_DEBUG("VertifyPipe::handle --> endpoint:"<<m->to->endpoint);
PipePool::instance().push(m->to->endpoint, 0, m);
}
}
}
示例5: batchVerify
MyUtil::IntSeq TalkRightAdapter::batchVerify(const VerifySeq& seq) {
map<int, VerifySeq> vMap;
for (size_t i = 0; i < seq.size(); ++i) {
vMap[abs(seq.at(i)->to) % getCluster()].push_back(seq.at(i));
}
MyUtil::IntSeq res;
for (map<int,VerifySeq>::iterator it = vMap.begin(); it != vMap.end(); ++it) {
try {
MyUtil::IntSeq tmp = getManager(it->first)->batchVerify(it->second);
res.insert(res.end(),tmp.begin(),tmp.end());
} catch(...) {
for(size_t i = 0; i < it->second.size(); ++i){
res.push_back(it->second.at(i)->index);
}
}
}
return res;
}