| 1 | /* bam_plbuf.h -- plbuf routines (declarations copied from bam.h). |
| 2 | |
| 3 | Copyright (C) 2008, 2013, 2021 Genome Research Ltd. |
| 4 | |
| 5 | Author: Heng Li <[email protected]> |
| 6 | |
| 7 | Permission is hereby granted, free of charge, to any person obtaining a copy |
| 8 | of this software and associated documentation files (the "Software"), to deal |
| 9 | in the Software without restriction, including without limitation the rights |
| 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 11 | copies of the Software, and to permit persons to whom the Software is |
| 12 | furnished to do so, subject to the following conditions: |
| 13 | |
| 14 | The above copyright notice and this permission notice shall be included in |
| 15 | all copies or substantial portions of the Software. |
| 16 | |
| 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 20 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 22 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
| 23 | DEALINGS IN THE SOFTWARE. */ |
| 24 | |
| 25 | #ifndef BAM_PLBUF_H |
| 26 | #define BAM_PLBUF_H |
| 27 | |
| 28 | #include <htslib/sam.h> |
| 29 | |
| 30 | #ifndef BAM_PILEUP_F_DEFINED |
| 31 | #define BAM_PILEUP_F_DEFINED |
| 32 | typedef int (*bam_pileup_f)(uint32_t tid, hts_pos_t pos, int n, const bam_pileup1_t *pl, void *data); |
| 33 | #endif //BAM_PILEUP_F_DEFINED |
| 34 | |
| 35 | typedef struct { |
| 36 | bam_plp_t iter; |
| 37 | bam_pileup_f func; |
| 38 | void *data; |
| 39 | } bam_plbuf_t; |
| 40 | |
| 41 | #ifdef __cplusplus |
| 42 | extern "C" { |
| 43 | #endif |
| 44 | /* Exported from bam_plbuf.c */ |
| 45 | void bam_plbuf_reset(bam_plbuf_t *buf); |
| 46 | |
| 47 | bam_plbuf_t *bam_plbuf_init(bam_pileup_f func, void *data); |
| 48 | |
| 49 | void bam_plbuf_destroy(bam_plbuf_t *buf); |
| 50 | |
| 51 | int bam_plbuf_push(const bam1_t *b, bam_plbuf_t *buf); |
| 52 | |
| 53 | #ifdef __cplusplus |
| 54 | } |
| 55 | #endif |
| 56 | |
| 57 | #endif // BAM_PLBUF_H |