From: derek Date: Wed, 12 Jan 2011 03:35:09 +0000 (-0500) Subject: Added explicit copy ctors to SamHeader data structures X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=dc965ab6cd68e6e4b29544ae7340c571b0c7cf9f;p=bamtools.git Added explicit copy ctors to SamHeader data structures --- diff --git a/src/api/SamHeader.cpp b/src/api/SamHeader.cpp index 405033f..74381f0 100644 --- a/src/api/SamHeader.cpp +++ b/src/api/SamHeader.cpp @@ -16,6 +16,7 @@ using namespace BamTools; using namespace BamTools::Internal; using namespace std; +// ctor SamHeader::SamHeader(const string& headerText) : Version("") , SortOrder("") @@ -28,6 +29,19 @@ SamHeader::SamHeader(const string& headerText) parser.Parse(headerText); } +// copy ctor +SamHeader::SamHeader(const SamHeader& other) + : Version(other.Version) + , SortOrder(other.SortOrder) + , GroupOrder(other.GroupOrder) + , Sequences(other.Sequences) + , ReadGroups(other.ReadGroups) + , ProgramName(other.ProgramName) + , ProgramVersion(other.ProgramVersion) + , ProgramCommandLine(other.ProgramCommandLine) +{ } + +// dtor SamHeader::~SamHeader(void) { Clear(); } diff --git a/src/api/SamHeader.h b/src/api/SamHeader.h index b51f175..add4418 100644 --- a/src/api/SamHeader.h +++ b/src/api/SamHeader.h @@ -24,6 +24,7 @@ struct API_EXPORT SamHeader { // ctor & dtor public: explicit SamHeader(const std::string& headerText = ""); + explicit SamHeader(const SamHeader& other); ~SamHeader(void); // query/modify entire SamHeader at once diff --git a/src/api/SamReadGroup.cpp b/src/api/SamReadGroup.cpp index 96c8e4e..8debc58 100644 --- a/src/api/SamReadGroup.cpp +++ b/src/api/SamReadGroup.cpp @@ -38,6 +38,19 @@ SamReadGroup::SamReadGroup(const string& id) , SequencingTechnology("") { } +// copy ctor +SamReadGroup::SamReadGroup(const SamReadGroup& other) + : ID(other.ID) + , Sample(other.Sample) + , Library(other.Library) + , Description(other.Description) + , PlatformUnit(other.PlatformUnit) + , PredictedInsertSize(other.PredictedInsertSize) + , SequencingCenter(other.SequencingCenter) + , ProductionDate(other.ProductionDate) + , SequencingTechnology(other.SequencingTechnology) +{ } + // dtor SamReadGroup::~SamReadGroup(void) { Clear(); diff --git a/src/api/SamReadGroup.h b/src/api/SamReadGroup.h index fac4612..14498af 100644 --- a/src/api/SamReadGroup.h +++ b/src/api/SamReadGroup.h @@ -22,6 +22,7 @@ class API_EXPORT SamReadGroup { public: SamReadGroup(void); SamReadGroup(const std::string& id); + explicit SamReadGroup(const SamReadGroup& other); ~SamReadGroup(void); // public methods diff --git a/src/api/SamReadGroupDictionary.cpp b/src/api/SamReadGroupDictionary.cpp index fb03fac..2f0534e 100644 --- a/src/api/SamReadGroupDictionary.cpp +++ b/src/api/SamReadGroupDictionary.cpp @@ -18,6 +18,11 @@ using namespace std; // ctor SamReadGroupDictionary::SamReadGroupDictionary(void) { } +// copy ctor +SamReadGroupDictionary::SamReadGroupDictionary(const SamReadGroupDictionary& other) + : m_data(other.m_data) +{ } + // dtor SamReadGroupDictionary::~SamReadGroupDictionary(void) { m_data.clear(); diff --git a/src/api/SamReadGroupDictionary.h b/src/api/SamReadGroupDictionary.h index d21ccf8..5179b26 100644 --- a/src/api/SamReadGroupDictionary.h +++ b/src/api/SamReadGroupDictionary.h @@ -29,6 +29,7 @@ class API_EXPORT SamReadGroupDictionary { // ctor & dtor public: SamReadGroupDictionary(void); + explicit SamReadGroupDictionary(const SamReadGroupDictionary& other); ~SamReadGroupDictionary(void); // query/modify read group data diff --git a/src/api/SamSequence.cpp b/src/api/SamSequence.cpp index 0554604..e323f7a 100644 --- a/src/api/SamSequence.cpp +++ b/src/api/SamSequence.cpp @@ -22,6 +22,16 @@ SamSequence::SamSequence(const string& name) , Species("") { } +// copy ctor +SamSequence::SamSequence(const SamSequence& other) + : Name(other.Name) + , Length(other.Length) + , AssemblyID(other.AssemblyID) + , Checksum(other.Checksum) + , URI(other.URI) + , Species(other.Species) +{ } + // dtor SamSequence::~SamSequence(void) { Clear(); diff --git a/src/api/SamSequence.h b/src/api/SamSequence.h index db6891d..97cdb96 100644 --- a/src/api/SamSequence.h +++ b/src/api/SamSequence.h @@ -21,6 +21,7 @@ class API_EXPORT SamSequence { // ctor & dtor public: SamSequence(const std::string& name = ""); + explicit SamSequence(const SamSequence& other); ~SamSequence(void); // public methods diff --git a/src/api/SamSequenceDictionary.cpp b/src/api/SamSequenceDictionary.cpp index c023a39..2f9bf28 100644 --- a/src/api/SamSequenceDictionary.cpp +++ b/src/api/SamSequenceDictionary.cpp @@ -1,3 +1,13 @@ +// *************************************************************************** +// SamSequenceDictionary.cpp (c) 2010 Derek Barnett +// Marth Lab, Department of Biology, Boston College +// All rights reserved. +// --------------------------------------------------------------------------- +// Last modified: 23 December 2010 (DB) +// --------------------------------------------------------------------------- +// Provides container operations for collection of sequence entries +// ************************************************************************* + #include using namespace BamTools; @@ -7,6 +17,11 @@ using namespace std; // ctor SamSequenceDictionary::SamSequenceDictionary(void) { } +// copy ctor +SamSequenceDictionary::SamSequenceDictionary(const SamSequenceDictionary& other) + : m_data(other.m_data) +{ } + // dtor SamSequenceDictionary::~SamSequenceDictionary(void) { m_data.clear(); diff --git a/src/api/SamSequenceDictionary.h b/src/api/SamSequenceDictionary.h index bcd1652..37ac824 100644 --- a/src/api/SamSequenceDictionary.h +++ b/src/api/SamSequenceDictionary.h @@ -27,6 +27,7 @@ class API_EXPORT SamSequenceDictionary { // ctor & dtor public: SamSequenceDictionary(void); + explicit SamSequenceDictionary(const SamSequenceDictionary& other); ~SamSequenceDictionary(void); // query/modify sequence data