当前位置: 首页>>代码示例>>C++>>正文


C++ Events::begin方法代码示例

本文整理汇总了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;
}
开发者ID:r0mai,项目名称:jtt-competition-rank-visualiser,代码行数:34,代码来源:main.cpp

示例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);
}
开发者ID:matzke1,项目名称:rose-develop,代码行数:14,代码来源:90-list-function.C

示例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;
		}
	}
}
开发者ID:artpaul,项目名称:acto,代码行数:19,代码来源:services.cpp

示例4: appendEvents

void EventQueue::appendEvents(Events& events)
{
    OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_eventQueueMutex);
    _eventQueue.insert(_eventQueue.end(), events.begin(), events.end());
}
开发者ID:151706061,项目名称:OpenSceneGraph,代码行数:5,代码来源:EventQueue.cpp

示例5: begin

 const_iterator begin () const
 {
     return m_events.begin();
 }
开发者ID:0rel,项目名称:sequencer64,代码行数:4,代码来源:editable_events.hpp

示例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 {
开发者ID:TheProjecter,项目名称:cors-overlayrouting,代码行数:67,代码来源:rtpsender.cpp


注:本文中的Events::begin方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。