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

C++ Hash_Fetch函数代码示例

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

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



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

示例1: DocVec_Term_Vector_IMP

TermVector*
DocVec_Term_Vector_IMP(DocVector *self, String *field,
                       String *term_text) {
    DocVectorIVARS *const ivars = DocVec_IVARS(self);
    Hash *field_vector = (Hash*)Hash_Fetch(ivars->field_vectors, (Obj*)field);

    // If no cache hit, try to fill cache.
    if (field_vector == NULL) {
        ByteBuf *field_buf
            = (ByteBuf*)Hash_Fetch(ivars->field_bufs, (Obj*)field);

        // Bail if there's no content or the field isn't highlightable.
        if (field_buf == NULL) { return NULL; }

        field_vector = S_extract_tv_cache(field_buf);
        Hash_Store(ivars->field_vectors, (Obj*)field, (Obj*)field_vector);
    }

    // Get a buf for the term text or bail.
    ByteBuf *tv_buf = (ByteBuf*)Hash_Fetch(field_vector, (Obj*)term_text);
    if (tv_buf == NULL) {
        return NULL;
    }

    return S_extract_tv_from_tv_buf(field, term_text, tv_buf);
}
开发者ID:github188,项目名称:SimpleCode,代码行数:26,代码来源:DocVector.c


示例2: DocVec_term_vector

TermVector*
DocVec_term_vector(DocVector *self, const CharBuf *field,
                   const CharBuf *term_text) {
    Hash *field_vector = (Hash*)Hash_Fetch(self->field_vectors, (Obj*)field);

    // If no cache hit, try to fill cache.
    if (field_vector == NULL) {
        ByteBuf *field_buf
            = (ByteBuf*)Hash_Fetch(self->field_bufs, (Obj*)field);

        // Bail if there's no content or the field isn't highlightable.
        if (field_buf == NULL) { return NULL; }

        field_vector = S_extract_tv_cache(field_buf);
        Hash_Store(self->field_vectors, (Obj*)field, (Obj*)field_vector);
    }

    // Get a buf for the term text or bail.
    ByteBuf *tv_buf = (ByteBuf*)Hash_Fetch(field_vector, (Obj*)term_text);
    if (tv_buf == NULL) {
        return NULL;
    }

    return S_extract_tv_from_tv_buf(field, term_text, tv_buf);
}
开发者ID:pavansondur,项目名称:lucy,代码行数:25,代码来源:DocVector.c


示例3: S_init_sub_readers

static void
S_init_sub_readers(PolyReader *self, VArray *sub_readers) {
    PolyReaderIVARS *const ivars = PolyReader_IVARS(self);
    uint32_t  num_sub_readers = VA_Get_Size(sub_readers);
    int32_t *starts = (int32_t*)MALLOCATE(num_sub_readers * sizeof(int32_t));
    Hash  *data_readers = Hash_new(0);

    DECREF(ivars->sub_readers);
    DECREF(ivars->offsets);
    ivars->sub_readers       = (VArray*)INCREF(sub_readers);

    // Accumulate doc_max, subreader start offsets, and DataReaders.
    ivars->doc_max = 0;
    for (uint32_t i = 0; i < num_sub_readers; i++) {
        SegReader *seg_reader = (SegReader*)VA_Fetch(sub_readers, i);
        Hash *components = SegReader_Get_Components(seg_reader);
        CharBuf *api;
        DataReader *component;
        starts[i] = ivars->doc_max;
        ivars->doc_max += SegReader_Doc_Max(seg_reader);
        Hash_Iterate(components);
        while (Hash_Next(components, (Obj**)&api, (Obj**)&component)) {
            VArray *readers = (VArray*)Hash_Fetch(data_readers, (Obj*)api);
            if (!readers) {
                readers = VA_new(num_sub_readers);
                Hash_Store(data_readers, (Obj*)api, (Obj*)readers);
            }
            VA_Store(readers, i, INCREF(component));
        }
    }
    ivars->offsets = I32Arr_new_steal(starts, num_sub_readers);

    CharBuf *api;
    VArray  *readers;
    Hash_Iterate(data_readers);
    while (Hash_Next(data_readers, (Obj**)&api, (Obj**)&readers)) {
        DataReader *datareader
            = (DataReader*)CERTIFY(S_first_non_null(readers), DATAREADER);
        DataReader *aggregator
            = DataReader_Aggregator(datareader, readers, ivars->offsets);
        if (aggregator) {
            CERTIFY(aggregator, DATAREADER);
            Hash_Store(ivars->components, (Obj*)api, (Obj*)aggregator);
        }
    }
    DECREF(data_readers);

    DeletionsReader *del_reader
        = (DeletionsReader*)Hash_Fetch(
              ivars->components, (Obj*)VTable_Get_Name(DELETIONSREADER));
    ivars->del_count = del_reader ? DelReader_Del_Count(del_reader) : 0;
}
开发者ID:theory,项目名称:lucy,代码行数:52,代码来源:PolyReader.c


示例4: Seg_store_metadata

void
Seg_store_metadata(Segment *self, const CharBuf *key, Obj *value) {
    if (Hash_Fetch(self->metadata, (Obj*)key)) {
        THROW(ERR, "Metadata key '%o' already registered", key);
    }
    Hash_Store(self->metadata, (Obj*)key, value);
}
开发者ID:pavansondur,项目名称:lucy,代码行数:7,代码来源:Segment.c


示例5: SegReader_init

SegReader*
SegReader_init(SegReader *self, Schema *schema, Folder *folder,
               Snapshot *snapshot, Vector *segments, int32_t seg_tick) {
    Segment *segment;

    IxReader_init((IndexReader*)self, schema, folder, snapshot, segments,
                  seg_tick, NULL);
    SegReaderIVARS *const ivars = SegReader_IVARS(self);
    segment = SegReader_Get_Segment(self);

    ivars->doc_max    = (int32_t)Seg_Get_Count(segment);
    ivars->seg_name   = (String*)INCREF(Seg_Get_Name(segment));
    ivars->seg_num    = Seg_Get_Number(segment);
    Err *error = Err_trap(S_try_init_components, self);
    if (error) {
        // An error occurred, so clean up self and rethrow the exception.
        DECREF(self);
        RETHROW(error);
    }

    DeletionsReader *del_reader
        = (DeletionsReader*)Hash_Fetch(
              ivars->components, Class_Get_Name(DELETIONSREADER));
    ivars->del_count = del_reader ? DelReader_Del_Count(del_reader) : 0;

    return self;
}
开发者ID:apache,项目名称:lucy,代码行数:27,代码来源:SegReader.c


示例6: RAMFolder_local_is_directory

bool_t
RAMFolder_local_is_directory(RAMFolder *self, const CharBuf *name)
{
    Obj *entry = Hash_Fetch(self->entries, (Obj*)name);
    if (entry && Obj_Is_A(entry, FOLDER)) { return true; }
    return false;
}
开发者ID:gitpan,项目名称:KinoSearch,代码行数:7,代码来源:RAMFolder.c


示例7: RAMFolder_open_filedes

FileDes*
RAMFolder_open_filedes(RAMFolder *self, const CharBuf *filepath)
{
    RAMFileDes *file_des 
        = (RAMFileDes*)Hash_Fetch(self->elems, filepath);
    return file_des ? (FileDes*)INCREF(file_des) : NULL;
}
开发者ID:robertkrimen,项目名称:Search-Kino03,代码行数:7,代码来源:RAMFolder.c


示例8: CFReader_Local_Find_Folder_IMP

Folder*
CFReader_Local_Find_Folder_IMP(CompoundFileReader *self,
                               String *name) {
    CompoundFileReaderIVARS *const ivars = CFReader_IVARS(self);
    if (Hash_Fetch(ivars->records, name)) { return false; }
    return Folder_Local_Find_Folder(ivars->real_folder, name);
}
开发者ID:carriercomm,项目名称:lucy,代码行数:7,代码来源:CompoundFileReader.c


示例9: CFReader_Local_Exists_IMP

bool
CFReader_Local_Exists_IMP(CompoundFileReader *self, String *name) {
    CompoundFileReaderIVARS *const ivars = CFReader_IVARS(self);
    if (Hash_Fetch(ivars->records, name))              { return true; }
    if (Folder_Local_Exists(ivars->real_folder, name)) { return true; }
    return false;
}
开发者ID:carriercomm,项目名称:lucy,代码行数:7,代码来源:CompoundFileReader.c


示例10: CFReader_Local_Open_In_IMP

InStream*
CFReader_Local_Open_In_IMP(CompoundFileReader *self, String *name) {
    CompoundFileReaderIVARS *const ivars = CFReader_IVARS(self);
    Hash *entry = (Hash*)Hash_Fetch(ivars->records, name);

    if (!entry) {
        InStream *instream = Folder_Local_Open_In(ivars->real_folder, name);
        if (!instream) {
            ERR_ADD_FRAME(Err_get_error());
        }
        return instream;
    }
    else {
        Obj *len    = Hash_Fetch_Utf8(entry, "length", 6);
        Obj *offset = Hash_Fetch_Utf8(entry, "offset", 6);
        if (!len || !offset) {
            Err_set_error(Err_new(Str_newf("Malformed entry for '%o' in '%o'",
                                           name, Folder_Get_Path(ivars->real_folder))));
            return NULL;
        }
        else if (Str_Get_Size(ivars->path)) {
            String *fullpath = Str_newf("%o/%o", ivars->path, name);
            InStream *instream = InStream_Reopen(ivars->instream, fullpath,
                                                 Obj_To_I64(offset), Obj_To_I64(len));
            DECREF(fullpath);
            return instream;
        }
        else {
            return InStream_Reopen(ivars->instream, name, Obj_To_I64(offset),
                                   Obj_To_I64(len));
        }
    }
}
开发者ID:carriercomm,项目名称:lucy,代码行数:33,代码来源:CompoundFileReader.c


示例11: RAMFolder_local_delete

bool_t
RAMFolder_local_delete(RAMFolder *self, const CharBuf *name)
{
    Obj *entry = Hash_Fetch(self->entries, (Obj*)name);
    if (entry) {
        if (Obj_Is_A(entry, RAMFILE)) {
            ;
        }
        else if (Obj_Is_A(entry, FOLDER)) {
            RAMFolder *inner_folder;
            if (Obj_Is_A(entry, COMPOUNDFILEREADER)) {
                inner_folder = (RAMFolder*)CERTIFY(
                    CFReader_Get_Real_Folder((CompoundFileReader*)entry), 
                    RAMFOLDER);
            }
            else {
                inner_folder = (RAMFolder*)CERTIFY(entry, RAMFOLDER);
            }
            if (Hash_Get_Size(inner_folder->entries)) {
                // Can't delete non-empty dir. 
                return false;
            }
        }
        else {
            return false;
        }
        DECREF(Hash_Delete(self->entries, (Obj*)name));
        return true;
    }
    else {
        return false;
    }
}
开发者ID:gitpan,项目名称:KinoSearch,代码行数:33,代码来源:RAMFolder.c


示例12: Hash_equals

bool_t
Hash_equals(Hash *self, Obj *other) {
    Hash    *twin = (Hash*)other;
    Obj     *key;
    Obj     *val;

    if (twin == self)             {
        return true;
    }
    if (!Obj_Is_A(other, HASH))   {
        return false;
    }
    if (self->size != twin->size) {
        return false;
    }

    Hash_Iterate(self);
    while (Hash_Next(self, &key, &val)) {
        Obj *other_val = Hash_Fetch(twin, key);
        if (!other_val || !Obj_Equals(other_val, val)) {
            return false;
        }
    }

    return true;
}
开发者ID:pavansondur,项目名称:lucy,代码行数:26,代码来源:Hash.c


示例13: CFReader_local_open_in

InStream*
CFReader_local_open_in(CompoundFileReader *self, const CharBuf *name) {
    Hash *entry = (Hash*)Hash_Fetch(self->records, (Obj*)name);

    if (!entry) {
        InStream *instream = Folder_Local_Open_In(self->real_folder, name);
        if (!instream) {
            ERR_ADD_FRAME(Err_get_error());
        }
        return instream;
    }
    else {
        Obj *len    = Hash_Fetch_Str(entry, "length", 6);
        Obj *offset = Hash_Fetch_Str(entry, "offset", 6);
        if (!len || !offset) {
            Err_set_error(Err_new(CB_newf("Malformed entry for '%o' in '%o'",
                                          name, Folder_Get_Path(self->real_folder))));
            return NULL;
        }
        else if (CB_Get_Size(self->path)) {
            CharBuf *fullpath = CB_newf("%o/%o", self->path, name);
            InStream *instream = InStream_Reopen(self->instream, fullpath,
                                                 Obj_To_I64(offset), Obj_To_I64(len));
            DECREF(fullpath);
            return instream;
        }
        else {
            return InStream_Reopen(self->instream, name, Obj_To_I64(offset),
                                   Obj_To_I64(len));
        }
    }
}
开发者ID:pavansondur,项目名称:lucy,代码行数:32,代码来源:CompoundFileReader.c


示例14: Schema_Fetch_Analyzer_IMP

Analyzer*
Schema_Fetch_Analyzer_IMP(Schema *self, String *field) {
    SchemaIVARS *const ivars = Schema_IVARS(self);
    return field
           ? (Analyzer*)Hash_Fetch(ivars->analyzers, field)
           : NULL;
}
开发者ID:lazycrazyowl,项目名称:lucy,代码行数:7,代码来源:Schema.c


示例15: DefDelWriter_Seg_Deletions_IMP

Matcher*
DefDelWriter_Seg_Deletions_IMP(DefaultDeletionsWriter *self,
                               SegReader *seg_reader) {
    DefaultDeletionsWriterIVARS *const ivars = DefDelWriter_IVARS(self);
    Matcher *deletions    = NULL;
    Segment *segment      = SegReader_Get_Segment(seg_reader);
    String  *seg_name     = Seg_Get_Name(segment);
    Integer32 *tick_obj   = (Integer32*)Hash_Fetch(ivars->name_to_tick,
                                                   (Obj*)seg_name);
    int32_t tick          = tick_obj ? Int32_Get_Value(tick_obj) : 0;
    SegReader *candidate  = tick_obj
                            ? (SegReader*)VA_Fetch(ivars->seg_readers, tick)
                            : NULL;

    if (tick_obj) {
        DeletionsReader *del_reader
            = (DeletionsReader*)SegReader_Obtain(
                  candidate, Class_Get_Name(DELETIONSREADER));
        if (ivars->updated[tick] || DelReader_Del_Count(del_reader)) {
            BitVector *deldocs = (BitVector*)VA_Fetch(ivars->bit_vecs, tick);
            deletions = (Matcher*)BitVecMatcher_new(deldocs);
        }
    }
    else { // Sanity check.
        THROW(ERR, "Couldn't find SegReader %o", seg_reader);
    }

    return deletions;
}
开发者ID:github188,项目名称:SimpleCode,代码行数:29,代码来源:DeletionsWriter.c


示例16: RAMFolder_ram_file

RAMFileDes*
RAMFolder_ram_file(RAMFolder *self, const CharBuf *filepath)
{
    RAMFileDes *ram_file = (RAMFileDes*)Hash_Fetch(self->elems, filepath);
    if (ram_file == NULL)
        THROW( "File '%o' not loaded into RAM", filepath);
    return ram_file;
}
开发者ID:robertkrimen,项目名称:Search-Kino03,代码行数:8,代码来源:RAMFolder.c


示例17: Seg_Store_Metadata_IMP

void
Seg_Store_Metadata_IMP(Segment *self, String *key, Obj *value) {
    SegmentIVARS *const ivars = Seg_IVARS(self);
    if (Hash_Fetch(ivars->metadata, key)) {
        THROW(ERR, "Metadata key '%o' already registered", key);
    }
    Hash_Store(ivars->metadata, key, value);
}
开发者ID:apache,项目名称:lucy,代码行数:8,代码来源:Segment.c


示例18: RAMFolder_local_find_folder

Folder*
RAMFolder_local_find_folder(RAMFolder *self, const CharBuf *path)
{
    Folder *local_folder = (Folder*)Hash_Fetch(self->entries, (Obj*)path);
    if (local_folder && Folder_Is_A(local_folder, FOLDER)) {
        return local_folder;
    }
    return NULL;
}
开发者ID:gitpan,项目名称:KinoSearch,代码行数:9,代码来源:RAMFolder.c


示例19: Schema_Fetch_Sim_IMP

Similarity*
Schema_Fetch_Sim_IMP(Schema *self, String *field) {
    SchemaIVARS *const ivars = Schema_IVARS(self);
    Similarity *sim = NULL;
    if (field != NULL) {
        sim = (Similarity*)Hash_Fetch(ivars->sims, field);
    }
    return sim;
}
开发者ID:lazycrazyowl,项目名称:lucy,代码行数:9,代码来源:Schema.c


示例20: SegReader_register

void
SegReader_register(SegReader *self, const CharBuf *api, DataReader *component)
{
    if (Hash_Fetch(self->components, api)) {
        THROW("Interface '%o' already registered");
    }
    ASSERT_IS_A(component, DATAREADER);
    Hash_Store(self->components, api, (Obj*)component);
}
开发者ID:robertkrimen,项目名称:Search-Kino03,代码行数:9,代码来源:SegReader.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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