From: Derek Date: Mon, 30 Aug 2010 20:17:32 +0000 (-0400) Subject: Minor formatting & commenting update X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=c33546e0647048a290814d64937a709f33264468;p=bamtools.git Minor formatting & commenting update --- diff --git a/src/toolkit/bamtools_count.cpp b/src/toolkit/bamtools_count.cpp index 4bd7c82..28677ce 100644 --- a/src/toolkit/bamtools_count.cpp +++ b/src/toolkit/bamtools_count.cpp @@ -82,6 +82,7 @@ int CountTool::Run(int argc, char* argv[]) { if ( !m_settings->HasInput ) m_settings->InputFiles.push_back(Options::StandardIn()); + // open reader without index BamMultiReader reader; reader.Open(m_settings->InputFiles, false, true); diff --git a/src/utils/bamtools_variant.h b/src/utils/bamtools_variant.h index 4927de9..93ef8ab 100644 --- a/src/utils/bamtools_variant.h +++ b/src/utils/bamtools_variant.h @@ -27,34 +27,35 @@ namespace BamTools { class Variant { public: - Variant(void) : data (NULL) { } + Variant(void) : data(NULL) { } Variant(const Variant& other) { - if(other.data != NULL) + if ( other.data != NULL ) other.data->AddRef(); data = other.data; } ~Variant(void) { - if(data != NULL) data->Release(); + if ( data != NULL ) + data->Release(); } // NOTE: This code takes care of self-assignment. // DO NOT CHANGE THE ORDER of the statements. - Variant& operator=(const Variant& rhs) { - if(rhs.data != NULL) + Variant& operator= (const Variant& rhs) { + if ( rhs.data != NULL ) rhs.data->AddRef(); - if(data != NULL) + if ( data != NULL ) data->Release(); data = rhs.data; - return * this; + return *this; } // This member template constructor allows you to // instance a variant_t object with a value of any type. template - Variant(T v) - : data(new Impl(v)) + Variant(T v) + : data(new Impl(v)) { data->AddRef(); } @@ -88,13 +89,13 @@ class Variant { private: struct ImplBase { - ImplBase() : refs(0) {} - virtual ~ImplBase() {} + ImplBase() : refs(0) { } + virtual ~ImplBase(void) { } - void AddRef(void) { refs ++; } + void AddRef(void) { ++refs; } void Release(void) { --refs; - if(refs == 0) delete this; + if ( refs == 0 ) delete this; } size_t refs; @@ -102,7 +103,7 @@ class Variant { template struct Impl : ImplBase { - Impl(T v) : data (v) { } + Impl(T v) : data(v) { } ~Impl(void) { } T data; }; @@ -113,9 +114,9 @@ class Variant { static Impl* CastFromBase(ImplBase* v) { // This upcast will fail if T is other than the T used // with the constructor of variant_t. - Impl* p = dynamic_cast*> (v); - if (p == NULL) - throw std::invalid_argument(typeid(T).name()+std::string(" is not a valid type")); + Impl* p = dynamic_cast< Impl* > (v); + if ( p == NULL ) + throw std::invalid_argument( typeid(T).name() + std::string(" is not a valid type") ); return p; }