本文整理汇总了C++中myutil::IntSeq::end方法的典型用法代码示例。如果您正苦于以下问题:C++ IntSeq::end方法的具体用法?C++ IntSeq::end怎么用?C++ IntSeq::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类myutil::IntSeq
的用法示例。
在下文中一共展示了IntSeq::end方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getUnMutualFriends
//获取uid的好友用户中不是gid的粉丝的那些用户
MyUtil::IntSeq MutualFriendsCacheManagerI::getUnMutualFriends(int uid, const MyUtil::GlobalIdPtr& gid, int begin, int limit, const Ice::Current& current) {
ostringstream msg;
msg << "uid = " << uid << ", gid = " << GlobalIdTransfer::get(gid) << ", begin = " << begin << ", limit = " << limit;
InvokeClient ic = InvokeClient::create(current, msg.str(), InvokeClient::INVOKE_LEVEL_INFO);
MyUtil::IntSeq fids = getAllFansAsc(gid);
MyUtil::IntSeq uids = getFriendsAsc(uid);
MyUtil::IntSeq result;
if (limit < -1 || begin < 0 || uid < 0) {
return result;
} else {
int count = 0;
int countLimit = (limit == -1) ? uids.size() : limit;
MyUtil::IntSeq::iterator fit = fids.begin();
MyUtil::IntSeq::iterator uit = uids.begin();
while (fit != fids.end() && uit != uids.end() && count < countLimit + begin) {
if (*fit < *uit) {
fit++;
} else if (*uit < *fit) {
if(count >= begin){
result.push_back(*uit);
}
count++;
uit++;
} else {
fit++;
uit++;
}
}
return result;
}
}
示例2: 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());
}
}
}
}
}
示例3: isFans
bool MutualFriendsCacheManagerI::isFans(int uid, const MyUtil::GlobalIdPtr& gid, const Ice::Current& current) {
ostringstream msg;
msg << "uid = " << uid << ", gid = " << GlobalIdTransfer::get(gid);
InvokeClient ic = InvokeClient::create(current, msg.str(), InvokeClient::INVOKE_LEVEL_INFO);
MyUtil::IntSeq fans = getAllFansAsc(gid);
MyUtil::IntSeq::iterator it = lower_bound(fans.begin(), fans.end(), gid);
return it != fans.end();
}
示例4: get_most_recent
MyUtil::IntSeq RecentlyOnlineBuddyData::get_most_recent(int limit) {
IceUtil::Mutex::Lock lock(*this);
MyUtil::IntSeq result;
for (std::deque<int>::reverse_iterator it = _buddies.rbegin();
(int) result.size() < limit && it != _buddies.rend(); ++it) {
if (find(result.begin(), result.end(), *it)!=result.end()) continue;
result.push_back(*it);
}
return result;
}
示例5: create
ObjectResultPtr BuddyApplyCacheNPreloaderFactory::create(const MyUtil::IntSeq& ids) {
MCE_INFO("BuddyApplyCacheNPreloaderFactory::create group -> id size: "<<ids.size());
int minId = ids.front();
int maxId = ids[ids.size()-1];
MCE_INFO("BuddyApplyCacheNPreloaderFactory::create group -> id from: "<<minId <<" to: "<<maxId);
ObjectResultPtr results = new ObjectResult;
for(std::vector<int>::const_iterator it = ids.begin(); it != ids.end() ; ++it)
{
int id = *it;
BuddyApplyCacheNPtr buddyApplyCacheResult = new BuddyApplyCacheN();
buddyApplyCacheResult->ownerId = id;
BuddyApplyCacheResultHandlerI handler(buddyApplyCacheResult);
Statement sql;
sql
<< "SELECT applicant,UNIX_TIMESTAMP(time) AS unix_time,why,stat_from,group_name"
<< " FROM buddyapply_accepter_" << abs(id % 100) << " WHERE accepter = '" << id << "'"
<< " ORDER BY time DESC"
<< " LIMIT 100";
ostringstream pattern;
pattern << "buddyapply_accepter_" << id % 100;
QueryRunner("buddyapplycache_accepter", CDbRServer,pattern.str()).query(sql, handler);
results->data.insert(make_pair(*it, buddyApplyCacheResult));
}
MCE_INFO("BuddyApplyCacheNPreloaderFactory::create group -> data.size: "<< results->data.size());
return results;
}
示例6: AppendUserFriends
void UserLoginData::AppendUserFriends(MyUtil::Int2IntSeqMap& result,
const MyUtil::IntSeq& userFriends,
const MyUtil::Int2IntSeqMap& negtiveFriendsMap) {
MCE_INFO("[UserLoginData] AppendUserFriends");
for (Int2IntSeqMap::iterator iter = result.begin();
iter != result.end(); ++iter) {
IntSeq& recommendList = iter->second;
IntSeq tempRecommendList(recommendList);
Int2IntSeqMap::const_iterator fIt = negtiveFriendsMap.find(iter->first);
if (fIt != negtiveFriendsMap.end() && !recommendList.empty()) {
for (IntSeq::const_iterator it = userFriends.begin();
it != userFriends.end(); ++it) {
if (find(tempRecommendList.begin(), tempRecommendList.end(), *it) != tempRecommendList.end()) { //过滤好友中已经推出的好友
continue;
}
UserLoginMapType::iterator ff = _userLoginMap.find( *it );
if (ff == _userLoginMap.end() || (int)ff->second.count() < ACTIVEDAYS) { //过滤不活跃的推荐
continue;
}
vector<int>::const_iterator userFriendIter = lower_bound(fIt->second.begin(), fIt->second.end(), *it); //过滤好友列表
if (userFriendIter == fIt->second.end() || *userFriendIter != *it) {
recommendList.push_back(*it);
}
}
}
}
}
示例7: add_old_online
void RecentlyOnlineBuddyData::add_old_online(const MyUtil::IntSeq& sorted_buddies) {
IceUtil::Mutex::Lock lock(*this);
for (MyUtil::IntSeq::const_iterator it = sorted_buddies.begin(); it
!= sorted_buddies.end(); ++it) {
_buddies.push_front(*it);
}
}
示例8: getFriends
SnapshotEntrySeqMap BuddyCoreSnapshotI::getFriends(const ::MyUtil::IntSeq& ids,
const Ice::Current& current) {
SnapshotEntrySeqMap result;
ServiceI& service = ServiceI::instance();
for (IntSeq::const_iterator it = ids.begin(); it != ids.end(); ++it) {
EntryListHolderPtr owner = service.findObject<EntryListHolderPtr>(
CATEGORY_ENTRY, *it);
if (!owner) {
continue;
}
EntryList ownerList = owner->getAll();
SnapshotEntrySeq ownerSnap;
for (EntryList::iterator ownerIt = ownerList.begin(); ownerIt
!= ownerList.end(); ++ownerIt) {
int ownerToId = ownerIt->to;
uint32_t ownerDesc = ownerIt->desc;
//MCE_INFO("Owner:"<<*it <<" Buddy:"<<ownerToId << " Desc:"<<ownerDesc);
if (ownerDesc!=DESC_FRIEND) {
continue;
}
SnapshotEntry entryOwner;
entryOwner.toId = ownerToId;
entryOwner.desc = BuddyDescHelper::translateDesc(ownerDesc);
ownerSnap.push_back(entryOwner);
}
result[*it] = ownerSnap;
}
return result;
}
示例9: reload
void HatDataWriterI::reload(const MyUtil::IntSeq& ids, const Ice::Current & current) {
ostringstream inMsg;
inMsg<<"id size = " << ids.size();
MyUtil::InvokeClient ic = MyUtil::InvokeClient::create(current, inMsg.str(), MyUtil::InvokeClient::INVOKE_LEVEL_INFO);
MyUtil::ObjectResultPtr result = new MyUtil::ObjectResult;
com::xiaonei::xce::Statement sql;
sql << "SELECT * FROM " << TABLE_HAT << " WHERE id IN ( ";
for(MyUtil::IntSeq::const_iterator it = ids.begin(); it != ids.end(); ++it)
{
if(it != ids.begin())
{
sql << ",";
}
sql << *it;
}
sql << " )";
BatchHatDataResultHandlerI handler(result);
{
com::xiaonei::xce::QueryRunner(DB_MEMBERS, com::xiaonei::xce::CDbRServer).query(sql, handler);
xce::adapter::hatdata::HatDataReaderAdapter::instance().setData(result);
}
}
示例10: 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());
}
}
}
}
示例11: getBuddyRelationBatch
Int2BuddyRelationMap BuddyManagerI::getBuddyRelationBatch(const ::MyUtil::IntSeq& userIds, const Ice::Current& current){
Int2BuddyRelationMap result;
for (IntSeq::const_iterator it = userIds.begin(); it != userIds.end(); ++it) {
BuddyRelationPtr brp = getBuddyRelation(*it, current);
result.insert(make_pair(*it, brp));
}
return result;
}
示例12: setNegtiveUserList
void UserLoginData::setNegtiveUserList(const MyUtil::IntSeq& userList) {
IceUtil::RWRecMutex::WLock lock(_init_flag_mutex);
for(IntSeq::const_iterator iter=userList.begin(); iter!=userList.end(); ++iter) {
_negtiveUserList.insert( *iter );
}
MCE_INFO("[UserLoginData] setNegtiveUserList _negtiveUserList size(" << _negtiveUserList.size() << ")");
}
示例13: getBlockSeq
::MyUtil::Int2IntSeqMap BuddyManagerI::getBlockSeqBatch(
const ::MyUtil::IntSeq& userIds, const Ice::Current& current) {
::MyUtil::Int2IntSeqMap result;
for (IntSeq::const_iterator it = userIds.begin(); it != userIds.end(); ++it) {
IntSeq sublist = getBlockSeq(*it, 0, -1, current);
result.insert(make_pair(*it, sublist));
}
return result;
}
示例14: 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;
}
示例15: getWithMask
MyUtil::IntSeq IPRecordData::getWithMask(int limit,::MyUtil::IntSeq mask){
IceUtil::Mutex::Lock lock(*this);
MyUtil::IntSeq result;
if( limit == 0){
return result;
}
std::sort( mask.begin(), mask.end(), std::less<int>() );
for( MyUtil::IntSeq::reverse_iterator it = _users.rbegin(); it != _users.rend(); ++it ) {
MyUtil::IntSeq::iterator itMask = lower_bound(mask.begin(),mask.end(),*it);
if( itMask!=mask.end() && *itMask==*it){
continue;
}
result.push_back(*it);
if (--limit==0) {
break;
}
}
return result;
}