SamReadGroupDictionary.h

Go to the documentation of this file.
00001 // ***************************************************************************
00002 // SamReadGroupDictionary.h (c) 2010 Derek Barnett
00003 // Marth Lab, Department of Biology, Boston College
00004 // ---------------------------------------------------------------------------
00005 // Last modified: 16 October 2011 (DB)
00006 // ---------------------------------------------------------------------------
00007 // Provides methods for operating on a collection of SamReadGroup entries.
00008 // ***************************************************************************
00009 
00010 #ifndef SAM_READGROUP_DICTIONARY_H
00011 #define SAM_READGROUP_DICTIONARY_H
00012 
00013 #include "api/api_global.h"
00014 #include "api/SamReadGroup.h"
00015 #include <map>
00016 #include <string>
00017 #include <vector>
00018 
00019 namespace BamTools {
00020 
00021 typedef std::vector<SamReadGroup>             SamReadGroupContainer;
00022 typedef SamReadGroupContainer::iterator       SamReadGroupIterator;
00023 typedef SamReadGroupContainer::const_iterator SamReadGroupConstIterator;
00024 
00025 class API_EXPORT SamReadGroupDictionary {
00026 
00027     // ctor & dtor
00028     public:
00029         SamReadGroupDictionary(void);
00030         SamReadGroupDictionary(const SamReadGroupDictionary& other);
00031         ~SamReadGroupDictionary(void);
00032 
00033     // query/modify read group data
00034     public:
00035         // adds a read group
00036         void Add(const SamReadGroup& readGroup);
00037         void Add(const std::string& readGroupId);
00038 
00039         // adds multiple read groups
00040         void Add(const SamReadGroupDictionary& readGroups);
00041         void Add(const std::vector<SamReadGroup>& readGroups);
00042         void Add(const std::vector<std::string>& readGroupIds);
00043 
00044         // clears all read group entries
00045         void Clear(void);
00046 
00047         // returns true if dictionary contains this read group
00048         bool Contains(const SamReadGroup& readGroup) const;
00049         bool Contains(const std::string& readGroupId) const;
00050 
00051         // returns true if dictionary is empty
00052         bool IsEmpty(void) const;
00053 
00054         // removes read group, if found
00055         void Remove(const SamReadGroup& readGroup);
00056         void Remove(const std::string& readGroupId);
00057 
00058         // removes multiple read groups
00059         void Remove(const std::vector<SamReadGroup>& readGroups);
00060         void Remove(const std::vector<std::string>& readGroupIds);
00061 
00062         // returns number of read groups in dictionary
00063         int Size(void) const;
00064 
00065         // retrieves a modifiable reference to the SamReadGroup object associated with this ID
00066         SamReadGroup& operator[](const std::string& readGroupId);
00067 
00068     // retrieve STL-compatible iterators
00069     public:
00070         SamReadGroupIterator      Begin(void);              // returns iterator to begin()
00071         SamReadGroupConstIterator Begin(void) const;        // returns const_iterator to begin()
00072         SamReadGroupConstIterator ConstBegin(void) const;   // returns const_iterator to begin()
00073         SamReadGroupIterator      End(void);                // returns iterator to end()
00074         SamReadGroupConstIterator End(void) const;          // returns const_iterator to end()
00075         SamReadGroupConstIterator ConstEnd(void) const;     // returns const_iterator to end()
00076 
00077     // data members
00078     private:
00079         SamReadGroupContainer m_data;
00080         std::map<std::string, size_t> m_lookupData;
00081 };
00082 
00083 } // namespace BamTools
00084 
00085 #endif // SAM_READGROUP_DICTIONARY_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Generated on Wed Aug 29 17:43:46 2012 for BamTools by  doxygen 1.6.3