本文整理汇总了C++中Tuple::getElement方法的典型用法代码示例。如果您正苦于以下问题:C++ Tuple::getElement方法的具体用法?C++ Tuple::getElement怎么用?C++ Tuple::getElement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tuple
的用法示例。
在下文中一共展示了Tuple::getElement方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: run
void BoltRankProtocol::run()
{
int counter = 0;
std::size_t connections = 0;
std::string protocol = "";
while(!killRunThread)
{
tupleQueueLock.lock();
if ( !tupleQueue.empty() )
{
Tuple tuple = tupleQueue.front();
tupleQueue.pop_front();
tupleQueueLock.unlock();
if (tuple.getNumElements() == 0)
{
continue;
}
if ( atoi(tuple.getElement(1).c_str()) > connections)
{
connections = atoi(tuple.getElement(1).c_str());
protocol = tuple.getElement(0);
std::cout << "Most visited: " << tuple.getSingleStringComa() << std::endl;
}
}
else
{
tupleQueueLock.unlock();
}
}
}
示例2: run
void BoltFilterFemale::run()
{
int counter = 0;
std::cout << "running female stasl" << std::endl;
while(!killRunThread)
{
tupleQueueLock.lock();
if ( !tupleQueue.empty() )
{
Tuple tuple = tupleQueue.front();
tupleQueue.pop_front();
tupleQueueLock.unlock();
if (tuple.getElement(1) == "female" )
{
++counter;
if (counter % 100 == 0)
{
std::cout << "Females: " << counter << std::endl;
}
}
}
else
{
tupleQueueLock.unlock();
}
}
}
示例3: run
void BoltSumBytes::run()
{
int counter = 0;
std::unordered_map<std::string,unsigned int> protocolMap;
while(!killRunThread)
{
tupleQueueLock.lock();
if ( !tupleQueue.empty() )
{
Tuple tuple = tupleQueue.front();
tupleQueue.pop_front();
tupleQueueLock.unlock();
if(tuple.getNumElements() != 3)
{
continue;
}
std::string protocol = tuple.getElement(0);
unsigned int sent = atoi(tuple.getElement(1).c_str());
unsigned int recv = atoi(tuple.getElement(2).c_str());
unsigned int sum = protocolMap[protocol];
sum = sum + sent + recv;
protocolMap[protocol] = sum;
std::stringstream ss;
ss << protocol << std::endl;
ss << protocolMap[protocol] << std::endl;
Tuple newTuple(ss.str());
std::cout << newTuple.getSingleStringComa() << std::endl;
emit(newTuple);
}
else
{
tupleQueueLock.unlock();
}
}
}