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


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

本文整理汇总了C++中Events::size方法的典型用法代码示例。如果您正苦于以下问题:C++ Events::size方法的具体用法?C++ Events::size怎么用?C++ Events::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Events的用法示例。


在下文中一共展示了Events::size方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: count

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

示例3: main

int main(int argc, char *argv[]) {
	int c;
	bool use_cors = false;
	std::string remote_str, filename;
	sockaddr_in local, remote;
	timeval tm_start, tm_end;
	uint32_t delay = DEFAULT_DELAY;
	uint8_t relaynum = DEFAULT_RLNUM;

	// default arguments
	memset(&local, 0, sizeof(local));
	local.sin_family = AF_INET;
	local.sin_port = htons(DEFAULT_PORT);
	local.sin_addr.s_addr = htonl(INADDR_ANY);

	replay = 1;

	while((c = getopt(argc, argv, "cd:l:n:p:r:")) != -1) {
		switch(c) {
		case 'c':
			use_cors = true;
			break;
		case 'd':
			delay = atoi(optarg);
			break;
		case 'l':
			local.sin_port = htons(atoi(optarg));
			break;
		case 'n':
			replay = atoi(optarg);
			break;
		case 'p':
			relaynum = atoi(optarg);
			break;
		case 'r':
			remote_str = optarg;
			break;
		case '?':
			PrintUsage();
			break;
		}
	}
	if (optind != argc - 1) {
		cout << "must specify an input file" << endl;
		PrintUsage();
		return -1;
	}  
	filename = argv[optind];

	if (remote_str.empty()) {
		cout << "must specify remote addr -- ip:port" << endl;
		PrintUsage();
		return -1;
	}
	size_t pos = remote_str.find(":");
	memset(&remote, 0, sizeof(remote));
	remote.sin_family = AF_INET;
	remote.sin_port = htons(atoi(remote_str.substr(pos+1).c_str()));
	remote.sin_addr.s_addr = inet_addr(remote_str.substr(0, pos).c_str());

	cout << "use_cors: " << (use_cors ? "yes" : "no") << endl;
	cout << "local addr: " << sockaddr2str(local) << endl;
	cout << "remote addr: " << sockaddr2str(remote) << endl;
	cout << "replay time: " << replay << endl;
	cout << "delay requirement: " << delay << "ms" << endl;
	cout << "relay path number: " << (int)relaynum << endl;
	cout << "input file: " << filename << endl; 

	Events events;
	if (ReadRtpData(filename, &events) < 0) {
		return -1;
	}

	int sock;
	if ((sock = InitSock(local)) < 0) {
		return -1;
	}

  int flags;
  if ((flags = fcntl(sock, F_GETFL, 0)) < 0) {
    cerr << "fcntl(GETFL) error" << endl;
    return -1;
  }

  if (fcntl(sock, F_SETFL, flags | O_NONBLOCK) < 0) {
    cerr << "fcntl(SETFL) error" << endl;
    return -1;
  }

	Requirement req;
	memset(&req, 0, sizeof(req));
	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;
//.........这里部分代码省略.........
开发者ID:TheProjecter,项目名称:cors-overlayrouting,代码行数:101,代码来源:rtpsender.cpp


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