当前位置: 首页>>代码示例>>C++>>正文


C++ LeafNode类代码示例

本文整理汇总了C++中LeafNode的典型用法代码示例。如果您正苦于以下问题:C++ LeafNode类的具体用法?C++ LeafNode怎么用?C++ LeafNode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了LeafNode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: _GetLeafNode

// GoToNext
status_t
ItemIterator::GoToNext(Item *item)
{
//PRINT(("ItemIterator::GoToNext()\n"));
	LeafNode *node = NULL;
	status_t error = _GetLeafNode(&node);
	if (error == B_OK) {
//PRINT(("  leaf node: %Ld\n", node->GetNumber()));
		// get the leaf node on which the next item resides
		int32 newIndex = fIndex + 1;
		while (error == B_OK && newIndex >= node->CountItems()) {
			error = fTreeIterator.GoToNextLeaf(&node);
			newIndex = 0;
		}
		// got the node, get the item
		if (error == B_OK) {
//PRINT(("  leaf node now: %Ld\n", node->GetNumber()));
			fIndex = newIndex;
//PRINT(("  index now: %ld\n", fIndex));
			if (item)
				error = item->SetTo(node, fIndex);
		}
	}
//PRINT(("ItemIterator::GoToNext() done: %s\n", strerror(error)));
	return error;
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:27,代码来源:Iterators.cpp

示例2: PRECONDITION

void InnerNode::add( Sortable *obj, int index )
{
    // this is called only from Btree::add()
    PRECONDITION( index >= 1 );
    LeafNode* ln = getTree(index-1)->lastLeafNode();
    ln->add( obj, ln->last+1 );
}
开发者ID:WiLLStenico,项目名称:TestesEOutrasBrincadeiras,代码行数:7,代码来源:btreeinn.cpp

示例3: Build

void Snapshoot::Build(const Database& db, const std::string& dir)
{
	const std::vector<Node*>& nodes = db.GetNodes();
	for (int i = 0, n = nodes.size();  i < n; ++i)
	{
		Node* node = nodes[i];
		if (node->Type() != NODE_LEAF) {
			continue;
		}

		LeafNode* leaf = static_cast<LeafNode*>(node);
		const std::string& path = leaf->GetPath();

		std::string out_path = dir + "\\" + path;
		out_path = out_path.substr(0, out_path.find_last_of("."));
		out_path += "_ss.png";

		std::string dir = gum::FilepathHelper::Dir(out_path);
		if (!wxDir::Exists(dir)) {
			wxFileName::Mkdir(dir, wxS_DIR_DEFAULT, wxPATH_MKDIR_FULL);
		}

		s2::DrawRT rt;
		std::string ori_path = db.GetDirPath() + "\\" + path;
		auto sym = ee::SymbolMgr::Instance()->FetchSymbol(ori_path);
		rt.Draw(*sym);

		sm::vec2 sz = sym->GetBounding().Size();
		rt.StoreToFile(out_path, sz.x, sz.y);
	}
}
开发者ID:xzrunner,项目名称:easyeditor,代码行数:31,代码来源:Snapshoot.cpp

示例4: begin

BPlusTreeIterator* BPlusTree::begin() {
	BPlusTreeIterator* iterator = NULL;
	LeafNode* leaf = static_cast <LeafNode*> (hidratateNode(firstLeaf));
	if (leaf) {
		iterator = new BPlusTreeIterator(leaf->clone(), 0, fileBlockManager);
		freeNodeMemory(leaf);
	}
	return iterator;
}
开发者ID:busiris2014,项目名称:7506Condor1C2014,代码行数:9,代码来源:BPlusTree.cpp

示例5: unlock

void LeafNode::merge(Slice anchor)
{
    if (balancing_) {
        unlock();
        return;
    }
    balancing_ = true;
    assert(records_.size() == 0);
    // release the write lock
    unlock();

    // acquire write locks from root to leaf
    vector<DataNode*> path;
    tree_->lock_path(anchor, path);
    assert(path.back() == this);

    // may have insertions during this period
    if (records_.size() > 0) {
        while (path.size()) {
            path.back()->unlock();
            path.back()->dec_ref();
            path.pop_back();
        }
        return;
    }
    
    if (left_sibling_ >= NID_LEAF_START) {
        LeafNode *ll = (LeafNode*)tree_->load_node(left_sibling_, false);
        assert(ll);
        ll->write_lock();
        ll->right_sibling_ = right_sibling_;
        ll->set_dirty(true);
        ll->unlock();
        ll->dec_ref();
    }
    if (right_sibling_ >= NID_LEAF_START) {
        LeafNode *rl = (LeafNode*)tree_->load_node(right_sibling_, false);
        assert(rl);
        rl->write_lock();
        rl->left_sibling_ = left_sibling_;
        rl->set_dirty(true);
        rl->unlock();
        rl->dec_ref();
    }
    dead_ = true;
    balancing_ = false;

    path.pop_back();
    unlock();
    dec_ref();

    // propagation
    InnerNode *parent = (InnerNode*) path.back();
    assert(parent);
    parent->rm_pivot(nid_, path);
}
开发者ID:jameswei,项目名称:cascadb,代码行数:56,代码来源:node.cpp

示例6: switch

template<typename PointT, typename LeafContainerT, typename BranchContainerT> void
pcl::octree::OctreePointCloudVoxelCentroid<PointT, LeafContainerT, BranchContainerT>::getVoxelCentroidsRecursive (
    const BranchNode* branch_arg, OctreeKey& key_arg,
    typename OctreePointCloud<PointT, LeafContainerT, BranchContainerT>::AlignedPointTVector &voxel_centroid_list_arg) const
{
  // child iterator
  unsigned char child_idx;

  // iterate over all children
  for (child_idx = 0; child_idx < 8; child_idx++)
  {
    // if child exist
    if (branch_arg->hasChild (child_idx))
    {
      // add current branch voxel to key
      key_arg.pushBranch (child_idx);

      OctreeNode *child_node = branch_arg->getChildPtr (child_idx);

      switch (child_node->getNodeType ())
      {
        case BRANCH_NODE:
        {
          // recursively proceed with indexed child branch
          getVoxelCentroidsRecursive (static_cast<const BranchNode*> (child_node), key_arg, voxel_centroid_list_arg);
          break;
        }
        case LEAF_NODE:
        {
          PointT new_centroid;

          LeafNode* container = static_cast<LeafNode*> (child_node);

          container->getContainer().getCentroid (new_centroid);

          voxel_centroid_list_arg.push_back (new_centroid);
          break;
        }
        default:
          break;
       }

      // pop current branch voxel from key
      key_arg.popBranch ();
    }
  }
}
开发者ID:BITVoyager,项目名称:pcl,代码行数:47,代码来源:octree_pointcloud_voxelcentroid.hpp

示例7: createLeafNode

Node* BPlusTree::hidratateNode(int numeroDeNodo) {

	ByteString byteStr = this->fileBlockManager->readBlock(numeroDeNodo);
	if (byteStr.isEmpty()) {
		return NULL;
	} else {
		int nivel = byteStr.readAsInt(0);
		if (nivel == 0) {
			LeafNode *nuevoNodoHoja = createLeafNode();
			nuevoNodoHoja->Hidratate(byteStr);
			nuevoNodoHoja->number = numeroDeNodo;
			return nuevoNodoHoja;
		} else {
			InnerNode *nuevoNodoInterior = createInnerNode(nivel);
			nuevoNodoInterior->Hidratate(byteStr);
			nuevoNodoInterior->number = numeroDeNodo;
			return nuevoNodoInterior;
		}
	}
}
开发者ID:busiris2014,项目名称:7506Condor1C2014,代码行数:20,代码来源:BPlusTree.cpp

示例8: while

const char* BomKeyNode::printRef(MapNode *pNode) {
    BomItem *tmp;
    LeafNode *lf;
    tmp = mHead;
    while(tmp != NULL) {
        if(AcontainsB(tmp->node, pNode) == 1) {
            //printf("REF: %c%d%02d\n", tmp->refChar, mMajor, tmp->idNum);
            if(pNode->nodeType() == 1) {
                lf = (LeafNode*)pNode;
                sprintf(mTmpRef,"%c%d%02d-%s ", tmp->refChar, mMajor, tmp->idNum,lf->value());
            } else {
                sprintf(mTmpRef, "%c%d%02d-? ", tmp->refChar, mMajor, tmp->idNum);
            }
            return mTmpRef;
        }
        tmp = tmp->next;
    }
    strcpy(mTmpRef, "NODE_NOT_FOUND");
    return mTmpRef;
}
开发者ID:vxmdesign,项目名称:gvxm,代码行数:20,代码来源:BomKeyNode.cpp

示例9: createLeafNode

Node* ClassifBPlusTree::hidratateNode(int nodeNumber)
{
	int block = fileBlockNodeMapper->getBlock(nodeNumber);
	ByteString byteStr = this->fileBlockManager->readBlock(block);
	if (byteStr.isEmpty()) {
		return NULL;
	} else {
		int nivel = byteStr.readAsInt(0);
		if (nivel == 0) {
			LeafNode *nuevoNodoHoja = createLeafNode();
			nuevoNodoHoja->Hidratate(byteStr);
			nuevoNodoHoja->number = nodeNumber;
			return nuevoNodoHoja;
		} else {
			InnerNode *nuevoNodoInterior = createInnerNode(nivel);
			nuevoNodoInterior->Hidratate(byteStr);
			nuevoNodoInterior->number = nodeNumber;
			return nuevoNodoInterior;
		}
	}
}
开发者ID:busiris2014,项目名称:7506Condor1C2014,代码行数:21,代码来源:ClassifBPlusTree.cpp

示例10: processNode

  virtual void processNode(LeafNode &u) // DO NOT CHANGE THIS FUNCTION
  {
    int id=u.getID();
    Symbol a=A.getIthTrack(id)[column];
    Array2D<double>::RowIn2DArray<double> row=L[id];
    if(gapSymbols.isMember(a))
      for(Symbol i=0 ; i<numAlpha; ++i)
	row[i]=0; //=log(1); missing data -- same as Seipel & Haussler
    else
      for(Symbol i=0 ; i<numAlpha; ++i) 
	row[i]=(i==a ? 0 : NEGATIVE_INFINITY);
  }
开发者ID:bmajoros,项目名称:PhyLib,代码行数:12,代码来源:RCO_Felsenstein.C

示例11: processNode

  virtual void processNode(LeafNode &u)
  {
    int id=u.getID();
    Symbol a=alphabetMap(A.getIthTrack(id)[column]);
    Array2D<double>::RowIn2DArray<double> row=L[id];
    if(a==gap)
      for(Symbol i=0 ; i<numAlpha; ++i)
	row[i]=log1;// missing data -- same as Seipel & Haussler
    else
      for(Symbol i=0 ; i<numAlpha; ++i) 
	row[i]=(i==a ? log1 : log0);
  }
开发者ID:bmajoros,项目名称:alignment,代码行数:12,代码来源:ProfileFelsenstein.C

示例12: LeafNode

LeafNode* LeafNode::split(int value)
{
  int last, i;
  if (value > values[count - 1])
    last = value;
  else
  {
    last = values[count - 1];
    for (i = count - 2; i >= 0 && values[i] > value; i--)
      values[i + 1] = values[i];
    values[i + 1] = value;
  }

  LeafNode *newNode = new LeafNode(leafSize, parent, this, rightSibling);

  if(rightSibling)
    rightSibling->setLeftSibling(newNode);
  rightSibling = newNode;
  for (i = (leafSize + 1) / 2; i < leafSize; i++)
    newNode->insert(values[i]);
  count = (leafSize + 1 ) / 2;
  newNode->insert(last);
  return newNode;
} // split()
开发者ID:adamsx97,项目名称:Practice-and-Work,代码行数:24,代码来源:LeafNode.cpp

示例13: while

pair<Record*, BPlusTreeIterator*> BPlusTree::search(Key k) {
	Node *aNode = root;
	if (!aNode)
		return pair<Record*, BPlusTreeIterator*> (NULL, NULL);

	while (!aNode->isLeaf()) {
		InnerNode *innerNode = static_cast<InnerNode*> (aNode);
		int position = getPosition(innerNode, k);
		aNode = hidratateNode(innerNode->sons[position]);
		if (innerNode != root)
			freeNodeMemory(innerNode);
	}
	LeafNode *leafNode = static_cast<LeafNode*> (aNode);
	Record* record = NULL;
	BPlusTreeIterator* iterator = NULL;
	int pos = getPosition(leafNode, k);
	if (pos < leafNode->keyMount && equalKey(k, leafNode->keys[pos])) {
		record = new Record(leafNode->keys[pos].Clone(), new ByteString(leafNode->byteData[pos]));
		iterator = new BPlusTreeIterator(leafNode->clone(), pos, fileBlockManager);
	}
	if (leafNode != root)
		freeNodeMemory(leafNode);
	return pair<Record*, BPlusTreeIterator*> (record, iterator);
}
开发者ID:busiris2014,项目名称:7506Condor1C2014,代码行数:24,代码来源:BPlusTree.cpp

示例14: processNode

  virtual void processNode(LeafNode &u) {
    int id=u.getID();
    Array2D<double>::RowIn2DArray<double> row=L[id];
    Sequence &track=A.getIthTrack(id).getSeq();
    Sequence leafNmer, nmer;
    track.getSubsequence(firstCol,numCols,leafNmer);
    if(MultSeqAlignment::rightmostGapPos(leafNmer,gapSymbols)>=0)
      for(int i=0 ; i<numNmers ; ++i) {
	nmer.fromInt(i,numCols,alphabetMap);
	row[i]=
	  degenerateDnaMatch(nmer,leafNmer,gapSymbols) ? 0 :
	  NEGATIVE_INFINITY;
      }
    else {
      row.setAllTo(NEGATIVE_INFINITY);
      int index=leafNmer.asInt(alphabetMap);
      row[index]=0;
    }
  }
开发者ID:bmajoros,项目名称:PhyLib,代码行数:19,代码来源:ACO_Felsenstein.C

示例15: LeafNode

void LeafNode::splitNode(FatherNode* parentNode, int childIndex) {
	LeafNode* newNode = new LeafNode();
	setKeyNum(MIN_LEAF);
	newNode->setKeyNum(MIN_LEAF + 1);
	newNode->setRightSibling(getRightSibling());
	setRightSibling(newNode);
	newNode->setLeftSibling(this);
	int i;
	for (i = 0; i < MIN_LEAF + 1; ++i) {
		newNode->setKeyValue(i, m_KeyValues[i + MIN_LEAF]);
	}
	for (i = 0; i < MIN_LEAF + 1; ++i) {
		newNode->setData(i, m_Datas[i + MIN_LEAF]);
	}
	((InternalNode*)parentNode)->insert(childIndex, childIndex + 1, m_KeyValues[MIN_LEAF], newNode);
}
开发者ID:hfr1992,项目名称:FUWA_DBMS,代码行数:16,代码来源:BPlusNode.cpp


注:本文中的LeafNode类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。