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


C++ VectorGet函数代码示例

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


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

示例1: make_skiplist_ref_node

/* helper to create a skiplist-node, walk the given the ref-region fo find and enter all skip positions */
static struct skiplist_ref_node * make_skiplist_ref_node( const struct reference_region * r )
{
    struct skiplist_ref_node * res = calloc( 1, sizeof *res );
    if ( res != NULL )
    {
        uint32_t i, n = VectorLength( &r->ranges );
        res->name = string_dup_measure ( r->name, NULL );
        VectorInit ( &res->skip_ranges, 0, 5 );
        /* walk the ranges-Vector of the reference-region */
        for ( i = 0; i < n; ++i )
        {
            const struct reference_range * rr = VectorGet ( &( r->ranges ), i );
            /* walk the skip-Vector of the reference-range */
            uint32_t j, n1 = VectorLength( &rr->skip );
            for ( j = 0; j < n1; ++j )
            {
                const struct skip_range * sr = VectorGet ( &( rr->skip ), j );
                if ( sr != NULL )
                {
                    struct skip_range * csr = make_skip_range( sr->start, sr->end );
                    if ( csr != NULL )
                        VectorAppend ( &( res->skip_ranges ), NULL, csr );
                }
            }
        }
        res->current_id = 0;
        res->current_skip_range = VectorGet ( &( res->skip_ranges ), 0 );
    }
    return res;
}
开发者ID:Bhumi28,项目名称:sra-tools,代码行数:31,代码来源:ref_regions.c

示例2: matcher_make_column_matrix

static rc_t matcher_make_column_matrix( p_mcol col )
{
    rc_t rc = 0;
    uint32_t src_idx, src_len;

    src_len = VectorLength( &(col->src_types) );
    for ( src_idx = 0;  src_idx < src_len && rc == 0; ++src_idx )
    {
        p_mtype src_type = (p_mtype) VectorGet ( &(col->src_types), src_idx );
        if ( src_type )
        {
            uint32_t dst_idx, dst_len;
            dst_len = VectorLength( &(col->dst_types) );
            for ( dst_idx = 0;  dst_idx < dst_len && rc == 0; ++dst_idx )
            {
                p_mtype dst_type = (p_mtype) VectorGet ( &(col->dst_types), dst_idx );
                if ( dst_type )
                {
                    p_mpair pair = matcher_init_pair( src_type, dst_type );
                    if ( pair != NULL )
                        rc = VectorAppend( &(col->pairs), NULL, pair );
                    else
                        rc = RC( rcVDB, rcNoTarg, rcConstructing, rcMemory, rcExhausted );
                }
            }
        }
    }
    return rc;
}
开发者ID:Bhumi28,项目名称:sra-tools,代码行数:29,代码来源:type_matcher.c

示例3: PrintIntVector

static void PrintIntVector(vector_t v) {
  size_t i;
  size_t length;

  assert(v != NULL);

  length = VectorLength(v);

  if (length > 0) {
    printf("[%d", *((int*)VectorGet(v, 0)));
    for (i = 1; i < VectorLength(v); ++i)
      printf(",%d", *((int*)VectorGet(v, i)));
    printf("]\n");
  }
}
开发者ID:harryKong,项目名称:CSE333,代码行数:15,代码来源:ex5.c

示例4: col_defs_add_to_rd_cursor

/*
 * walks the list of column-definitions and tries to add all off them
 * to the given cursor, it stops if one of them fails to be added
 * for every column it detects type_decl and type_desc
 * if both calls are successful the column-def is marked as valid
*/
rc_t col_defs_add_to_rd_cursor( col_defs* defs, const VCursor *cursor, bool show )
{
    rc_t rc = 0;
    uint32_t idx, len;
    
    if ( defs == NULL )
        return RC( rcExe, rcNoTarg, rcResolving, rcSelf, rcNull );
    if ( cursor == NULL )
        return RC( rcExe, rcNoTarg, rcResolving, rcParam, rcNull );

    len = VectorLength( &(defs->cols) );
    for ( idx = 0;  idx < len && rc == 0; ++idx )
    {
        p_col_def col = (p_col_def) VectorGet ( &(defs->cols), idx );
        if ( col != NULL )
        {
            if ( col->src_cast != NULL )
            {
                rc = VCursorAddColumn( cursor, &(col->src_idx), "%s", col->src_cast );
                DISP_RC( rc, "col_defs_add_to_cursor:VCursorAddColumn() failed" );
                if ( rc == 0 )
                {
                    rc = VCursorDatatype( cursor, col->src_idx,
                              &(col->type_decl), &(col->type_desc) );
                    DISP_RC( rc, "col_defs_add_to_cursor:VCursorDatatype() failed" );
                    col->src_valid = ( rc == 0 );
                    if ( show && col->src_valid )
                        KOutMsg( "added to rd-cursor: >%s<\n", col->name );
                }

            }
        }
    }
    return rc;
}
开发者ID:Bhumi28,项目名称:sra-tools,代码行数:41,代码来源:coldefs.c

示例5: matcher_read_src_types

static rc_t matcher_read_src_types( matcher* self, const VTable *table,
                                    const VSchema *schema )
{
    rc_t rc = 0;
    uint32_t idx, len;

    if ( self == NULL )
        return RC( rcExe, rcNoTarg, rcResolving, rcSelf, rcNull );
    if ( table == NULL || schema == NULL )
        return RC( rcExe, rcNoTarg, rcResolving, rcParam, rcNull );
    len = VectorLength( &(self->mcols) );
    for ( idx = 0;  idx < len && rc == 0; ++idx )
    {
        p_mcol item = (p_mcol) VectorGet ( &(self->mcols), idx );
        if ( item != NULL )
        {
            uint32_t dflt_idx;
            KNamelist *names;
            rc = VTableListReadableDatatypes( table, item->name, &dflt_idx, &names );
            if ( rc == 0 )
            {
                rc = matcher_read_col_src_types( item, names, dflt_idx, schema );
                KNamelistRelease( names );
            }
        }
    }
    return rc;
}
开发者ID:Bhumi28,项目名称:sra-tools,代码行数:28,代码来源:type_matcher.c

示例6: matcher_report_pairs

static void matcher_report_pairs( const Vector *v )
{
    uint32_t idx, len;
    len = VectorLength( v );
    for ( idx = 0;  idx < len; ++idx )
       matcher_report_pair( (p_mpair) VectorGet ( v, idx ) );
}
开发者ID:Bhumi28,项目名称:sra-tools,代码行数:7,代码来源:type_matcher.c

示例7: ng_next_node

static bool ng_next_node( p_ng generator, uint64_t* value )
{
    bool res = false;
    if ( generator->curr_node < generator->node_count )
    {
        p_ng_node node = (p_ng_node)VectorGet( &(generator->nodes), 
                                               (uint32_t)generator->curr_node );
        if ( node != NULL )
        {
            uint64_t ret_value = node->start;
            if ( node->count < 2 )
            {
                /* the node is a single-number-node */
                generator->curr_node++;
            }
            else
            {
                /* the node is a number range */
                ret_value += generator->curr_node_sub_pos++;
                if ( generator->curr_node_sub_pos >= node->count )
                {
                    generator->curr_node++;
                    generator->curr_node_sub_pos = 0;
                }
            }
            if ( value ) *value = ret_value;
            res = true;
        }
    }
    return res;
}
开发者ID:DCGenomics,项目名称:sra-tools,代码行数:31,代码来源:num-gen.c

示例8: VNameListGet

LIB_EXPORT rc_t CC VNameListGet ( const VNamelist *self, uint32_t idx, const char **name )
{
    if ( idx >= VectorLength ( &(self->name_vector) ) )
        return RC ( rcCont, rcNamelist, rcAccessing, rcParam, rcExcessive );
    * name = VectorGet ( &(self->name_vector), idx );
    return 0;
}
开发者ID:ImAWolf,项目名称:ncbi-vdb,代码行数:7,代码来源:vector_namelist.c

示例9: FixedDictionaryGet

int FixedDictionaryGet(    struct FixedDictionary* self,
                        void* key,
                        void* OutValue) 
{    
    if (!self ||
        !key) 
    {
        errno = EINVAL;
        return EINVAL;
    }

    size_t hashCode = FixedDictionaryHashFn(key, self->_keySize);
    size_t bucketIndex = hashCode % self->_capacity;

    struct Vector* bucket = self->_buckets[bucketIndex];
    if (!bucket) {
        return 0;
    }

    size_t collCount = VectorGetCount(bucket);
    for (size_t i = 0; i < collCount; ++i) {
        struct Slot slot;
        VectorGet(bucket, i, &slot);
        if (slot.hashCode == hashCode) {
            if (memcmp(slot.key, key, self->_keySize) == 0) {
                memcpy(OutValue, slot.value, self->_valueSize);
                return 1;
            }
        }
    }
    memset(OutValue, 0, self->_valueSize);
    return 0;
}
开发者ID:CptDemocracy,项目名称:The-C-Blues,代码行数:33,代码来源:FixedDictionary.c

示例10: register_temp_file

rc_t register_temp_file( temp_registry * self, uint32_t read_id, const char * filename )
{
    rc_t rc = 0;
    if ( self == NULL )
        rc = RC( rcVDB, rcNoTarg, rcConstructing, rcSelf, rcNull );
    else if ( filename == NULL )
        rc = RC( rcVDB, rcNoTarg, rcConstructing, rcParam, rcNull );
    else
    {
        rc = KLockAcquire ( self -> lock );
        if ( rc == 0 )
        {
            VNamelist * l = VectorGet ( &self -> lists, read_id );
            if ( l == NULL )
            {
                rc = VNamelistMake ( &l, 12 );
                if ( rc == 0 )
                {
                    rc = VectorSet ( &self -> lists, read_id, l );
                    if ( rc != 0 )
                        VNamelistRelease ( l );
                }
            }
            if ( rc == 0 && l != NULL )
            {
                rc = VNamelistAppend ( l, filename );
                if ( rc == 0 )
                    rc = Add_File_to_Cleanup_Task ( self -> cleanup_task, filename );
            }
            KLockUnlock ( self -> lock );
        }
    }
    return rc;
}
开发者ID:ncbi,项目名称:sra-tools,代码行数:34,代码来源:temp_registry.c

示例11: col_defs_get

/*
 * retrieves a pointer to a column-definition
 * idx defines the Vector-Index of the wanted column-definition
 * !!! not the read or write cursor index !!!
*/
p_col_def col_defs_get( col_defs* defs, const uint32_t idx )
{
    p_col_def res = NULL;
    if ( defs != NULL )
        res = (p_col_def) VectorGet ( &(defs->cols), idx );
    return res;
}
开发者ID:Bhumi28,项目名称:sra-tools,代码行数:12,代码来源:coldefs.c

示例12: col_defs_add_to_wr_cursor

/*
 * adds all columns marked with to_copy == true to the cursor
*/
rc_t col_defs_add_to_wr_cursor( col_defs* defs, const VCursor* cursor, bool show )
{
    uint32_t idx, len;

    if ( defs == NULL )
        return RC( rcExe, rcNoTarg, rcResolving, rcSelf, rcNull );
    if ( cursor == NULL )
        return RC( rcExe, rcNoTarg, rcResolving, rcParam, rcNull );

    len = VectorLength( &(defs->cols) );
    for ( idx = 0;  idx < len; ++idx )
    {
        p_col_def col = (p_col_def) VectorGet ( &(defs->cols), idx );
        if ( col != NULL )
            if ( col->to_copy && col->dst_cast != NULL )
            {
                rc_t rc = VCursorAddColumn( cursor, &(col->dst_idx), "%s", col->dst_cast );
                col->to_copy = ( rc == 0 );
                if ( show )
                {
                    if ( col->to_copy )
                        KOutMsg( "added to wr-cursor: >%s<\n", col->name );
                    else
                        KOutMsg( "cannot add >%s<\n", col->name );
                }
            }
    }
    return 0;
}
开发者ID:Bhumi28,项目名称:sra-tools,代码行数:32,代码来源:coldefs.c

示例13: vdi_repo

rc_t vdi_repo( const Vector * v )
{
    KConfig * cfg;
    rc_t rc = KConfigMake( &cfg, NULL );
    if ( rc == 0 )
    {
        const KRepositoryMgr * repomgr;
        rc = KConfigMakeRepositoryMgrRead( cfg, &repomgr );
        {
            if ( VectorLength( v ) < 2 )
            {
                rc = vdi_repo_all( repomgr, true );
            }
            else
            {
                const String * which_repo = VectorGet( v, 1 );
                if ( which_repo != NULL )
                {
                    int32_t repo_id = index_of_match( which_repo, 4, "user", "site", "remote", "all" );
                    if ( repo_id < 0 || repo_id > 3 )
                        rc = KOutMsg( "unknow repository '%S'", which_repo );
                    else
                        rc = vdi_sub_repo( repomgr, v, which_repo, repo_id );
                }
            }

            KRepositoryMgrRelease( repomgr );
        }
        KConfigRelease ( cfg );
    }
    return rc;
}
开发者ID:ncbi,项目名称:sra-tools,代码行数:32,代码来源:vdb-dump-repo.c

示例14: vdi_sub_repo

static rc_t vdi_sub_repo( const KRepositoryMgr * repomgr, const Vector * v, const String * which_repo, int32_t repo_id )
{
    rc_t rc = 0;
    const KRepCategory cat = id_to_repo_cat[ repo_id ];

    if ( VectorLength( v ) > 2 )
    {
        const String * which_sub = VectorGet( v, 2 );
        int32_t repo_func = index_of_match( which_sub, 2, "on", "off" );
        switch( repo_func )
        {
        case 0 :
            rc = vdi_repo_switch( repomgr, cat, false );
            break;
        case 1 :
            rc = vdi_repo_switch( repomgr, cat, true );
            break;
        case -1 :  {
            int32_t select = ( int32_t )string_to_I64( which_sub->addr, which_sub->len, NULL );
            rc = vdi_report_repo_vector( repomgr, cat, select, true );
        }
        break;
        }
    }
    else
    {
        if ( repo_id < 3 )
            rc = vdi_report_repo_vector( repomgr, cat, -1, false );
        else
            rc = vdi_repo_all( repomgr, false );
    }

    return rc;
}
开发者ID:ncbi,项目名称:sra-tools,代码行数:34,代码来源:vdb-dump-repo.c

示例15: col_defs_mark_writable_columns

rc_t col_defs_mark_writable_columns( col_defs* defs, VTable *tab, bool show )
{
    KNamelist *writables;
    rc_t rc;

    if ( defs == NULL )
        return RC( rcExe, rcNoTarg, rcResolving, rcSelf, rcNull );
    if ( tab == NULL )
        return RC( rcExe, rcNoTarg, rcResolving, rcParam, rcNull );

    rc = VTableListWritableColumns ( tab, &writables );
    if ( rc == 0 )
    {
        uint32_t idx, count = VectorLength( &(defs->cols) );
        for ( idx = 0;  idx < count; ++idx )
        {
            p_col_def col = (p_col_def) VectorGet ( &(defs->cols), idx );
            if ( col != NULL )
                if ( col->requested )
                    if ( nlt_is_name_in_namelist( writables, col->name ) )
                    {
                        if ( show )
                            KOutMsg( "writable column: >%s<\n", col->name );
                        col->to_copy = true;
                    }
        }
        KNamelistRelease( writables );
    }
    return rc;
}
开发者ID:Bhumi28,项目名称:sra-tools,代码行数:30,代码来源:coldefs.c


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