本文整理汇总了C++中Events::end方法的典型用法代码示例。如果您正苦于以下问题:C++ Events::end方法的具体用法?C++ Events::end怎么用?C++ Events::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Events
的用法示例。
在下文中一共展示了Events::end方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
static void
list_assembly(const SqlDatabase::TransactionPtr &tx, int func_id)
{
Events events;
gather_events(tx, func_id);
load_events(tx, func_id, events);
SqlDatabase::StatementPtr stmt = tx->statement("select address, assembly from semantic_instructions where func_id = ?"
" order by position")->bind(0, func_id);
for (SqlDatabase::Statement::iterator insn=stmt->begin(); insn!=stmt->end(); ++insn) {
rose_addr_t addr = insn.get<rose_addr_t>(0);
std::string assembly = insn.get<std::string>(1);
Events::const_iterator ei=events.find(addr);
// Assembly line prefix
if (ei!=events.end() && ei->second.nexecuted>0) {
std::cout <<std::setw(9) <<std::right <<ei->second.nexecuted <<"x ";
} else {
std::cout <<std::string(11, ' ');
}
// Assembly instruction
std::cout <<"| " <<StringUtility::addrToString(addr) <<": " <<assembly <<"\n";
if (ei!=events.end())
show_events(ei->second);
}
}
示例2: 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;
}
示例3: 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);
}
示例4: takeEvents
bool EventQueue::takeEvents(Events& events)
{
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_eventQueueMutex);
if (!_eventQueue.empty())
{
events.splice(events.end(), _eventQueue);
return true;
}
else
{
return false;
}
}
示例5: copyEvents
bool EventQueue::copyEvents(Events& events) const
{
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_eventQueueMutex);
if (!_eventQueue.empty())
{
events.insert(events.end(),_eventQueue.begin(),_eventQueue.end());
return true;
}
else
{
return false;
}
}
示例6: 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;
}
}
}
示例7: appendEvents
void EventQueue::appendEvents(Events& events)
{
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_eventQueueMutex);
_eventQueue.insert(_eventQueue.end(), events.begin(), events.end());
}
示例8: files
static void
list_combined(const SqlDatabase::TransactionPtr &tx, int func_id, bool show_assembly)
{
CloneDetection::FilesTable files(tx);
Events events;
gather_events(tx, func_id);
load_events(tx, func_id, events/*out*/);
gather_instructions(tx, func_id, events);
Listing listing;
gather_source_code(tx);
load_source_code(tx, listing/*out*/);
// Get lines of assembly code and insert them into the correct place in the Listing.
if (show_assembly) {
SqlDatabase::StatementPtr stmt = tx->statement("select"
// 0 1 2 3
" insn.src_file_id, insn.src_line, insn.position, insn.address,"
// 4 5 6
" insn.assembly, func.id, func.name"
" from tmp_insns as insn"
" join semantic_functions as func on insn.func_id = func.id"
" order by position");
for (SqlDatabase::Statement::iterator row=stmt->begin(); row!=stmt->end(); ++row) {
int src_file_id = row.get<int>(0);
int src_line_num = row.get<int>(1);
SourcePosition srcpos(src_file_id, src_line_num);
int pos = row.get<int>(2);
rose_addr_t addr = row.get<rose_addr_t>(3);
std::string assembly = row.get<std::string>(4);
int func_id = row.get<int>(5);
std::string func_name = row.get<std::string>(6);
listing[srcpos].assembly_code.insert(std::make_pair(addr, AssemblyCode(pos, addr, assembly, func_id, func_name)));
}
// Listing header
std::cout <<"WARNING: This listing should be read cautiously. It is ordered according to the\n"
<<" source code with assembly lines following the source code line from which\n"
<<" they came. However, the compiler does not always generate machine\n"
<<" instructions in the same order as source code. When a discontinuity\n"
<<" occurs in the assembly instruction listing, it will be marked by a \"#\"\n"
<<" character. The assembly instructions are also numbered according to\n"
<<" their relative positions in the binary function.\n"
<<"\n"
<<" The prefix area contains either source location information or test trace\n"
<<" information. Note that trace information might be incomplete because\n"
<<" tracing was disabled or only partially enabled, or the trace includes\n"
<<" instructions that are not present in this function listing (e.g., when\n"
<<" execution follows a CALL instruction). The following notes are possible:\n"
<<" * \"Nx\" where N is an integer indicates that this instruction\n"
<<" was reached N times during testing. These notes are typically\n"
<<" only attached to the first instruction of a basic block and only\n"
<<" if the trace contains EV_REACHED events. Lack of an Nx notation\n"
<<" doesn't necessarily mean that the basic block was not reached, it\n"
<<" only means that there is no EV_REACHED event for that block.\n"
<<" * \"N<\" where N is an integer indicates that the instruction\n"
<<" on the previous line consumed N inputs. Information about the\n"
<<" inputs is listed on the right side of this line.\n"
<<" * \"N>\" where N is an integer indicates that the instruction\n"
<<" on the previous line produced N memory outputs. Information about the\n"
<<" outputs is listed on the right side of this line. Only the final\n"
<<" write to a memory address is considered a true output, and such\n"
<<" writes will be marked with the string \"final\".\n"
<<" * \"BR\" indicates that the instruction on the previous line is a\n"
<<" control flow branch point. The right side of the line shows more\n"
<<" detailed information about how many times the branch was taken.\n"
<<" * \"FAULT\" indicates that the test was terminated at the previous\n"
<<" instruction. The right side of the line shows the distribution of\n"
<<" faults that occurred here.\n"
<<"\n"
<<" /------------- Prefix area\n"
<<" /-------------/-------------- Source file ID or assembly function ID\n"
<<" | /------/--------------- Source line number or assembly instruction index\n"
<<" | | /-/---------------- Instruction out-of-order indicator\n"
<<" | | |/ /----------- Instruction virtual address\n"
<<" | | | |\n"
<<"vvvv vvvvv/| |\n"
<<"vvvvvvvvvv v vvvvvvvvvv\n";
}
// Show the listing
int prev_func_id = -1, prev_position = -1;
std::set<int> seen_files;
for (Listing::iterator li=listing.begin(); li!=listing.end(); ++li) {
int file_id = li->first.file_id;
if (seen_files.insert(file_id).second) {
if (file_id>=0) {
std::cout <<"\n" <<std::setw(4) <<std::right <<file_id <<".file |"
<<(opt.colorize?"\033[33;4m":"") <<files.name(file_id) <<(opt.colorize?"\033[m":"") <<"\n";
} else {
std::cout <<"\n" <<std::string(11, ' ') <<"|"
<<(opt.colorize?"\033[33;4m":"") <<"instructions not associated with a source file"
<<(opt.colorize?"\033[m":"") <<"\n";
}
}
if (file_id>=0) {
std::cout <<std::setw(4) <<std::right <<file_id <<"." <<std::setw(6) <<std::left <<li->first.line_num
<<"|"
<<(opt.colorize?"\033[34m":"")
//.........这里部分代码省略.........
示例9: end
const_iterator end () const
{
return m_events.end();
}
示例10: 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;
//.........这里部分代码省略.........