1 /*=========================================================================== 2 * 3 * PUBLIC DOMAIN NOTICE 4 * National Center for Biotechnology Information 5 * 6 * This software/database is a "United States Government Work" under the 7 * terms of the United States Copyright Act. It was written as part of 8 * the author's official duties as a United States Government employee and 9 * thus cannot be copyrighted. This software/database is freely available 10 * to the public for use. The National Library of Medicine and the U.S. 11 * Government have not placed any restriction on its use or reproduction. 12 * 13 * Although all reasonable efforts have been taken to ensure the accuracy 14 * and reliability of the software and data, the NLM and the U.S. 15 * Government do not and cannot warrant the performance or results that 16 * may be obtained by using this software or data. The NLM and the U.S. 17 * Government disclaim all warranties, express or implied, including 18 * warranties of performance, merchantability or fitness for any particular 19 * purpose. 20 * 21 * Please cite the author in any work or product based on this material. 22 * 23 * =========================================================================== 24 * 25 */ 26 27 #ifndef _h_vdb_dump_coldefs_ 28 #define _h_vdb_dump_coldefs_ 29 30 #include <vdb/manager.h> 31 #include <vdb/schema.h> 32 #include <vdb/table.h> 33 #include <vdb/cursor.h> 34 #include <vdb/database.h> 35 36 #include <klib/vector.h> 37 #include <klib/text.h> 38 #include <klib/num-gen.h> 39 40 #include "vdb-dump-str.h" 41 42 #ifdef __cplusplus 43 extern "C" { 44 #endif 45 46 47 /* 48 const char *get_platform_txt( const uint32_t id ); 49 const char *get_read_type_txt( const uint32_t id ); 50 const char *get_read_filter_txt( const uint32_t id ); 51 */ 52 53 typedef const char* (*value_trans_fct_t)( const uint32_t id ); 54 typedef char* (*dim_trans_fct_t)( const uint8_t *src ); 55 56 /******************************************************************** 57 col-def is the definition of a single column: name/index/type 58 ********************************************************************/ 59 typedef struct col_def 60 { 61 char *name; 62 uint32_t idx; 63 uint64_t elementsum; 64 bool valid; 65 bool excluded; 66 VTypedecl type_decl; 67 VTypedesc type_desc; 68 dump_str content; 69 value_trans_fct_t value_trans_fct; 70 dim_trans_fct_t dim_trans_fct; 71 } col_def; 72 typedef col_def* p_col_def; 73 74 /******************************************************************** 75 the col-defs are a vector of single column-definitions 76 ********************************************************************/ 77 typedef struct col_defs 78 { 79 Vector cols; 80 uint16_t max_colname_chars; 81 size_t str_limit; 82 } col_defs; 83 typedef col_defs* p_col_defs; 84 85 #define MAX_COL_NAME_LEN 64 86 87 const char *vdcd_get_platform_txt( const uint32_t id ); 88 89 char *vdcd_make_domain_txt( const uint32_t domain ); 90 91 bool vdcd_init( col_defs** defs, const size_t str_limit ); 92 void vdcd_destroy( col_defs* defs ); 93 94 uint32_t vdcd_parse_string( col_defs* defs, const char* src, const VTable *tbl, uint32_t * invalid_columns ); 95 uint32_t vdcd_extract_from_table( col_defs* defs, const VTable *tbl, uint32_t * invalid_columns ); 96 bool vdcd_table_has_column( const VTable *tbl, const char * to_find ); 97 bool vdcd_extract_from_phys_table( col_defs* defs, const VTable *tbl ); 98 uint32_t vdcd_add_to_cursor( col_defs* defs, const VCursor *curs ); 99 void vdcd_reset_content( col_defs* defs ); 100 void vdcd_ins_trans_fkt( col_defs* defs, const VSchema *schema ); 101 void vdcd_exclude_these_columns( col_defs* defs, const char* column_names ); 102 bool vdcd_get_first_none_static_column_idx( col_defs* defs, const VCursor * curs, uint32_t * idx ); 103 104 uint32_t vdcd_extract_static_columns( col_defs* defs, const VTable *tbl, 105 const size_t str_limit, uint32_t * invalid_columns ); 106 107 rc_t vdcd_collect_spread( const struct num_gen * row_set, col_defs * cols, const VCursor * curs ); 108 109 #ifdef __cplusplus 110 } 111 #endif 112 113 #endif 114