X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=src%2Fapi%2FBamReader.cpp;h=0728d962141b559c6f8ce7d69a9721c9c02a7a52;hb=d1c8508ec5cbeafd6a1e5af4756059ccf168216f;hp=6e4a10f80ece0b7b6cfd0d55c125f6dd509bf012;hpb=9f1ce8c47aeadb6dc1320b52ee671c3341b97935;p=bamtools.git diff --git a/src/api/BamReader.cpp b/src/api/BamReader.cpp index 6e4a10f..0728d96 100644 --- a/src/api/BamReader.cpp +++ b/src/api/BamReader.cpp @@ -2,13 +2,13 @@ // BamReader.cpp (c) 2009 Derek Barnett, Michael Str�mberg // Marth Lab, Department of Biology, Boston College // --------------------------------------------------------------------------- -// Last modified: 10 October 2011 (DB) +// Last modified: 18 November 2012 (DB) // --------------------------------------------------------------------------- // Provides read access to BAM files. // *************************************************************************** #include "api/BamReader.h" -#include "api/internal/BamReader_p.h" +#include "api/internal/bam/BamReader_p.h" using namespace BamTools; using namespace BamTools::Internal; @@ -61,6 +61,22 @@ bool BamReader::CreateIndex(const BamIndex::IndexType& type) { return d->CreateIndex(type); } +/*! \fn const SamHeader& BamReader::GetConstSamHeader(void) const + \brief Returns const reference to SAM header data. + + Allows for read-only queries of SAM header data. + + If you do not need to modify the SAM header, use this method to avoid the + potentially expensive copy used by GetHeader(). + + \note + \returns const reference to header data object + \sa GetHeader(), GetHeaderText() +*/ +const SamHeader& BamReader::GetConstSamHeader(void) const { + return d->GetConstSamHeader(); +} + /*! \fn std::string BamReader::GetErrorString(void) const \brief Returns a human-readable description of the last error that occurred @@ -90,7 +106,8 @@ const std::string BamReader::GetFilename(void) const { /*! \fn SamHeader BamReader::GetHeader(void) const \brief Returns SAM header data. - Header data is wrapped in a SamHeader object that can be conveniently queried & modified. + Header data is wrapped in a SamHeader object that can be conveniently queried and/or modified. + If you only need read access, consider using GetConstSamHeader() instead. \note Modifying the retrieved SamHeader object does NOT affect the current BAM file. This file has been opened in a read-only mode. @@ -98,7 +115,7 @@ const std::string BamReader::GetFilename(void) const { BamWriter to generate a new BAM file with the appropriate header information. \returns header data object - \sa GetHeaderText() + \sa GetConstSamHeader(), GetHeaderText() */ SamHeader BamReader::GetHeader(void) const { return d->GetSamHeader(); @@ -310,19 +327,6 @@ void BamReader::SetIndex(BamIndex* index) { d->SetIndex(index); } -/*! \fn void BamReader::SetIndexCacheMode(const BamIndex::IndexCacheMode& mode) - \brief Changes the caching behavior of the index data. - - Default mode is BamIndex::LimitedIndexCaching. - - \param[in] mode desired cache mode for index, see BamIndex::IndexCacheMode for - description of the available cache modes - \sa HasIndex() -*/ -void BamReader::SetIndexCacheMode(const BamIndex::IndexCacheMode& mode) { - d->SetIndexCacheMode(mode); -} - /*! \fn bool BamReader::SetRegion(const BamRegion& region) \brief Sets a target region of interest