本文整理汇总了C++中myutil::IntSeq类的典型用法代码示例。如果您正苦于以下问题:C++ IntSeq类的具体用法?C++ IntSeq怎么用?C++ IntSeq使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IntSeq类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getStatusIdsFrom
MyUtil::IntSeq StatusCacheManagerI::getStatusIdsFrom(const MyUtil::IntSeq& ids, const Ice::Current& current){
ostringstream op;
IntSeq res;
for( MyUtil::IntSeq::const_iterator it = ids.begin(); it != ids.end(); ++it ){
if( !_status[*it] ){
res.push_back( *it );
op << *it << "(0) ";
}
}
MCE_INFO("StatusCacheManagerI::getStatusIdsFrom -> " << op.str()
<< " " << current.con->toString().substr(current.con->toString().find("remote", 25)));
return res;
}
示例2:
map<string, string> UseImNotifyTask::parameters(){
map<string, string> paras;
paras["method"] = "notifications.send";
paras["session_key"] = boost::lexical_cast<string>(_userid);
//paras["api_key"] = "ffa4add0b30141aa9eb9a8f1af34a8c3";
//paras["call_id"] = boost::lexical_cast<string>(time(NULL));
//paras["v"] = "1.0";
//paras["format"] = "xml";
MyUtil::IntSeq ids;
try{
ids = BuddyByOnlineTimeCacheAdapter::instance().getFriendList(_userid, 20);
}
catch(Ice::Exception& e){
MCE_WARN("UseImNotifyTask::parameters-->BuddyByOnlineTimeCacheAdapter::getFriendList-->" << e);
}
if(ids.empty()) {
return map<string, string>();
}
MCE_INFO("UseImNotifyTask::parameters --> " << _userid << " " << ids.size());
ostringstream buddyids;
for(size_t i = 0; i < ids.size(); ++i) {
// int c = ids.size() < 10? ids.size(): 10;
// for(size_t i = 0; i < c; ++i) {
if(i) {
buddyids << ",";
}
buddyids << ids.at(i);
}
paras["to_ids"] = buddyids.str();
ostringstream msg[3];
msg[0] << "<xn:name uid=\""<<_userid<<"\" linked=\"true\"/>悄悄安装了<a href=\"http://im.renren.com/desktop.html?answer1\">人人桌面</a>,能定时启动游戏,采摘你的果实,升级更快了!| <a href=\"http://im.renren.com/desktop/ver19/rrsetup.exe?answer1\">赶紧安装不能落后!</a>";
msg[1] << "<xn:name uid=\""<<_userid<<"\" linked=\"true\"/>抢先体验了<a href=\"http://im.renren.com/desktop.html?settime2\">人人桌面</a>,留言提醒、快速回复、好友聊天更快更稳定! | <a href=\"http://im.renren.com/desktop/ver19/rrsetup.exe?settime2\">快来安装吧</a>";
msg[2] << "<xn:name uid=\""<<_userid<<"\" linked=\"true\"/>用<a href=\"http://im.renren.com/desktop.html?onemin3\">人人桌面</a>登录了人人网,TA不开网页,就能一键登录、隐身上线、定时玩游戏! | <a href=\"http://im.renren.com/desktop/ver19/rrsetup.exe?onemin3\">我也要安装</a>";
paras["notification"] = msg[abs(_userid)%3].str();
/* paras["sig"] = makeSig(paras);
string path = "http://api.xiaonei.com/server/restserver.do";
try{
RestMediatorAdapter::instance().restRequest(id(), _userid, path, paras);
}catch(Ice::Exception& e){
MCE_WARN("UseImNotifyTask::handle --> invoke RestMediatorAdapter error" << e);
}*/
return paras;
}
示例3: getGuideIdsFrom
MyUtil::IntSeq UserStateFilterManagerI::getGuideIdsFrom(const MyUtil::IntSeq& ids, const Ice::Current& current){
ostringstream op;
IntSeq res;
for( MyUtil::IntSeq::const_iterator it = ids.begin(); it != ids.end(); ++it ){
if( _user_state_guide[*it] ){
res.push_back( *it );
} else{
op << *it << " ";
}
}
MCE_INFO("UserStateFilterManagerI::getGuideIdsFrom " << ids.size() << " ids -> res: " << res.size() << " ids. filter: " << op.str()
<< " " << current.con->toString().substr(current.con->toString().find("remote", 25)));
return res;
}
示例4: get
MyUtil::IntSeq IPRecordData::get(int limit){
IceUtil::Mutex::Lock lock(*this);
if( limit < 0){
return _users;
}
MyUtil::IntSeq result;
for( MyUtil::IntSeq::reverse_iterator it = _users.rbegin(); it != _users.rend(); ++it ) {
if (--limit < 0 ) {
break;
}
result.push_back(*it);
}
return result;
}
示例5: instance
map<int,bool> OfferFriendsUtil::getStateGuideBatch(const MyUtil::IntSeq& ids){
try {
return UserStateFilterAdapter::instance().getStateGuideBatch( ids );
} catch( Ice::Exception e ){
MCE_WARN("[OfferFriendsUtil::getStateGuideBatch] ids.size()=" << ids.size() << " found Ice::Exception : " << e.what() );
} catch( ... ){
MCE_WARN("[OfferFriendsUtil::getStateGuideBatch] ids.size()=" << ids.size() << " found unknown exception" );
}
map<int,bool> res;
for( MyUtil::IntSeq::const_iterator it = ids.begin(); it != ids.end(); ++it ){
res[*it] = false;
}
return res;
}
示例6: sort
void UserCounterI::sort() {
map<int, int> m;
for (unsigned int i = 0; i < types.size(); ++i) {
m.insert(make_pair(types[i], values[i]));
}
MyUtil::IntSeq t;
MyUtil::IntSeq v;
for (map<int, int>::iterator i = m.begin(); i != m.end(); ++i) {
t.push_back(i->first);
v.push_back(i->second);
}
types = t;
values = v;
}
示例7: handle
void ReloadTask::handle(){
MyUtil::IntSeq buddies;
try {
buddies = BuddyByIdCacheAdapter::instance().getFriendListAsc( _id, -1 );
} catch( Ice::Exception e ){
MCE_WARN("[ReloadTask] id=" << _id << " found Ice::Exception : " << e.what() );
return;
} catch( ... ){
MCE_WARN("[ReloadTask] id=" << _id << " found Ice::Exception" );
return;
}
multimap<int, int> orderFriend;
try{
Statement sql;
sql << "SELECT guest, UNIX_TIMESTAMP(time) AS time FROM relation_"
<< (_id % 100)
<< " WHERE host="
<< _id;
ostringstream pattern;
pattern << "relation_" << (_id % 100);
QueryRunner("relation_buddycache", CDbRServer, pattern.str()).query(
sql, OrderedListHandler( buddies, orderFriend, "time", "guest" ) );
}catch(std::exception& e){
MCE_WARN( "[ReloadTask] handle " << _id << " std::exception " << e.what() );
return;
}catch(...){
MCE_WARN( "[ReloadTask] handle " << _id << " unknown exception." );
return;
}
int time_now = (int)time(NULL);
MyUtil::IntSeq times;
ostringstream timestr;
for( MyUtil::IntSeq::iterator itB=buddies.begin(); itB!=buddies.end(); ++itB ){
times.push_back( time_now );
timestr << time_now << " ";
}
for (multimap<int, int>::reverse_iterator itMap = orderFriend.rbegin(); itMap
!= orderFriend.rend(); ++itMap ){
buddies.push_back(itMap->second);
times.push_back(itMap->first);
timestr << itMap->first << " ";
}
BuddyByAddTimeDataNPtr obj = new BuddyByAddTimeDataN;
buddies.swap(obj->friends);
times.swap(obj->times);
MCE_INFO("[ReloadTask] id=" << _id << " friends.size()=" << obj->friends.size() << " times=" << timestr.str() );
SetDataHelper::instance().invokeDelay(_id,obj,timestr.str());
}
示例8: getSearchCacheList
Int2SearchCacheResultMap SearchCacheManagerI::getSearchCacheList(const ::MyUtil::IntSeq& userIds, const Ice::Current& ic) {
struct timeval tvStart;
struct timeval tvStart1;
struct timeval tvEnd;
MyUtil::LongSeq uids;
gettimeofday(&tvStart, NULL);
Int2SearchCacheResultMap result;
for (MyUtil::IntSeq::const_iterator it = userIds.begin(); it!= userIds.end(); ++it) {
BinStringPtr binStrPtr = ObjectCacheHelper::instance().findObject<BinStringPtr> (*it);
if (binStrPtr.get() != NULL) {
SearchMemCacheDataPtr pSCData = new SearchMemCacheData();
char* pBuf = NULL;
int len = 0;
binStrPtr->getBuf(&pBuf, &len);
if (pBuf==NULL || len <= 0) continue;
if (pSCData->Unserialize(pBuf, len)) {
result[*it] = pSCData->getProperties();
}
} else {
//scq
if (*it != 0) {
uids.push_back(*it);
}
}
}
gettimeofday(&tvStart1, NULL);
if (!uids.empty())
_invokeLoad.invoke(uids);
gettimeofday(&tvEnd, NULL);
int start = tvStart.tv_sec*1000000 + tvStart.tv_usec;
int start1 = tvStart1.tv_sec*1000000 + tvStart1.tv_usec;
int end = tvEnd.tv_sec*1000000 + tvEnd.tv_usec;
if ((end - start) > 5000) {
const Ice::ConnectionPtr con = ic.con;
if (con.get() != NULL) {
MCE_INFO(con->toString() << " Get SearchCache List: time=" << end-start << "us " <<
"invokeLoad: time=" << end - start1 << "us total=" << userIds.size());
}
}
return result;
}
示例9: getFansByUserIds
PageEntryList PageFansManagerI::getFansByUserIds(::Ice::Int pageId,const MyUtil::IntSeq& userIds,
const Ice::Current& current){
MCE_INFO("PageFansManagerI::getFansByUserIds: pageId" << pageId << " iDs.size " << userIds.size());
PageFansObjIPtr obj = locatePageFans(pageId);
PageEntryList list = obj->realfans;
PageEntryList result ;
for(MyUtil::IntSeq::const_iterator it=userIds.begin();it!=userIds.end();it++)
{
PageEntryPtr pe = obj->getFan(*it);
if(pe)
result.push_back(pe);
}
MCE_INFO("PageFansManagerI::getFansByUserIds result.size " << result.size() );
return result;
}
示例10: batchVerify
MyUtil::IntSeq TalkRightAdapter::batchVerify(int index, const VerifySeq& seq) {
MyUtil::IntSeq res;
try {
res = getManager(abs(index) % getCluster())->batchVerify(seq);
} catch(...) {
for(size_t i = 0; i < seq.size(); ++i){
res.push_back(seq.at(i)->index);
}
}
return res;
}
示例11: RankDataComp
// FriendRankCacheI::GetRevRank {{{
map<int,int> FriendRankCacheI::GetRevRank(int hostId, const MyUtil::IntSeq& guestIds,
const Ice::Current& cur)
{
//struct timeval start;
//gettimeofday(&start, NULL);
MCE_INFO("FriendRankCacheI::GetRevRank("<<hostId<<",guestIds.size="<<guestIds.size()<<")");
map<int,int> revrank;
RankData target;
int guestId = 0;
for (vector<int>::const_iterator iter = guestIds.begin();
iter != guestIds.end(); ++iter)
{
guestId = *iter;
// 方案1:若Cache中找不到数据,会自动调用FriendRankFactoryI::create。
//FriendRankDataPtr rank = ServiceI::instance().locateObject<FriendRankDataPtr>(
// FRIEND_RANK_DATA, guestId);
//MCE_INFO("get rank of " << guestId << "\tsize=" << rank->data.size());
// 方案2:若Cache中不存在,就直接返回空对象。前提DB与Cache保持一致
FriendRankDataPtr rank =
ServiceI::instance().findObject<FriendRankDataPtr>(FRIEND_RANK_DATA, guestId);
if (!rank)
continue;
target.userid = hostId;
vector<RankData>::iterator kIter =
lower_bound(rank->data.begin(), rank->data.end(), target, RankDataComp());
if(kIter!=rank->data.end() && kIter->userid==target.userid)
{
revrank.insert(make_pair<int,int>(guestId, kIter->weight));
}
}
//MCE_INFO("--------------------");
//for (map<int,int>::const_iterator iter = revrank.begin();
// iter != revrank.end(); ++iter)
//{
// MCE_INFO(iter->first << " : " << iter->second);
//}
//struct timeval end;
//gettimeofday(&end, NULL);
//double timeuse = 1000000*(end.tv_sec-start.tv_sec) + end.tv_usec-start.tv_usec;
//MCE_INFO("FriendRankCacheI::GetRevRank() Time used "<<timeuse/1000000<<"second.");
return revrank;
}// }}}
示例12: create
ObjectResultPtr LinkViewReaderPreloaderFactory::create(const MyUtil::IntSeq& ids) {
MCE_INFO("LinkViewReaderPreloader::create group -> id size: "<<ids.size());
ObjectResultPtr results = new ObjectResult;
BatchLinkViewReaderPreloaderResultHandler handler(results );
Statement sql;
sql << "SELECT id, link, linkStatus" << " FROM " << TABLE_PERSONAL << " WHERE id IN (";
for (MyUtil::IntSeq::const_iterator it = ids.begin(); it != ids.end(); ++it) {
if (it != ids.begin()) {
sql << ",";
}
sql << *it;
}
sql << ")";
QueryRunner(DB_PERSONAL, CDbRServer).query(sql, handler);
return results;
}
示例13: main
int main(int argc, char* argv[]) {
MyUtil::IntSeq ids;
ids.push_back(68126);
std::map<int, UserCachePtr> res = UserCacheAdapter::instance().GetUserCache(ids);
cout << "id: " << res.find(68126)->second->id() << endl;
cout << "name: " << res.find(68126)->second->name() << endl;
cout << "status: " << res.find(68126)->second->status() << endl;
cout << "tinyurl: " << res.find(68126)->second->tinyurl() << endl;
cout << "state: " << res.find(68126)->second->state() << endl;
cout << "gender: " << res.find(68126)->second->gender() << endl;
cout << "online: " << res.find(68126)->second->online() << endl;
cout << "level: " << res.find(68126)->second->level() << endl;
cout << "univ: " << res.find(68126)->second->univ() << endl;
cout << res.find(68126)->second->IsSelected() << endl;
return 0;
}
示例14: reloadUsers
void MiniGroupWriterI::reloadUsers(const MyUtil::IntSeq& user_ids, const Ice::Current& current) {
map<int, vector<int> > seperatedIds = DBUtil<int>::seperateIdsByMod<int>(TABLE_MOD, user_ids);
MCE_INFO("[MiniGroupWriterI::reloadUsers] userIds.size = " << user_ids.size());
for (map<int, vector<int> >::const_iterator it = seperatedIds.begin(); it != seperatedIds.end(); ++it) {
reloadUser2MiniGroups(it->second, it->first);
}
}
示例15: create
Ice::ObjectPtr UserPhotosInfoFactoryI::create(Ice::Int id) {
MCE_INFO("[UserPhotosInfoFactoryI::create] userId = " << id);
vector<UserPhotosInfoPtr> ptrs;
Statement sql;
string tableName = TABLE_NAME + "_" + boost::lexical_cast<string>(id % TABLE_MOD);
sql << "select " << COLUMN_USERID << ", " << COLUMN_PHOTOS << " from " << tableName << " where "
<< COLUMN_USERID << " = " << id;
QueryRunner(DB_SOURCE, CDbRServer, tableName).query(sql, UserPhotosInfoResultHandlerI(ptrs));
if (ptrs.empty() || (*ptrs.begin())->getPhotoInfos().empty()) {
return EMPTY_USER_PHOTOS_INFO_PTR;
} else {
MyUtil::IntSeq userIds;
userIds.push_back(id);
FriendsRecentPhotosWriterAdapter::instance().reloadUserPhotos(userIds);
return *ptrs.begin();
}
}