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


C++ HASH_FIND_INT函数代码示例

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


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

示例1: HASH_FIND_INT

inline js_type_class_t *js_get_type_from_native(T* native_obj) {
    js_type_class_t *typeProxy;
    long typeId = cocos2d::getHashCodeByString(typeid(*native_obj).name());
    HASH_FIND_INT(_js_global_type_ht, &typeId, typeProxy);
    if (!typeProxy) {
        cocos2d::TypeInfo *typeInfo = dynamic_cast<cocos2d::TypeInfo *>(native_obj);
        if (typeInfo) {
            typeId = typeInfo->getClassTypeInfo();
        } else {
            typeId = cocos2d::getHashCodeByString(typeid(T).name());
        }
        HASH_FIND_INT(_js_global_type_ht, &typeId, typeProxy);
    }
    return typeProxy;
}
开发者ID:Seif178,项目名称:pairjs,代码行数:15,代码来源:cocos2d_specifics.hpp

示例2: HASH_FIND_INT

page_node *add_page(stored_object *object, uint32_t page_id)
{
    page_node *curr,*page;

    HASH_FIND_INT(global_page_table,&page_id,page);
    if(page)
    {
        printf("ERROR[add_page] Object %lu already contains page %d\n",page->object_id,page_id);
        return NULL;
    }

    object->size += PAGE_SIZE;
    if(object->pages == NULL)
    {
        page = allocate_new_page(object->id,page_id);
        HASH_ADD_INT(global_page_table, page_id, page); 
        object->pages = page;
        return object->pages;
    }
    for(curr=page=object->pages; page && page->page_id != page_id; curr=page,page=page->next)
        ;
    if(page)
    {
        printf("ERROR[add_page] Object %lu already contains page %d\n",page->object_id,page_id);
        return NULL;
    }

    page = allocate_new_page(object->id,page_id);
    HASH_ADD_INT(global_page_table, page_id, page); 
    curr->next = page;
    return curr->next;
}
开发者ID:bkreitch,项目名称:simulator,代码行数:32,代码来源:ftl_obj_strategy.c

示例3: HASH_FIND_INT

void CCActionManager::removeAllActionsFromTarget(CAObject *pTarget)
{
    // explicit null handling
    if (pTarget == NULL)
    {
        return;
    }

    tHashElement *pElement = NULL;
    HASH_FIND_INT(m_pTargets, &pTarget, pElement);
    if (pElement)
    {
        if (ccArrayContainsObject(pElement->actions, pElement->currentAction) && (! pElement->currentActionSalvaged))
        {
            pElement->currentAction->retain();
            pElement->currentActionSalvaged = true;
        }

        ccArrayRemoveAllObjects(pElement->actions);
        if (m_pCurrentTarget == pElement)
        {
            m_bCurrentTargetSalvaged = true;
        }
        else
        {
            deleteHashElement(pElement);
        }
    }
    else
    {
//        CCLOG("CrossApp: removeAllActionsFromTarget: Target not found");
    }
}
开发者ID:AojiaoZero,项目名称:CrossApp,代码行数:33,代码来源:CCActionManager.cpp

示例4: HASH_FIND_INT

struct mystruct *find_key(off_t st_size)
{
	struct mystruct *s;

	HASH_FIND_INT(myfiles, &st_size, s);
	return s;
}
开发者ID:EmisFR,项目名称:burp,代码行数:7,代码来源:bedup.c

示例5: farray_create

/**
 * Return an array of prototypes labeled with cluster numbers
 * @param c cluster structure
 * @param a assignment of prototypes
 * @param p prototypes
 * @return rejected feature vectors
 */
farray_t *cluster_get_prototypes(cluster_t *c, assign_t *a, farray_t *p)
{
    int i;
    farray_t *n = farray_create("prototypes");
    count_t *hash = NULL, *entry;

    for (i = 0; i < a->len; i++) {
        /* Skip rejected clusters */
        if (!c->cluster[i])
            continue;

        /* Check if prototype has been added */
        int j = a->proto[i];
        HASH_FIND_INT(hash, &j, entry);
        if (entry)
            continue;

        /* Add new prototype */
        entry = malloc(sizeof(count_t));
        entry->label = j;
        HASH_ADD_INT(hash, label, entry);

        /* Add prototype */
        farray_add(n, fvec_clone(p->x[j]), cluster_get_name(c, i));
    }

    /* Delete hash table */
    while (hash) {
        entry = hash;
        HASH_DEL(hash, entry);
        free(entry);
    }

    return n;
}
开发者ID:JaonLin,项目名称:malheur,代码行数:42,代码来源:cluster.c

示例6: erl_element

ETERM *space_delete(ETERM *fromp, ETERM *argp) {

    // get the args
    ETERM *space_refp = erl_element(1, argp);

    erlmunk_space *s;
    int space_id = ERL_REF_NUMBER(space_refp);
    HASH_FIND_INT(erlmunk_spaces, &space_id, s);

    // remove all subscribers
    for(erlmunk_subscriber *subscriber = s->subscribers; subscriber != NULL;
        subscriber = subscriber->hh.next) {
        space_remove_subscriber(s, subscriber);
    }
    // remove all bodies
    for(erlmunk_body *b = s->bodies; b != NULL;
        b = b->hh.next) {
        erlmunk_body_data *data = cpBodyGetUserData(b->body);
        if (data->term != NULL)
            erl_free_compound(data->term);
        free(data);

        cpSpaceRemoveBody(s->space, b->body);
        cpBodyDestroy(b->body);
        cpBodyFree(b->body);
        space_remove_body_hash(s, b);
    }

    return NULL;
}
开发者ID:lrascao,项目名称:erlmunk,代码行数:30,代码来源:erlmunk_space.c

示例7: consolidate_gpos_single

bool consolidate_gpos_single(otfcc_Font *font, table_OTL *table, otl_Subtable *_subtable,
                             const otfcc_Options *options) {
	subtable_gpos_single *subtable = &(_subtable->gpos_single);
	gpos_single_hash *h = NULL;
	for (glyphid_t k = 0; k < subtable->length; k++) {
		if (!GlyphOrder.consolidateHandle(font->glyph_order, &subtable->items[k].target)) {
			logWarning("[Consolidate] Ignored missing glyph /%s.\n", subtable->items[k].target.name);
			continue;
		}
		gpos_single_hash *s;
		int fromid = subtable->items[k].target.index;
		HASH_FIND_INT(h, &fromid, s);
		if (s) {
			logWarning("[Consolidate] Detected glyph double-mapping about /%s.\n", subtable->items[k].target.name);
		} else {
			NEW(s);
			s->fromid = subtable->items[k].target.index;
			s->fromname = sdsdup(subtable->items[k].target.name);
			s->v = subtable->items[k].value;
			HASH_ADD_INT(h, fromid, s);
		}
	}

	HASH_SORT(h, gpos_by_from_id);
	iSubtable_gpos_single.clear(subtable);

	gpos_single_hash *s, *tmp;
	HASH_ITER(hh, h, s, tmp) {
		iSubtable_gpos_single.push(subtable,
		                           ((otl_GposSingleEntry){
		                               .target = Handle.fromConsolidated(s->fromid, s->fromname), .value = s->v,
		                           }));
开发者ID:anthrotype,项目名称:otfcc,代码行数:32,代码来源:gpos-single.c

示例8: del_giga_fi

void del_giga_fi(int fd)
{
    giga_file_info_t *info;
    HASH_FIND_INT(_open_files, &fd, info);
    if(info != NULL)
        HASH_DEL(_open_files, info);
}
开发者ID:linpawslitap,项目名称:mds_scaling,代码行数:7,代码来源:libclient.c

示例9: HASH_FIND_INT

struct fl_url_filter *find_filter(int url_id) 
{
    struct fl_url_filter *s;

    HASH_FIND_INT(filters, &url_id, s);  /* s: output pointer */
    return s;
}
开发者ID:sanyaade-g2g-repos,项目名称:fineline-computer-forensics-timeline-tools,代码行数:7,代码来源:flfiltermap.c

示例10: allocate_file_descriptor_table

struct file_descriptor_table * allocate_file_descriptor_table(int pid) {
	struct file_descriptor_table * result_table;

	HASH_FIND_INT(file_descriptor_tables, &pid, result_table);
    
    if (result_table == NULL) {
    	int i;

    	struct file_descriptor_table * table = (struct file_descriptor_table *) malloc(sizeof(struct file_descriptor_table));
    	table->pid = pid;

    	table->entries = (struct file_descriptor_entry *) malloc(8 * sizeof(struct file_descriptor_entry));
    	table->total_descriptors = 8;
    	table->used_descriptors = 3;

    	table->entries[0].fd = 0;
    	table->entries[1].fd = 1;
    	table->entries[2].fd = 2;

    	for (i = 3; i < table->total_descriptors; i++) {
    		table->entries[i].fd = FD_NOT_USED;
    	}
    	
    	HASH_ADD_INT(file_descriptor_tables, pid, table);
    	return table;
    }
    return NULL;
}
开发者ID:gitanuj,项目名称:fstr,代码行数:28,代码来源:syscalls2.c

示例11: sec_exists_entry

bool sec_exists_entry(uint32_t secid) {
  struct secentry *se=NULL;
  HASH_FIND_INT(hash, &secid, se);
  if(!se)
    return false;
  return true;
}
开发者ID:CamFlow,项目名称:camflow-provenance-lib,代码行数:7,代码来源:libprovenance.c

示例12: adtn_socket_base

static int adtn_socket_base(const char *data_path)
{
	static int UID = 1;
	int sock_id = -1;
	int len;
	bunsock_s *identifier;

	++UID;
	HASH_FIND_INT( sockStore, &sock_id, identifier);
	if (identifier == NULL) {
		sock_id = UID;
		identifier = (bunsock_s *)calloc(1, sizeof(bunsock_s));
		identifier->id = sock_id;
		identifier->sopt.proc_flags = H_DESS | H_NOTF;
		identifier->sopt.block_flags = B_DEL_NP;
		identifier->sopt.lifetime = 100000; //this time is in seconds
		len = strlen(data_path) + 1;
		identifier->data_path = (char *)calloc(len, sizeof(char));
		strncpy(identifier->data_path, data_path, len);
		identifier->bdata = NULL;

		HASH_ADD_INT( sockStore, id, identifier);
	} else {
		errno = EBUSY;
	}

	return sock_id;
}
开发者ID:SeNDA-UAB,项目名称:aDTN-platform,代码行数:28,代码来源:adtn.c

示例13: adtn_setcodopt_base

int adtn_setcodopt_base(int fd, code_type_e option, const char *code, int from_file, int replace)
{
	int ret = -1;
	bunsock_s *identifier;

	HASH_FIND_INT(sockStore, &fd, identifier);
	if (!identifier) {
		errno = ENOTSOCK;
		goto end;
	}
	if (code == NULL || strcmp(code, "") == 0 || from_file < 0 || from_file > 1) {
		errno = EINVAL;
		goto end;
	}
	switch (option) {
	case ROUTING_CODE:
		if (identifier->opt.rcode) {
			if (replace) {
				free(identifier->opt.rcode);
			} else {
				errno = EOPNOTSUPP;
				goto end;
			}
		}
		identifier->opt.rcode = strdup(code);
		identifier->opt.r_fromfile = from_file;
		break;
	case LIFE_CODE:
		if (identifier->opt.lcode) {
			if (replace) {
				free(identifier->opt.lcode);
			} else {
				errno = EOPNOTSUPP;
				goto end;
			}
		}
		identifier->opt.lcode = strdup(code);
		identifier->opt.l_fromfile = from_file;
		break;
	case PRIO_CODE:
		if (identifier->opt.pcode) {
			if (replace) {
				free(identifier->opt.pcode);
			} else {
				errno = EOPNOTSUPP;
				goto end;
			}
		}
		identifier->opt.pcode = strdup(code);
		identifier->opt.p_fromfile = from_file;
		break;
	default:
		errno = EINVAL;
		goto end;
	}
	ret = 0;
end:

	return ret;
}
开发者ID:SeNDA-UAB,项目名称:aDTN-platform,代码行数:60,代码来源:adtn.c

示例14: swDataBuffer_clear

int swDataBuffer_clear(swDataBuffer *data_buffer, int fd)
{
	swDataBuffer_item *item = NULL;
	HASH_FIND_INT(data_buffer->ht, &fd, item);
	if (item == NULL)
	{
		swTrace("buffer item not found\n");
		return SW_ERR;
	}
	else
	{
		swDataBuffer_trunk *trunk = item->first;
		swDataBuffer_trunk *will_free_trunk; //保存trunk的指针,用于释放内存
		while (trunk != NULL)
		{
			sw_free(trunk->data);
			will_free_trunk = trunk;
			trunk = trunk->next;
			sw_free(will_free_trunk);
		}
		HASH_DEL(data_buffer->ht, item);
		sw_free(item);
	}
	return SW_OK;
}
开发者ID:899,项目名称:swoole,代码行数:25,代码来源:buffer.c

示例15: assert

CCAction* CCActionManager::getActionByTag(int tag, NSObject *pTarget)
{
	assert(tag != kCCActionTagInvalid);

	tHashElement *pElement = NULL;
	HASH_FIND_INT(m_pTargets, &pTarget, pElement);

	if (pElement)
	{
		if (pElement->actions != NULL)
		{
			unsigned int limit = pElement->actions->num;
			for (unsigned int i = 0; i < limit; ++i)
			{
				CCAction *pAction = (CCAction*)pElement->actions->arr[i];

				if (pAction->getTag() == tag)
				{
					return pAction;
				}
			}
		}
		CCLOG("cocos2d : getActionByTag: Action not found");
	}
	else
	{
        CCLOG("cocos2d : getActionByTag: Target not found");
	}

	return NULL;
}
开发者ID:charlesa101,项目名称:cocos2d-x,代码行数:31,代码来源:CCActionManager.cpp


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