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


C++ Dlist类代码示例

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


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

示例1: percents

Dlist percents(const Dlist& L, double n) {
	Dlist Dl;
	for (int i=0; i<L.size(); i++) {
		Dl.push_back(percent(L[i],n));
	}
	return Dl;
}
开发者ID:angelajburden,项目名称:fiberassign,代码行数:7,代码来源:misc.cpp

示例2: CalcDiffForSet

// Action_Diffusion::CalcDiffForSet()
void Action_Diffusion::CalcDiffForSet(unsigned int& set, Dlist const& Sets, int Ndim,
                                      std::string const& label) const
{
  for (Dlist::const_iterator ds = Sets.begin(); ds != Sets.end(); ds++)
    if (*ds != 0)
      CalcDiffusionConst(set, *ds, Ndim, label + "_" + integerToString( (*ds)->Meta().Idx() ));
}
开发者ID:Amber-MD,项目名称:cpptraj,代码行数:8,代码来源:Action_Diffusion.cpp

示例3: El_collapse_compare_chain

/*
 *	Note, to_branch is included in the collapse!!
 */
void El_collapse_compare_chain(Hyperblock *hb, Dlist< Pair<Op*, Op*> > &cpr_block,
				Op *target_branch, Op *to_branch)
{
    Pair<Op*,Op*> cur_pair;
    Op *target_cmpp, *to_cmpp, *cur_branch, *cur_cmpp;
    Operand incoming_pred, br_pred, ft_pred;
    bool flag, last_br;

    target_cmpp = to_cmpp = NULL;
    for (Dlist_iterator<Pair<Op*, Op*> > dl_i(cpr_block); dl_i!=0; dl_i++) {
	cur_pair = *dl_i;
	cur_branch = cur_pair.first;
	cur_cmpp = cur_pair.second;
	if (cur_branch == target_branch)
	    target_cmpp = cur_cmpp;
	if (cur_branch == to_branch)
	    to_cmpp = cur_cmpp;
    }
    
    /* Figure out the value of incoming predicate */
    if (to_cmpp != NULL)
	incoming_pred = to_cmpp->src(PRED1);
    else {
	Pred_lit* new_pred_lit = new Pred_lit(true);
        Operand pred_true(new_pred_lit);
	incoming_pred = pred_true;
    }

    /* Create the collapsed pred and initialize it */
    El_create_collapsed_predicates(br_pred, ft_pred);
    El_insert_initializer_for_collapsed_predicate(hb, br_pred, ft_pred,
							incoming_pred, to_cmpp);

    /* Walk the chain in reverse order, insert collapsed cmpp ops */
    flag = false;
    for (Dlist_iterator<Pair<Op*, Op*> > dl_i2(cpr_block, true); dl_i2!=0; dl_i2--) {
	cur_pair = *dl_i2;
	cur_branch = cur_pair.first;
        cur_cmpp = cur_pair.second;
	last_br = false;
	if (cur_branch == target_branch) {
	    flag = true;
	    last_br = true;
	}
	if (flag == false)
	    continue;
	El_insert_collapsed_cmpp_op(hb, cur_cmpp, br_pred, ft_pred, incoming_pred,
					last_br);
	if (cur_branch == to_branch)
	    break;
    }

    El_reassociate_branch_pred(target_branch, br_pred);
    if (target_cmpp != NULL) {
        El_reassociate_input_operand(hb, target_cmpp->dest(DEST1), br_pred);
        El_reassociate_input_operand(hb, target_cmpp->dest(DEST2), ft_pred);
    }
    hb_br_preds.push_tail(br_pred);
    hb_ft_preds.push_tail(ft_pred);
}
开发者ID:yuyantingzero,项目名称:SharedFolder,代码行数:63,代码来源:el_cmp_reduce.cpp

示例4: cumulate

Dlist cumulate(const Dlist& L) {
	Dlist l = initDlist(L.size());
	double a = 0;
	for (int i=0; i<L.size(); i++) {
		a += L[i];
		l[i] = a;
	}
	return l;
}
开发者ID:angelajburden,项目名称:fiberassign,代码行数:9,代码来源:misc.cpp

示例5: main

main()
{
  string s;
  Dlist l;
  Dnode *d;

  while (getline(cin, s)) l.Push_Front(s);
  for (d = l.Begin(); d != l.End(); d = d->flink) cout << d->s << endl;
}
开发者ID:sanluyene,项目名称:cs140,代码行数:9,代码来源:dlistrev-3.cpp

示例6: mult

Dtable mult(const Dtable& T, double d) {
	Dtable t;
	for (int i=0; i<T.size(); i++) {
		Dlist l;
		for (int j=0; j<T[i].size(); j++) {
			l.push_back(T[i][j]*d);
		}
		t.push_back(l);
	}
	return t;
}
开发者ID:angelajburden,项目名称:fiberassign,代码行数:11,代码来源:misc.cpp

示例7: ddivide_floor

Dtable ddivide_floor(const Table& T, double d) {
	Dtable t;
	for (int i=0; i<T.size(); i++) {
		Dlist l;
		for (int j=0; j<T[i].size(); j++) {
			l.push_back(floor(T[i][j]/d));
		}
		t.push_back(l);
	}
	return t;
}
开发者ID:angelajburden,项目名称:fiberassign,代码行数:11,代码来源:misc.cpp

示例8: tabular_result_output

void tabular_result_output(const Dlist<string>& words,int cols) {
  cout<<"<table>\n<tr>\n";

  int rowpos=0;
  for(int i=0;i<words.size();i++) {
    cout<<"<td>"<<words[i]<<"</td>\n";    
    if(!(++rowpos%cols) && (i+1 != words.size())) cout<<"</tr>\n<tr>\n";
  }

  cout<<"</tr>\n</table>\n";
}
开发者ID:TheProjecter,项目名称:untangler-cgi,代码行数:11,代码来源:driver.cpp

示例9: get_permut_sort

List get_permut_sort(const List& l) {
	List perm = initList(l.size());
	Dlist lp = var(l);
	Dlist L = lp;
	std::sort(L.begin(), L.end());  
	for (int i=0; i<L.size(); i++) {
		int pos = isfound_pos(L[i],lp);
		if (pos==-1) printf("Error in get_permut_sort\n");
		else perm[i] = pos;
	}
	return perm;
}
开发者ID:angelajburden,项目名称:fiberassign,代码行数:12,代码来源:misc.cpp

示例10: histogram

Dlist histogram(const Dplist& L, double interval) {
	Dlist hist; int l = L.size();
	for(int i=0; i<l; i++) {
		double a = L[i].f;
		if (a!=-1) {
			if (a<0) { printf("Error in print_hist, neg\n"); fl(); }
			int n = floor(a/interval);
			if (n>=hist.size()) { hist.resize(n+1); hist[n] = 0;}
			hist[n] += L[i].s;
		}
	}
	return hist;
}
开发者ID:angelajburden,项目名称:fiberassign,代码行数:13,代码来源:misc.cpp

示例11: main

int main ()
{
  Dlist<int> mylist;
  Dlist<int>::node_type *it1;
  Dlist<int>::node_type *it2;

  // set some values:
  for (int i=1; i<10; ++i) mylist.insert_tail(new Dlist<int>::node_type(i*10));

                              // 10 20 30 40 50 60 70 80 90
  it1 = it2 = mylist.head();  // ^^
  for (int i = 0; i < 6; i++)
	it2 = dlist_next(it2);    // ^                 ^
  it1 = dlist_next(it1);      //    ^              ^

  it1 = mylist.erase(it1);    // 10 30 40 50 60 70 80 90
                              //    ^           ^

  it2 = mylist.erase(it2);    // 10 30 40 50 60 80 90
                              //    ^           ^

  it1 = dlist_next(it1);      //       ^        ^
  it2 = dlist_prev(it2);      //       ^     ^

  mylist.erase(it1,
		  dlist_prev(it2));   // 10 30 60 80 90
                              //        ^

  std::cout << "mylist contains:";
  for (it1=mylist.head(); it1!=mylist.nil(); it1 = dlist_next(it1))
    std::cout << ' ' << it1->key;
  std::cout << '\n';

  return 0;
}
开发者ID:hechenyu,项目名称:cpp_code,代码行数:35,代码来源:list21.cpp

示例12: El_record_maxreduce_info_in_attr

void El_record_maxreduce_info_in_attr(Hyperblock *hb)
{
    Control_cpr_info *attr;
    int size, i;
    Operand br_pred, ft_pred;
    Hash_set<Operand> cpr_preds(hash_operand), derived_on_preds(hash_operand), derived_off_preds(hash_operand);

    if (dbg(cpr, 3))
	cdbg << "Enter El_record_maxreduce_info_in_attr: " << hb->id() << endl;
    attr = get_control_cpr_info(hb);
    if (attr != NULL)
        El_punt("El_record_maxreduce_info_in_attr: HB %d already has an attr",
			hb->id());

    size = hb_br_preds.size();
    attr = new Control_cpr_info(size);

    // Compute set of all preds used for cpr, cpr_preds
    for (Dlist_iterator<Operand> dl_i(hb_br_preds); dl_i!=0; dl_i++) {
	cpr_preds += (*dl_i);
    }
    for (Dlist_iterator<Operand> dl_i2(hb_ft_preds); dl_i2!=0; dl_i2++) {
	cpr_preds += (*dl_i2);
    }

    for (i=0; i<size; i++) {
	br_pred = hb_br_preds.pop();
	ft_pred = hb_ft_preds.pop();
	if (dbg(cpr, 3))
	    cdbg << "i " << i << " on_trace_pred " << ft_pred
                 << " off_trace_pred " << br_pred << endl;
	attr->set_on_trace_pred(i, ft_pred);
	attr->set_off_trace_pred(i, br_pred);
	El_compute_maxreduce_derived_preds(hb, ft_pred, br_pred, cpr_preds,
						derived_on_preds, derived_off_preds);
	if (derived_on_preds.size() > 0)
	    attr->set_derived_on_trace_pred(i, derived_on_preds);
	if (derived_off_preds.size() > 0)
	    attr->set_derived_off_trace_pred(i, derived_off_preds);
    }

    set_control_cpr_info(hb, attr);
}
开发者ID:yuyantingzero,项目名称:SharedFolder,代码行数:43,代码来源:el_cmp_reduce.cpp

示例13: main

int main()
{
	Dlist stack;
	char name[120];
	char food[120];
	bool eating = true;
	bool grass = false;

	cout << "Hi, what is your doggie's name \n";
	cin.getline(name, 119);
	while (eating)
	{
		// eat
		while (!grass)
		{
			cout << "What does " << name << " eat? \n";
			cin.getline(food, 119);
			if (!strcmp(food, "grass"))
			{
				cout << "Oh, no, it looks like " << name <<" is getting sick! Ick...\n";
				break;
			}
			else if (!strcmp(food, "dog food"))
			{
				eating = false;
				break;
			}
			stack.insertBack(food);
		}
		// barf
		while (!stack.empty() && eating)
		{
			cout << name << " barfs up " << stack.removeBack() << endl;
			if (stack.empty())
				cout << "It looks like " << name << " is feeling better now...\n";
		}
	}
	cout << "Ugh! " << name << " is insulted and walks away in a huff!!!\n";
	
    system("Pause");
	return 0;
}
开发者ID:TomasOchoa,项目名称:CSCI-216-Project6-DogieProgram-DoublyLinkedList,代码行数:42,代码来源:main.cpp

示例14: El_max_reduce_cpr_blocks

void El_max_reduce_cpr_blocks(Hyperblock *hb, Cont_cpr_match_result &match_result)
{
    Dlist<Dlist< Pair<Op*, Op*> > > hb_cprblocks;
    Dlist< Pair<Op*, Op*> > cur_cprblock;
    Pair<Op*, Op*> cur_tuple;
    Op *first_branch, *cur_branch, *cur_cmpp;

    hb_cprblocks = match_result.cpr_blk_list;

    if (hb_cprblocks.size() == 0) {
        if (dbg(cpr, 2))
            cdbg << "HB " << hb->id() << " has no cpr blocks" << endl;
        return;
    }

    hb_br_preds.clear();
    hb_ft_preds.clear();

    for (Dlist_iterator<Dlist< Pair<Op*, Op*> > > d_iter(hb_cprblocks);
			d_iter!=0; d_iter++) {
	cur_cprblock = *d_iter;
	El_normalize_cprblock(cur_cprblock);

	first_branch = NULL;
	for (Dlist_iterator<Pair<Op*, Op*> > d2_iter(cur_cprblock);
			d2_iter!=0; d2_iter++) {
	    cur_tuple = *d2_iter;
	    cur_branch = cur_tuple.first;
	    cur_cmpp = cur_tuple.second;
	    if (first_branch == NULL) {
		first_branch = cur_branch;
		hb_br_preds.push_tail(cur_cmpp->dest(DEST1));
		hb_ft_preds.push_tail(cur_cmpp->dest(DEST2));
		continue;
	    }
	    El_collapse_compare_chain(hb, cur_cprblock, cur_branch, first_branch);
	}
    }

    El_record_maxreduce_info_in_attr(hb);
}
开发者ID:yuyantingzero,项目名称:SharedFolder,代码行数:41,代码来源:el_cmp_reduce.cpp

示例15: DLISTdestroy

void DLISTdestroy(Dlist list)
{
  void *data;

  while (DLISTsize(list) > 0)
    {
      if (DLISTremove(list, DLISTtail(list), (void **)&data) == 0 && 
          list->destroy != NULL)
        {
          list->destroy(data);
        }
    }
  
  free(list);
}
开发者ID:AsamQi,项目名称:levawc,代码行数:15,代码来源:dlist.c


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