本文整理汇总了C++中Partition::addEvent方法的典型用法代码示例。如果您正苦于以下问题:C++ Partition::addEvent方法的具体用法?C++ Partition::addEvent怎么用?C++ Partition::addEvent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Partition
的用法示例。
在下文中一共展示了Partition::addEvent方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: makeSingletonPartition
void OTFConverter::makeSingletonPartition(CommEvent * evt)
{
Partition * p = new Partition();
p->addEvent(evt);
evt->partition = p;
p->new_partition = p;
trace->partitions->append(p);
}
示例2: addToSavedPartition
void OTFConverter::addToSavedPartition(CommEvent * evt, int partition)
{
while (trace->partitions->size() <= partition)
{
trace->partitions->append(new Partition());
trace->partitions->last()->new_partition = trace->partitions->last();
}
Partition * p = trace->partitions->at(partition);
p->addEvent(evt);
evt->partition = p;
}
示例3: mergeContiguous
// This is a lighter weight merge since we know at this stage everything stays
// within its own task and the partitions that must be merged are contiguous
// Therefore we only need to merge the groups and remove the previous ones
// from the partition list -- so we create the new ones and point the old
// ones toward it so we can make a single pass to remove those that point to
// a new partition.
void OTFConverter::mergeContiguous(QList<QList<Partition * > *> * groups)
{
// Create the new partitions and store them in new parts
QList<Partition *> * newparts = new QList<Partition *>();
for (QList<QList<Partition *> *>::Iterator group = groups->begin();
group != groups->end(); ++group)
{
Partition * p = new Partition();
for (QList<Partition *>::Iterator part = (*group)->begin();
part != (*group)->end(); ++part)
{
(*part)->new_partition = p;
for (QMap<int, QList<CommEvent *> *>::Iterator proc
= (*part)->events->begin();
proc != (*part)->events->end(); ++proc)
{
for (QList<CommEvent *>::Iterator evt
= (proc.value())->begin();
evt != (proc.value())->end(); ++evt)
{
(*evt)->partition = p;
p->addEvent(*evt);
}
}
}
p->new_partition = p;
//newparts->append(p);
}
// Add in the partitions in order -- those that didn't get changed
// just added in normally. Add the first instance of the others so
// that order can be maintained and delete the ones that represent
// changes.
QSet<Partition *> sortSet = QSet<Partition *>();
QList<Partition *> toDelete = QList<Partition *>();
for (QList<Partition *>::Iterator part = trace->partitions->begin();
part != trace->partitions->end(); ++part)
{
if ((*part)->new_partition == *part)
{
newparts->append(*part);
}
else
{
if (!sortSet.contains((*part)->new_partition))
{
newparts->append((*part)->new_partition);
sortSet.insert((*part)->new_partition);
}
toDelete.append(*part);
}
}
// Delete old parts
for (QList<Partition *>::Iterator oldpart = toDelete.begin();
oldpart != toDelete.end(); ++oldpart)
{
delete *oldpart;
*oldpart = NULL;
}
// Add the new partitions to trace->partitions
delete trace->partitions;
trace->partitions = newparts;
}