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


C++ dtinsert函数代码示例

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


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

示例1: vmfree

vertex_t *createvertex (xy_t xy) {
    vertex_t *vmemp, *vp;

    vmemp = vp = NULL;
    if (!(vmemp = vmalloc (vvm, sizeof (vertex_t))))
        goto abortcreatevertex;
    vmemp->xy = xy;
    if (!(vp = dtinsert (vertexdict, vmemp)))
        goto abortcreatevertex;
    if (vp != vmemp) {
        vmfree (vvm, vmemp);
        return vp;
    }
    if (!(vp->edgeps = vmalloc (Vmheap, 4 * sizeof (edge_t *))))
        goto abortcreatevertex;
    vp->edgepn = 4;
    vp->edgepl = 0;
    return vp;

abortcreatevertex:
    SUwarning (
        1, "createvertex", "create failed for vertex (%d,%d)", xy.x, xy.y
    );
    if (vp) {
        if (vp == vmemp)
            dtdelete (vertexdict, vp);
        if (vp->edgeps)
            vmfree (Vmheap, vp->edgeps);
    }
    if (vmemp)
        vmfree (vvm, vmemp);
    return NULL;
}
开发者ID:TidyHuang,项目名称:vizgems,代码行数:33,代码来源:tigerrecords.c

示例2: vmapAdd

static void vmapAdd(Dt_t * map, int i, int j)
{
    Ipair obj;
    obj.i = i;
    obj.j = j;
    dtinsert(map, &obj);
}
开发者ID:DaniHaag,项目名称:jsPlumb_Liviz.js,代码行数:7,代码来源:multispline.c

示例3: insertEdge

/* insertEdge:
 */
static void insertEdge(Dt_t * map, void *t, void *h, edge_t * e)
{
    item dummy;

    dummy.p[0] = t;
    dummy.p[1] = h;
    dummy.t = e->tail;
    dummy.h = e->head;
    dtinsert(map, &dummy);

    dummy.p[0] = h;
    dummy.p[1] = t;
    dummy.t = e->head;
    dummy.h = e->tail;
    dtinsert(map, &dummy);
}
开发者ID:Goettsch,项目名称:game-editor,代码行数:18,代码来源:utils.c

示例4: constrainX

/* constrainX:
 * Create the X constrains and solve. We use a linear objective function
 * (absolute values rather than squares), so we can reuse network simplex.
 * The constraints are encoded as a dag with edges having a minimum length.
 */
static void constrainX(graph_t* g, nitem* nlist, int nnodes, intersectfn ifn,
                       int ortho)
{
    Dt_t *list = dtopen(&constr, Dtobag);
    nitem *p = nlist;
    graph_t *cg;
    int i;

    for (i = 0; i < nnodes; i++) {
	p->val = p->pos.x;
	dtinsert(list, p);
	p++;
    }
    if (ortho)
	cg = mkConstraintG(g, list, ifn, distX);
    else
	cg = mkNConstraintG(g, list, ifn, distX);
    rank(cg, 2, INT_MAX);

    p = nlist;
    for (i = 0; i < nnodes; i++) {
	int newpos, oldpos, delta;
	oldpos = p->pos.x;
	newpos = ND_rank(p->cnode);
	delta = newpos - oldpos;
	p->pos.x = newpos;
	p->bb.LL.x += delta;
	p->bb.UR.x += delta;
	p++;
    }

    closeGraph(cg);
    dtclose(list);
}
开发者ID:emdenrg,项目名称:graphviz,代码行数:39,代码来源:constraint.c

示例5: update

static void update(Dict_t * Q, Agnode_t * dest, Agnode_t * src, double len)
{
    double newlen = getdist(src) + len;
    double oldlen = getdist(dest);

    if (oldlen == 0) {		/* first time to see dest */
	setdist(dest, newlen);
	if (doPath) setprev(dest, src);
	dtinsert(Q, dest);
    } else if (newlen < oldlen) {
	dtdelete(Q, dest);
	setdist(dest, newlen);
	if (doPath) setprev(dest, src);
	dtinsert(Q, dest);
    }
}
开发者ID:joewalnes,项目名称:graphviz2,代码行数:16,代码来源:dijkstra.c

示例6: add_edge

void add_edge(edgelist * list, Agedge_t * e)
{
    edgelistitem temp;

    temp.edge = e;
    dtinsert(list, &temp);
}
开发者ID:DaniHaag,项目名称:jsPlumb_Liviz.js,代码行数:7,代码来源:edgelist.c

示例7: push

void push(queue * nq, void *n)
{
    nsitem obj;

    obj.np = n;
    dtinsert(nq, &obj);
}
开发者ID:ellert,项目名称:graphviz,代码行数:7,代码来源:queue.c

示例8: insertEdge

/* insertEdge:
 */
static void insertEdge(Dt_t * map, void *t, void *h, edge_t * e)
{
    item dummy;

    dummy.p[0] = t;
    dummy.p[1] = h;
    dummy.t = agtail(e);
    dummy.h = aghead(e);
    dtinsert(map, &dummy);

    dummy.p[0] = h;
    dummy.p[1] = t;
    dummy.t = aghead(e);
    dummy.h = agtail(e);
    dtinsert(map, &dummy);
}
开发者ID:jho1965us,项目名称:graphviz,代码行数:18,代码来源:utils.c

示例9: storeline

static void storeline(GVC_t *gvc, textlabel_t *lp, char *line, char terminator)
{
    pointf size;
    textspan_t *span;
    static textfont_t tf;
    int oldsz = lp->u.txt.nspans + 1;

    lp->u.txt.span = ZALLOC(oldsz + 1, lp->u.txt.span, textspan_t, oldsz);
    span = &(lp->u.txt.span[lp->u.txt.nspans]);
    span->str = line;
    span->just = terminator;
    if (line && line[0]) {
	tf.name = lp->fontname;
	tf.size = lp->fontsize;
	span->font = dtinsert(gvc->textfont_dt, &tf);
        size = textspan_size(gvc, span);
    }
    else {
	size.x = 0.0;
	span->size.y = size.y = (int)(lp->fontsize * LINESPACING);
    }

    lp->u.txt.nspans++;
    /* width = max line width */
    lp->dimen.x = MAX(lp->dimen.x, size.x);
    /* accumulate height */
    lp->dimen.y += size.y;
}
开发者ID:IsCoolEntertainment,项目名称:debpkg_graphviz,代码行数:28,代码来源:labels.c

示例10: insertNodeset

/* insertNodeset:
 * Add a node into the nodeset.
 */
void insertNodeset(nodeset_t * ns, Agnode_t * n)
{
    nsitem_t key;

    key.np = n;
    dtinsert(ns, &key);
}
开发者ID:Chaduke,项目名称:bah.mod,代码行数:10,代码来源:nodeset.c

示例11: addPS

void addPS(PointSet * ps, int x, int y)
{
    point pt;

    pt.x = x;
    pt.y = y;
    dtinsert(ps, mkPair(pt));
}
开发者ID:CharlieSa,项目名称:livizjs,代码行数:8,代码来源:pointset.c

示例12: addIntSet

void 
addIntSet (Dt_t* is, int v)
{
    intitem obj;

    obj.id = v;
    dtinsert(is, &obj);
}
开发者ID:AhmedAMohamed,项目名称:graphviz,代码行数:8,代码来源:intset.c

示例13: ptdelete

int
ptdelete(Pt_t* tab, Ptaddr_t min, Ptaddr_t max)
{
	register Ptprefix_t*	xp;
	Ptprefix_t		key;
	Ptprefix_t		cur;

	tab->entries++;
	key.min = min;
	key.max = max;
	if (xp = (Ptprefix_t*)dtsearch(tab->dict, &key))
	{
		do
		{
			cur.min = xp->min;
			cur.max = xp->max;
			dtdelete(tab->dict, xp);
			if (key.min > cur.min)
			{
				max = cur.max;
				cur.max = key.min - 1;
				if (!dtinsert(tab->dict, &cur))
					goto bad;
				if (key.max < max)
				{
					cur.min = key.max + 1;
					cur.max = max;
					if (!dtinsert(tab->dict, &cur))
						goto bad;
					break;
				}
			}
			else if (key.max < xp->max)
			{
				xp->min = key.max + 1;
				if (!dtinsert(tab->dict, xp))
					goto bad;
			}
		} while (xp = (Ptprefix_t*)dtnext(tab->dict, xp));
	}
	return 0;
 bad:
	if (tab->disc->errorf)
		(*tab->disc->errorf)(NiL, tab->disc, ERROR_SYSTEM|2, "out of space");
	return -1;
}
开发者ID:ISLEcode,项目名称:kornshell,代码行数:46,代码来源:ptopen.c

示例14: insertPS

void insertPS(PointSet * ps, point pt)
{
    pair *pp;

    pp = mkPair(pt);
    if (dtinsert(ps, pp) != pp)
        free(pp);
}
开发者ID:BestSean2016,项目名称:graphviz,代码行数:8,代码来源:pointset.c

示例15: insertDeglist

/* insertDeglist:
 * Add a node to the node list.
 * Nodes are kept sorted by DEGREE, smallest degrees first.
 */
void insertDeglist(deglist_t * ns, Agnode_t * n)
{
    degitem key;
    degitem *kp;

    key.deg = DEGREE(n);
    kp = dtinsert(ns, &key);
    ND_next(n) = kp->np;
    kp->np = n;
}
开发者ID:TidyHuang,项目名称:vizgems,代码行数:14,代码来源:deglist.c


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