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

C++ HASH_FIND_INT函数代码示例

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

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



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


示例16: h3m_object_add_by_def

int h3m_object_add_by_def(h3mlib_ctx_t ctx, const char *def, int x, int y,
    int z, int *od_index)
{
    struct META_OA_HASH_ENTRY *oa_hash_entry = NULL;
    int oa_index = 0;
    int oa_body_index = 0;

    // Currently oa_body_index is used as key in the
    // oa hash... The current code is a bit unoptimal as if this function
    // ends up calling h3m_add_oa_by_def below, an additional
    // hash lookup for this hash inside that function will be performed.
    if (NULL == h3m_get_def_body(def, &oa_body_index)) {
        return 1;
    }
    // if oa for this object has not yet been added to map, add it,
    // otherwise use the existing oa_index for the oa
    HASH_FIND_INT(ctx->meta.oa_hash, &oa_body_index, oa_hash_entry);
    if (NULL == oa_hash_entry) {
        h3m_add_oa_by_def(ctx, def, &oa_index);
    } else {
        oa_index = oa_hash_entry->oa_index;
    }

    return h3m_add_od(ctx, oa_index, x, y, z, od_index);
}
开发者ID:Dergash,项目名称:homm3tools,代码行数:25,代码来源:h3mlib.c


示例17: read_memory_16

// Read a value from an 16-bit area of memory
uint16_t read_memory_16(gb_mem16_t* hash, int addr)
{
	gb_mem16_t *s;
		
	HASH_FIND_INT(hash, &addr, s);
	return s->value;
}
开发者ID:jamie124,项目名称:gbemulator,代码行数:8,代码来源:memory.c


示例18: CCASSERT

void ActionManager::addAction(Action *pAction, Node *target, bool paused)
{
    CCASSERT(pAction != NULL, "");
    CCASSERT(target != NULL, "");

    tHashElement *pElement = NULL;
    // we should convert it to Object*, because we save it as Object*
    Object *tmp = target;
    HASH_FIND_INT(_targets, &tmp, pElement);
    if (! pElement)
    {
        pElement = (tHashElement*)calloc(sizeof(*pElement), 1);
        pElement->paused = paused;
        target->retain();
        pElement->target = target;
        HASH_ADD_INT(_targets, target, pElement);
    }

     actionAllocWithHashElement(pElement);
 
     CCASSERT(! ccArrayContainsObject(pElement->actions, pAction), "");
     ccArrayAppendObject(pElement->actions, pAction);
 
     pAction->startWithTarget(target);
}
开发者ID:KIngpon,项目名称:HXGame,代码行数:25,代码来源:CCActionManager.cpp


示例19: js_cocos2dx_GLNode_constructor

JSBool js_cocos2dx_GLNode_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
    
  if (argc == 0) {
    GLNode* cobj = new GLNode();
#ifdef COCOS2D_JAVASCRIPT
    cocos2d::Object *_ccobj = dynamic_cast<cocos2d::Object *>(cobj);
    if (_ccobj) {
      _ccobj->autorelease();
    }
#endif
    TypeTest<GLNode> t;
    js_type_class_t *typeClass;
    uint32_t typeId = t.s_id();
    HASH_FIND_INT(_js_global_type_ht, &typeId, typeClass);
    assert(typeClass);
    JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
    JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
    // link the native object with the javascript object
    js_proxy_t *p = jsb_new_proxy(cobj, obj);
#ifdef COCOS2D_JAVASCRIPT
    JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::GLNode");
#endif
    return JS_TRUE;
  }
  JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 0);
  return JS_FALSE;
}
开发者ID:0x0c,项目名称:cocos2d-x,代码行数:28,代码来源:js_bindings_opengl.cpp


示例20: HASH_FIND_INT

tEffectElement* SoundDataManager::getSoundData(int nSoundID)
{
    tEffectElement* pElement = NULL;
    HASH_FIND_INT(m_pEffects, &nSoundID, pElement);

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



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ HASH_FIND_PTR函数代码示例发布时间:2022-05-30
下一篇:
C++ HASH_FIND函数代码示例发布时间: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