X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=src%2Fapi%2Finternal%2FBamPipe_p.cpp;h=e13ad7c759c6c1cce5870dfe83465fde1513836f;hb=8b4c010999a8d0c482d84bbf17c98dc4bbae02b7;hp=62fd789aa21e9784dc0cb2819ad6130931785bc8;hpb=57ff487e7acaf7f55a45c0a80cb9647bb1d83801;p=bamtools.git diff --git a/src/api/internal/BamPipe_p.cpp b/src/api/internal/BamPipe_p.cpp index 62fd789..e13ad7c 100644 --- a/src/api/internal/BamPipe_p.cpp +++ b/src/api/internal/BamPipe_p.cpp @@ -2,12 +2,12 @@ // BamPipe_p.cpp (c) 2011 Derek Barnett // Marth Lab, Department of Biology, Boston College // --------------------------------------------------------------------------- -// Last modified: 9 September 2011 (DB) +// Last modified: 10 October 2011 (DB) // --------------------------------------------------------------------------- // Provides BAM pipe-specific IO behavior // *************************************************************************** -#include +#include "api/internal/BamPipe_p.h" using namespace BamTools; using namespace BamTools::Internal; @@ -34,15 +34,15 @@ bool BamPipe::Open(const IBamIODevice::OpenMode mode) { else if ( mode == IBamIODevice::WriteOnly ) m_stream = freopen(0, "wb", stdout); else { - SetErrorString("BamPipe ERROR - unsupported device mode"); + SetErrorString("BamPipe::Open", "unknown open mode requested"); return false; } // check that we obtained a valid FILE* if ( m_stream == 0 ) { - string error = "BamPipe ERROR - could not open handle on "; - error += ( (mode == IBamIODevice::ReadOnly) ? "stdin" : "stdout" ); - SetErrorString(error); + const string message_base = string("could not open handle on "); + const string message = message_base + ( (mode == IBamIODevice::ReadOnly) ? "stdin" : "stdout" ); + SetErrorString("BamPipe::Open", message); return false; } @@ -51,18 +51,7 @@ bool BamPipe::Open(const IBamIODevice::OpenMode mode) { return true; } -bool BamPipe::Seek(const int64_t& position) { -// (void)position; // suppress compiler warning about unused variable -// return false; // seeking not allowed in pipe - - BT_ASSERT_X( m_stream, "BamFile::Seek() - null stream" ); - cerr << "BamPipe::Seek() - about to attempt seek" << endl; - bool result = ( fseek64(m_stream, position, SEEK_SET) == 0); - if ( !result ) { - cerr << "BamPipe can't be seeked in" << endl; - } - return result; - -// return ( fseek64(m_stream, position, SEEK_SET) == 0); - +bool BamPipe::Seek(const int64_t& ) { + SetErrorString("BamPipe::Seek", "random access not allowed in FIFO pipe"); + return false; }