Ignore:
Timestamp:
Apr 16, 2015, 2:22:24 AM (8 years ago)
Author:
Peter
Message:

Implement functions to get/set free text in BamHeader?. As setting the
header text modifies underlying data, copy and assignment are now
implemented as hard copy (rather than the implicit pointer copy as
before). It also means that the bam_hdr_t* is no longer owned by
InBamFile?, but is now owned by BamHeader? and destroyed in its
destructor.

refs #817

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/yat/omic/BamHeader.h

    r3363 r3408  
    2525#include "config_bam.h"
    2626
     27#include "yat/utility/config_public.h"
     28
    2729#include YAT_SAM_HEADER
    2830
     
    3234namespace yat {
    3335namespace omic {
     36
     37#ifndef YAT_HAVE_HTSLIB
     38  namespace detail {
     39    bam_header_t * bam_hdr_dup(const bam_header_t* other);
     40  }
     41#endif
    3442
    3543  /**
     
    5462
    5563    /**
     64       \brief Destructor
     65     */
     66    ~BamHeader(void);
     67
     68    /**
     69       \brief Copy constructor
     70     */
     71    BamHeader(const BamHeader&);
     72
     73    /**
    5674       Parse a region in the format: 'chr2:100,000-200,000 and return
    5775       values in variables \a tid, \a begin and \a end. \a reg is
     
    7088
    7189    /**
     90       \brief Exchanges the content in \c *this and \a other
     91
     92       \since New in yat 0.13
     93     */
     94    void swap(BamHeader& other);
     95
     96    /**
    7297       Name of chromosome with ID \a tid
    7398     */
     
    78103     */
    79104    uint32_t target_length(size_t tid) const;
     105
     106    /**
     107       \return text in header
     108
     109       \since New in yat 0.13
     110     */
     111    std::string text(void) const;
     112
     113    /**
     114       \brief set text in header
     115
     116       This function parses \a txt and updates fields.
     117
     118       \since New in yat 0.13
     119     */
     120    void text(const std::string& txt);
    80121
    81122    /**
     
    94135     */
    95136    int32_t n_targets(void) const;
     137
     138    /**
     139       \brief assignment operator
     140     */
     141    BamHeader& operator=(const BamHeader& rhs);
     142
    96143  private:
    97144#ifndef YAT_HAVE_HTSLIB
     
    104151
    105152    // using compiler generated copy and assignment
    106     //BamHeader(const BamHeader&);
    107     //BamHeader& operator=(const BamHeader& rhs);
    108153  };
     154
     155  /**
     156     Exchanges the content in the headers.
     157
     158     \since New in yat 0.13
     159
     160     \relates BamHeader
     161   */
     162  void swap(BamHeader& lhs, BamHeader& rhs);
    109163
    110164}}}
Note: See TracChangeset for help on using the changeset viewer.