本文整理汇总了C++中NodeType::load方法的典型用法代码示例。如果您正苦于以下问题:C++ NodeType::load方法的具体用法?C++ NodeType::load怎么用?C++ NodeType::load使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NodeType
的用法示例。
在下文中一共展示了NodeType::load方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getNodeByMemAddr
/*!
*Load bucket of specific disk address into memory.
**/
nodePtr getNodeByMemAddr(uint32_t& memAddr, uint64_t diskAddr)
{
if (diskAddr%2==1)
return nodePtr();
if (memAddr>=count_ && memAddr!=(uint32_t)-1&&count_!=0)
return nodePtr();
if (memAddr!=(uint32_t)-1)
{
NodeType* t = nodes[memAddr].pNode_;
if (t->getDiskAddr()==diskAddr)
{
return nodePtr(nodes[memAddr], memAddr);
}
}
uint32_t i = findInCache(diskAddr);
if (i != (uint32_t)-1)
{
memAddr = i;
return nodePtr(nodes[i], memAddr);
}
if (count_<CACHE_SIZE)
{
NodeType* t = new NodeType(f_);
t->load(diskAddr);
nodes[count_] = _cache_node_(t);
memAddr = count_;
count_++;
return nodePtr(nodes[memAddr], memAddr);
}
//cout<< "getNodeByMemAddr()\n";
memAddr = findSwitchOut();
//cout<<"\nswitch out-: "<<memAddr<<endl;
kickOutNodes(memAddr);
NodeType* t = new NodeType(f_);
t->load(diskAddr);
nodes[memAddr] = _cache_node_(t);
return nodePtr(nodes[memAddr], memAddr);
}
示例2: load_
void load_(vector<uint32_t>& indexes)
{
uint32_t idx = indexes.front();
indexes.erase(indexes.begin());
NodeType* n = nodes[idx].pNode_ ;
nodes[idx] = _cache_node_(n);
for (uint32_t i=0; i<n->getSize(); i++)
{
if (n->getDiskAddr(i)==(uint64_t)-1)
continue;
if (n->getDiskAddr(i)%2==0)
continue;
NodeType* t = new NodeType(f_);
t->load(n->getDiskAddr(i));
nodes[count_] = _cache_node_(t);
indexes.push_back(count_);
n->setMemAddr(i, count_);
count_++;
if (count_>=CACHE_SIZE)
{
indexes.clear();
return;
}
}
}
示例3: newNode
/*!
*Get a new node in cache which is stroed in position 'diskAddr'.
**/
nodePtr newNode(uint64_t diskAddr)
{
if (count_<CACHE_SIZE)
{
NodeType* t = new NodeType(f_);
t->load(diskAddr);
nodes[count_] = _cache_node_(t);
nodePtr p(nodes[count_]);
count_++;
return p;
}
uint32_t ret = findSwitchOut();
kickOutNodes(ret);
NodeType* t = new NodeType(f_);
t->load(diskAddr);
nodes[ret] = _cache_node_(t);
nodePtr p(nodes[ret]);
return p;
}
示例4: load
/**
*Load data from disk.
**/
uint32_t load()
{
vector<uint32_t> indexes;
indexes.push_back(0);
NodeType* t = new NodeType(f_);
t->load(rootAddr_);
nodes[count_] = _cache_node_(t);
count_++;
while (indexes.size()>0)
{
load_(indexes);
}
return count_;
}