本文整理汇总了C++中EventQueue::addMessage方法的典型用法代码示例。如果您正苦于以下问题:C++ EventQueue::addMessage方法的具体用法?C++ EventQueue::addMessage怎么用?C++ EventQueue::addMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EventQueue
的用法示例。
在下文中一共展示了EventQueue::addMessage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: atol
bool DatabaseConnection::parse_format_2(char * data, int len){
LOG4CXX_DEBUG(logger,"In DatabaseConnection::parse_format_2() :" << len) ;
//59:5423:501:1323670440:620781428,DB2INST1:select * from staff
std::vector<std::string> strs;
string str_data = data;
boost::split(strs, str_data, boost::is_any_of(":"));
if(strs.size() > 6){
event.src_ip = "127.0.0.1";
event.src_port = atol(strs[1].c_str());
event_timestamp event_ts;
event_ts.event_in_s = atol(strs[3].c_str());
event_ts.event_in_ms = atol(strs[4].c_str());
CachedUserInfo userInfo = userManager.getUserInfo(event.src_ip,strs[1]);
string statement = "";
int i = 6;
while(i < strs.size()){
statement += strs[i++];
}
statement = statement.substr(0,statement.size()-1);
userManager.regStatement(event.src_ip,strs[1],statement);
LOG4CXX_DEBUG(logger,"Statement " << statement);
//Lets check if it's a duplicate
if(userInfo.getEventTimestamp().event_in_s != 0 && (event_ts.event_in_s - userInfo.getEventTimestamp().event_in_s ) < 2){
if( ((event_ts.event_in_s - userInfo.getEventTimestamp().event_in_s)*1000000000 + event_ts.event_in_ms - event_ts.event_in_ms) > 1000000 ){
LOG4CXX_DEBUG(logger,"Duplicate detected: " << ((event_ts.event_in_s - userInfo.getEventTimestamp().event_in_s)*1000000000 + event_ts.event_in_ms - event_ts.event_in_ms) );
event_ts.event_in_s = 0;
event_ts.event_in_ms = 0;
userManager.regEventTimestamp(event.src_ip,strs[1],event_ts);
return true;
}
}else{
userManager.regEventTimestamp(event.src_ip,strs[1],event_ts);
}
if(userInfo.getUsername().empty()){
uid_t uid = atoi(strs[2].c_str());
struct passwd * account = getpwuid(uid);
}
userManager.regAppName(event.src_ip,strs[1],"db2bp");
boost::tokenizer<boost::char_separator<char> > tok(statement);
i = 0;
for (boost::tokenizer<boost::char_separator<char> >::iterator it = tok.begin(); it != tok.end(); ++it,i++){
LOG4CXX_DEBUG(logger,"Token is " << *it);
if( i == 0 &&strcasecmp((*it).c_str(),"connect") == 0 ){
LOG4CXX_DEBUG(logger,"Processing connect");
continue;
}
if( i == 0 &&strcasecmp((*it).c_str(),"terminate") == 0 ){
LOG4CXX_DEBUG(logger,"Terminate processed");
userManager.regUsername(event.src_ip,strs[1],"");
break;
}
if( i == 1 &&strcasecmp((*it).c_str(),"to") == 0 ){
LOG4CXX_DEBUG(logger,"We have a connect statement");
continue;
}
if( i == 2 ){
userManager.regDBName(event.src_ip,strs[1],*it);
continue;
}
if( i == 3 && strcasecmp((*it).c_str(),"user") == 0 ){
continue;
}
if( i == 4 ){
LOG4CXX_DEBUG(logger,"Username specified " << *it);
userManager.regUsername(event.src_ip,strs[1],*it);
}
break;
}
userManager.loadEventAttributes(event.src_ip,strs[1],event);
LOG4CXX_DEBUG(logger,"Event: " << event.statement);
event_queue.addMessage(event);
}
LOG4CXX_DEBUG(logger,"Exiting DatabaseConnection::parse_format_2()");
return true;
}