• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ leaf函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: leaf

 forceinline void 
 OmegaTree<TaskView>::insert(int i) {
   leaf(i).e = tasks[i].e(); 
   leaf(i).env = 
     static_cast<long long int>(c)*tasks[i].est()+tasks[i].e();
   update(i);
 }
开发者ID:Wushaowei001,项目名称:crossbow,代码行数:7,代码来源:tree.hpp


示例2: connections

    [[nodiscard]] std::set<pt> connections() const {
        std::set<ptpair> S;
        std::set<pt>     P;

        for (size_t i = 0; i < size.x; ++i) {
            for (size_t j = 0; j < size.y; ++j) {
                for (int xx = 1; xx < 100; ++xx) {
                    double            x  = .01 * xx;
                    std::pair<pt, pt> pp = leaf(pt(i, j, x, 0), nullptr);

                    if ((pp.first != pt()) && (pp.second != pt())) {
                        if (S.count(pp) == 0) {
                            S.insert(pp);
                            P.insert(pt(i, j, x, 0));
                        }
                    }

                    pp = leaf(pt(i, j, 0, x), nullptr);

                    if ((pp.first != pt()) && (pp.second != pt())) {
                        if (S.count(pp) == 0) {
                            S.insert(pp);
                            P.insert(pt(i, j, 0, x));
                        }
                    }
                }
            }
        }
        return P;
    }
开发者ID:vbeffara,项目名称:Simulations,代码行数:30,代码来源:Square.cpp


示例3: leaf

void leaf(turtle_t &turt, double length)
{
  double factor,i;
  
factor=length/10;
 if(factor<=0.005)
   return;
 else{
  
   for(i=2.0;i<=4.2;i=i+0.2){
turt.forward(factor);
turt.turn_right(45);
leaf(turt,4.2*factor/i);
turt.forward(4.8*factor/i);
turt.backward_move(4.8*factor/i);
turt.turn_left(45);
turt.forward(factor/6);
turt.turn_left(45);
leaf(turt,4.2*factor/i);
turt.forward(4.8*factor/i);
turt.backward_move(4.8*factor/i);

turt.turn_right(45.15);

   }
turt.forward(factor/8);
turt.backward_move(length+3*factor);


}
     
     
}
开发者ID:stanlyjohn2,项目名称:toylogo,代码行数:33,代码来源:render_drawing.cpp


示例4: c

 OmegaTree<TaskView>::OmegaTree(Region& r, int c0,
                                const TaskViewArray<TaskView>& t)
   : TaskTree<TaskView,OmegaNode>(r,t), c(c0) {
   for (int i=tasks.size(); i--; ) {
     leaf(i).e = 0; leaf(i).env = -Limits::llinfinity;
   }
   init();
 }
开发者ID:Wushaowei001,项目名称:crossbow,代码行数:8,代码来源:tree.hpp


示例5: leaf

int leaf(Tnode *r)
{
	if(r==NULL)
		return 0;
	else if(r->lchild==NULL&&r->rchild==NULL)
		return 1;
	else
		return leaf(r->lchild)+leaf(r->rchild);
}
开发者ID:cqiyi,项目名称:kaoshi,代码行数:9,代码来源:e26.cpp


示例6: assignBMEWeights

void assignBMEWeights(meTree *T, double **A)
{
  meEdge *e;
  e = depthFirstTraverse(T,NULL);
  while (NULL != e) {
    if ((leaf(e->head)) || (leaf(e->tail)))
      BalWFext(e,A);
    else
      BalWFint(e,A);
    e = depthFirstTraverse(T,e);
  }
}      
开发者ID:jackgopack4,项目名称:pico-blast,代码行数:12,代码来源:bme.cpp


示例7: leaf

int  leaf(BinTree T)
{
    int n1,n2;
    if(!T) return 0;
    else if((!T->lchild) &&  (!T->rchild))return 1;
    else
    {
        n1=leaf(T->lchild);
        n2=leaf(T->rchild);
        return(n1+n2);
    }
}
开发者ID:xhbang,项目名称:data_structure,代码行数:12,代码来源:bitree_basic.c


示例8: leaf

int leaf(node *r)
{
	if(!r)
		return 0;
	else
	{
		if( NULL == r->lChild &&
			NULL == r->rChild )
			return 1;
		else
			return leaf(r->rChild) + leaf(r->lChild);
	}
}
开发者ID:cqiyi,项目名称:kaoshi,代码行数:13,代码来源:___数据结构_e5.cpp


示例9: leaf

bool leaf(struct node *root,int le,int *lef)
{
    if(root==NULL)return true;
    if(root->left==NULL &&root->right==NULL)
    {
        if(*lef==0)
        {
            *lef=le;
            return true;
        }
        return(*lef==le);
    }
    return leaf(root->left,le+1,lef)&&
    leaf(root->right,le+1,lef);
}
开发者ID:mkhanw01,项目名称:DataStructure,代码行数:15,代码来源:chek_leaf_same_level.cpp


示例10: assert

 forceinline void 
 OmegaLambdaTree<TaskView>::shift(int i) {
   // i is in omega
   assert(leaf(i).env > -Limits::llinfinity);
   leaf(i).le = leaf(i).e;
   leaf(i).e = 0;
   leaf(i).lenv = leaf(i).env;
   leaf(i).env = -Limits::llinfinity;
   leaf(i).resLe = i;
   leaf(i).resLenv = i;
   update(i);
 }
开发者ID:Wushaowei001,项目名称:crossbow,代码行数:12,代码来源:tree.hpp


示例11: traverse

/*
 * traverse the whole tree in a deletion-safe way, calling node_before at
 * nodes, leaf at leaves, and node_after when back at nodes, passing data along
 * the way through nodes. data returned by leaf() is ignored.
 *
 * Hooks can modify the pointer they're given to remove or replace themselves.
 */
static void
traverse(topo_topology_t topology,
	 topo_obj_t *father,
	 void (*node_before)(topo_topology_t topology, topo_obj_t *obj, void *),
	 void (*leaf)(topo_topology_t topology, topo_obj_t *obj, void *),
	 void (*node_after)(topo_topology_t topology, topo_obj_t *obj, void *),
	 void *data)
{
  topo_obj_t *pobj, obj;

  if (!(*father)->first_child) {
    if (leaf)
      leaf(topology, father, data);
    return;
  }
  if (node_before)
    node_before(topology, father, data);
  if (!(*father))
    return;
  for (pobj = &(*father)->first_child, obj = *pobj;
       obj;
       /* Check whether the current obj was dropped.  */
       (*pobj == obj ? pobj = &(*pobj)->next_sibling : 0),
       /* Get pointer to next object.  */
	obj = *pobj)
    traverse(topology, pobj, node_before, leaf, node_after, data);
  if (node_after)
    node_after(topology, father, data);
}
开发者ID:BlueBrain,项目名称:FlowVR,代码行数:36,代码来源:topology.c


示例12: return

/*assumes tree is only trifurcated at root*/
tree *detrifurcate(tree *T)
{
  node *v, *w;
  edge *e, *f;
  v = T->root;
  if(leaf(v))
    return(T);
  if (NULL != v->parentEdge)
    {
      Rprintf ("Error: root %s is poorly rooted.\n",v->label);
      exit(0);
    }
  for(e = v->middleEdge, v->middleEdge = NULL; NULL != e; e = f )
    {
      w = e->head;
      v = e->tail;
      e->tail = w;
      e->head = v;
      f = w->leftEdge;
      v->parentEdge = e;
      w->leftEdge = e;
      w->parentEdge = NULL;
    }
  T->root = w;
  return(T);
}
开发者ID:rforge,项目名称:phyloc,代码行数:27,代码来源:me.c


示例13: if

void CPatcherWindow::UpdatePatcherStatus()
{
	m_patchProgress.SetRange(0, m_patchPaths.size());

	if(m_patchResult != PATCHER_SERVICE_RESULT_SUCCESS)
	{
		m_patchStatusLabel.SetText(_T("Patch failed."));
		m_patchProgress.SetPosition(m_patchPaths.size());
		m_patchProgress.SetState(PBST_ERROR);
	}
	else if(m_patchIdx == m_patchPaths.size())
	{
		//Complete
		m_patchStatusLabel.SetText(_T("Complete!"));
		m_patchProgressLabel.SetText(_T("100%"));
		m_patchProgress.SetPosition(m_patchIdx);
	}
	else
	{
		auto nextPatchPath = m_patchPaths[m_patchIdx];
		unsigned int patchPercent = static_cast<unsigned int>(static_cast<float>(m_patchIdx) / static_cast<float>(m_patchPaths.size()) * 100.f);
		m_patchProgress.SetPosition(m_patchIdx);
		m_patchStatusLabel.SetText(string_format(_T("Applying '%s'..."), nextPatchPath.leaf().native().c_str()).c_str());
		m_patchProgressLabel.SetText(string_format(_T("%d%%"), patchPercent).c_str());
	}
}
开发者ID:Allowed,项目名称:SeventhUmbral,代码行数:26,代码来源:PatcherWindow.cpp


示例14: post

static Tree *
post(Lex *lxp)
{
	Tree *lp;

	if ((lp = leaf(lxp)) == 0)
		return 0;
	switch (lxp->tok)
	{
	case ROP_EMPTY:	/* this was {0,0} ROP_BRACE */
		libuxre_regdeltree(lp, 1);
		lp = 0;
		/*FALLTHROUGH*/
	case ROP_BRACE:
	case ROP_STAR:
	case ROP_PLUS:
	case ROP_QUEST:
		if ((lp = libuxre_reg1tree(lxp->tok, lp)) == 0)
		{
			lxp->err = REG_ESPACE;
			return 0;
		}
		if (lxp->tok == ROP_BRACE)
			lp->right.info = lxp->info;
		/*FALLTHROUGH*/
	case ROP_NOP:	/* this was {1,1} ROP_BRACE */
		if (lex(lxp) != 0)
		{
			libuxre_regdeltree(lp, 1);
			return 0;
		}
		break;
	}
	return lp;
}
开发者ID:JamesLinus,项目名称:LiteBSD-Ports,代码行数:35,代码来源:regparse.c


示例15: root

// Converts a SyntaxNode tree to a Moses::GHKM::ParseTree.
std::auto_ptr<ParseTree> XmlTreeParser::ConvertTree(
    const SyntaxNode &tree,
    const std::vector<std::string> &words)
{
  std::auto_ptr<ParseTree> root(new ParseTree(tree.GetLabel()));
  const std::vector<SyntaxNode*> &children = tree.GetChildren();
  if (children.empty()) {
    if (tree.GetStart() != tree.GetEnd()) {
      std::ostringstream msg;
      msg << "leaf node covers multiple words (" << tree.GetStart()
          << "-" << tree.GetEnd() << "): this is currently unsupported";
      throw Exception(msg.str());
    }
    std::auto_ptr<ParseTree> leaf(new ParseTree(words[tree.GetStart()]));
    leaf->SetParent(root.get());
    root->AddChild(leaf.release());
  } else {
    for (std::vector<SyntaxNode*>::const_iterator p = children.begin();
         p != children.end(); ++p) {
      assert(*p);
      std::auto_ptr<ParseTree> child = ConvertTree(**p, words);
      child->SetParent(root.get());
      root->AddChild(child.release());
    }
  }
  return root;
}
开发者ID:braunefe,项目名称:minSpanMoses,代码行数:28,代码来源:XmlTreeParser.cpp


示例16: NewickPrintTreeStr

void NewickPrintTreeStr(tree *T, char *str)
{
  if (leaf(T->root))
    NewickPrintBinaryTree(T,str);
  else
    NewickPrintTrinaryTree(T,str);
}
开发者ID:rforge,项目名称:phyloc,代码行数:7,代码来源:newick.c


示例17: leaf

status_t
WinampSkinThemesAddon::SPSkin(BString *to, bool preffile)
{
	if (preffile) {
		status_t err;
		BMessage settings;
		BPath SPSPath;
		
		if (find_directory(B_USER_SETTINGS_DIRECTORY, &SPSPath) < B_OK)
			return B_ERROR;
		BString leaf(SP_SETTINGS_NAME);
		BString user(getenv("USER"));
		user.RemoveFirst("USER=");
		leaf.IReplaceFirst("$USER", user.String());
		SPSPath.Append(leaf.String());
		PRINT(("SPP %s\n", SPSPath.Path()));
		BFile SPSettings(SPSPath.Path(), B_READ_ONLY);
		if (SPSettings.InitCheck() < B_OK)
			return SPSettings.InitCheck();
		if (settings.Unflatten(&SPSettings) < B_OK)
			return EIO;
		err = settings.FindString("skinname", to);
		StripPath(to);
		return err;
	}
	BMessenger msgr(SP_APP_SIG);
	BMessage msg('skin');
	BMessage reply;
	msgr.SendMessage(&msg, (BHandler *)NULL, 500000);
	if (reply.FindString("result", to) >= B_OK) {
		StripPath(to);
		return B_OK;
	}
	return B_ERROR;
}
开发者ID:luciang,项目名称:haiku,代码行数:35,代码来源:WinampSkinAddon.cpp


示例18: leaf

std::auto_ptr<cpunit::TestRunner>
cpunit::TestExecutionFacade::get_test_runner(const bool robust, const double max_time) const {
  std::auto_ptr<TestRunner> leaf(new BasicTestRunner);

  if (robust) {
    CPUNIT_ITRACE("TestExecutionFacade::get_test_runner - Returning robust TestRunner");

    // For handling of extra, custom exceptions, insert your handler here,
    // and remember to modify the next decorator insertion...
    // std::auto_ptr<TestRunnerDecorator> d1(new MyCustomHandler);
    // d1->set_inner(leaf.release());

    // Add a layer of exception handling over the executing test runner
    std::auto_ptr<TestRunnerDecorator> d2(new RunAllTestRunner);
    d2->set_inner(leaf.release());

    // Add a layer of time taking
    std::auto_ptr<TestRunnerDecorator> d3(new TimeGuardRunner(max_time));
    d3->set_inner(d2.release());

    // Add a new layer of exception handling in case the max-time is exceeded
    std::auto_ptr<TestRunnerDecorator> d4(new RunAllTestRunner);
    d4->set_inner(d3.release());

    return std::auto_ptr<TestRunner>(d4.release());
  } else {
    CPUNIT_ITRACE("TestExecutionFacade::get_test_runner - Returning BasicTestRunner");

    // Add a layer of time taking over the executing test runner
    std::auto_ptr<TestRunnerDecorator> d1(new TimeGuardRunner(max_time));
    d1->set_inner(leaf.release());

    return std::auto_ptr<TestRunner>(d1.release());
  }
}
开发者ID:offa,项目名称:CPUnit,代码行数:35,代码来源:cpunit_TestExecutionFacade.cpp


示例19: get_available_agent_specs

	std::vector< std::pair< prm::qualified_path, std::string > > get_available_agent_specs(prm::param_accessor param_vals)
	{
		std::vector< std::pair< prm::qualified_path, std::string > > names;

		auto node = param_vals["agent_spec_list"];
		auto agent_spec_list_path = resolve_id("agent_spec_list", param_vals.get_root(), param_vals.get_current_path(), param_vals.get_all_paths());
		for(auto agent_entry : node)
		{
			auto agent_repeat_num = agent_entry.first.as< unsigned int >();
			auto agent = agent_entry.second;

			auto rel_path = prm::qualified_path({ "spec" }) + std::string{ "name" };
			auto name_node = prm::find_value(agent, rel_path);
			assert(name_node);

			auto spec_path = agent_spec_list_path;
			spec_path.leaf().set_index(agent_repeat_num);
			spec_path += std::string("spec");

			names.emplace_back(std::make_pair(
				spec_path,
				name_node.as< std::string >()
				));
		}

		return names;
	}
开发者ID:kamrann,项目名称:workbase,代码行数:27,代码来源:rtp_phys_agent_body.cpp


示例20: node_qpath

	bool param_tree::add_repeat_instance(tree_t::node_descriptor rpt_node, param_accessor acc, schema::schema_provider_map_handle sch_mp)
	{
		auto nd_attribs = m_tree[rpt_node];
		if(nd_attribs.type != ParamType::Repeat)
		{
			return false;
		}

		// TODO: respect repeat max count
		auto inst_num = 0;
		bool first = m_tree.child_count(rpt_node) == 0;
		if(!first)
		{
			// Get the edge of the rightmost existing instance
			auto edge = m_tree.in_edge(m_tree.get_rightmost_child(rpt_node).first).first;
			// And add 1 to its instance number to generate the instance number of the new instance
			// Note: This assumes that instances cannot be repositioned once created.
			inst_num = *m_tree[edge].repeat_idx + 1;
		}
		auto instance = m_tree.add_node(rpt_node).second;
		m_tree[m_tree.in_edge(instance).first].repeat_idx = inst_num;

		auto path = node_qpath(rpt_node);
		path.leaf().set_index(inst_num);
		auto contents_name = boost::any_cast<repeat_extra>(m_tree[rpt_node].extra).contents_name;
		path += contents_name;

		//acc.set_lock_on_failed_move(true);
		acc.move_to(path);
		auto sch = sch_mp->at(path.unindexed())(acc);
		generate_from_schema(sch, instance, acc, sch_mp);
		return true;
	}
开发者ID:kamrann,项目名称:workbase,代码行数:33,代码来源:param_tree.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ lean_assert函数代码示例发布时间:2022-05-30
下一篇:
C++ ldap_value_free函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap