本文整理汇总了C++中Partition::add方法的典型用法代码示例。如果您正苦于以下问题:C++ Partition::add方法的具体用法?C++ Partition::add怎么用?C++ Partition::add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Partition
的用法示例。
在下文中一共展示了Partition::add方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addBarrel
void GPartitionPolicy::addBarrel(MergeBarrelEntry* pEntry)
{
Partition* pPartition = NULL;
int32_t nPartition = getPartition(curPartitionSize_);
map<int32_t,Partition*>::iterator iter = partitionMap_.find(nPartition);
if (iter != partitionMap_.end())
{
pPartition = iter->second;
pPartition->nPartitionSize_ += curPartitionSize_;///update partition size
pPartition->add(pEntry);
if ((int32_t)pPartition->pBarrelQueue_->size() >= 2) ///collision,trigger a merge event
{
triggerMerge(pPartition,nPartition);
}
}
else
{
pPartition = new Partition(nPartition,curPartitionSize_,2*MAX_TRIGGERS);
pPartition->add(pEntry);
partitionMap_.insert(make_pair(nPartition,pPartition));
}
}
示例2: begin
// starts the first fit algorithm
void FirstFit::begin()
{
// for every job search every partition
std::list<Job>::iterator iterator;
for (iterator = jobs.begin(); iterator != jobs.end(); ++iterator) {
Job tempJ = *iterator;
std::list<Partition>::iterator iterator2;
for (iterator2 = parts.begin(); iterator2 != parts.end(); ++iterator2) {
Partition tempP = *iterator2;
// if the partition is not busy, it fits, and the job is not already running,
// assign the job to the partition
if(!tempP.isBusy() && tempJ.getSize() <= tempP.getSize() && !tempJ.isRunning()){
tempP.add(tempJ);
tempJ.setRunning(tempP.getPartNum());
}
*iterator2 = tempP;
}
*iterator = tempJ;
}
}