本文整理汇总了C++中Events::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ Events::begin方法的具体用法?C++ Events::begin怎么用?C++ Events::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Events
的用法示例。
在下文中一共展示了Events::begin方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main() {
std::string line;
Events events;
while (std::getline(std::cin, line)) {
std::vector<std::string> elements;
boost::split(elements, line, boost::is_any_of("/"));
if (elements.size() != 4) {
std::cerr << "Warning: elements.size() != 4" << std::endl;
continue;
}
Event e;
e.player = elements[0];
e.map = elements[1];
e.lapTime = parseLapTime(elements[2]);
e.date = parseDate(elements[3]);
events.push_back(e);
}
std::cout << "Number of events: " << events.size() << std::endl;
std::sort(events.begin(), events.end());
std::cout << "Last event: " << events.back() << std::endl;
Ranking ranking = getRankings(events, boost::posix_time::time_from_string("2014-01-03 22:00:00.000"));
for ( unsigned i = 0; i < 20 && i < ranking.size(); ++i ) {
std::cout << i+1 << ".: " << ranking[i].getPlayer() << ", Time: " << ranking[i].getTotalLapTime() << std::endl;
}
std::cout << "Current leader = " << ranking[0].getTotalLapTime() << std::endl;
}
示例2: in
// Create the tmp_insns table to hold all the instructions for the function-to-be-listed and all the instructions of all
// the functions that are mentioned in events.
static void
gather_instructions(const SqlDatabase::TransactionPtr tx, int func_id, const Events &events)
{
std::set<std::string> func_ids;
func_ids.insert(StringUtility::numberToString(func_id));
for (Events::const_iterator ei=events.begin(); ei!=events.end(); ++ei)
func_ids.insert(StringUtility::numberToString(ei->second.func_id));
std::string sql = "create temporary table tmp_insns as"
" select * from semantic_instructions"
" where func_id in ("+StringUtility::join_range(", ", func_ids.begin(), func_ids.end())+")";
tx->execute(sql);
}
示例3: delete_event
//-------------------------------------------------------------------------------------------------
void TimerActor::delete_event(const acto::actor_ref& actor) {
for (Events::iterator i = m_events.begin(); i != m_events.end(); i++) {
if ((*i)->actor == actor) {
// 1. Удалить системный таймер
//
// NOTE: Так как последний параметр INVALID_HANDLE_VALUE, то
// функция возвратит управление только тогда, когда завершится
// выполнение соответствующей TimerProc.
::DeleteTimerQueueTimer( m_timers, (*i)->timer, INVALID_HANDLE_VALUE );
// 2. Удалить экземпляр события
delete (*i);
// 3. Удалить элемент из списка
m_events.erase( i );
// -
break;
}
}
}
示例4: appendEvents
void EventQueue::appendEvents(Events& events)
{
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_eventQueueMutex);
_eventQueue.insert(_eventQueue.end(), events.begin(), events.end());
}
示例5: begin
const_iterator begin () const
{
return m_events.begin();
}
示例6: main
//.........这里部分代码省略.........
req.delay = delay;
req.relaynum = relaynum;
Feature feature;
memset(&feature, 0, sizeof(feature));
feature.delay = delay;
feature.significance = 0;
feature.seculevel = 0;
feature.channelnum = relaynum;
vector<string> rsparams, mmparams;
rsparams.push_back("SimpleRlysltr");
rsparams.push_back("rsltr.conf");
rsparams.push_back("300000"); // probe interval
rsparams.push_back("300"); // timeout seconds
mmparams.push_back("SimpleMpathManager");
CorsSocket *cors_sk = NULL;
if (use_cors) {
cors_sk = new CorsSocket(sock, rsparams, mmparams);
cors_sk->init(req, remote.sin_addr.s_addr, remote.sin_port);
}
pthread_t recv_tid, timer_tid;
if (use_cors) {
pthread_create(&recv_tid, NULL, recv_thread, cors_sk);
}
// pthread_create(&timer_tid, NULL, timer_thread, &events);
int index = 0;
int sended = 0;
int target = 0;
timeval tm_used, tm_begin;
// gettimeofday(&tm_begin, NULL);
Events::iterator it;
for (; replay > 0; replay--) {
for (it = events.begin(); it != events.end(); ++it) {
timeval timeout = it->delta;
select(0, NULL, NULL, NULL, &timeout);
if (use_cors) {
cors_sk->sendto(it->pkt,
it->len,
remote.sin_addr.s_addr,
remote.sin_port,
feature);
} else {
sendto(sock, it->pkt, it->len, 0,
(sockaddr *)&remote, sizeof(remote));
}
sended++;
}
}
#if 0
while (true) {
pthread_mutex_lock(&timer_mutex);
while (timer_sig == -1) {
pthread_cond_wait(&timer_cond, &timer_mutex);
}
index = timer_sig;
timer_sig = -1;
pthread_mutex_unlock(&timer_mutex);
if (index == -2) {
target = events.size();
} else {