]> git.donarmstrong.com Git - bamtools.git/blob - src/api/SamProgram.h
Minor cleanup
[bamtools.git] / src / api / SamProgram.h
1 // ***************************************************************************
2 // SamProgram.h (c) 2011 Derek Barnett
3 // Marth Lab, Department of Biology, Boston College
4 // ---------------------------------------------------------------------------
5 // Last modified: 19 April 2011 (DB)
6 // ---------------------------------------------------------------------------
7 // Provides direct read/write access to the SAM header program records.
8 // ***************************************************************************
9
10 #ifndef SAM_PROGRAM_H
11 #define SAM_PROGRAM_H
12
13 #include "api/api_global.h"
14 #include <string>
15
16 namespace BamTools {
17
18 class SamProgramChain;
19
20 struct API_EXPORT SamProgram {
21
22     // ctor & dtor
23     SamProgram(void);
24     SamProgram(const std::string& id);
25     SamProgram(const SamProgram& other);
26     ~SamProgram(void);
27
28     // query/modify entire program record
29     void Clear(void);                           // clears all data fields
30
31     // convenience query methods
32     bool HasCommandLine(void) const;            // returns true if program record has a command line entry
33     bool HasID(void) const;                     // returns true if program record has an ID
34     bool HasName(void) const;                   // returns true if program record has a name
35     bool HasPreviousProgramID(void) const;      // returns true if program record has a 'previous program ID'
36     bool HasVersion(void) const;                // returns true if program record has a version
37
38     // data members
39     std::string CommandLine;                    // CL:<CommandLine>
40     std::string ID;                             // ID:<ID>          *Required for valid SAM header*
41     std::string Name;                           // PN:<Name>
42     std::string PreviousProgramID;              // PP:<PreviousProgramID>
43     std::string Version;                        // VN:<Version>
44
45     // internal (non-standard) methods & fields
46     private:
47         bool HasNextProgramID(void) const;
48         std::string NextProgramID;
49         friend class BamTools::SamProgramChain;
50 };
51
52 /*! \fn bool operator==(const SamProgram& lhs, const SamProgram& rhs)
53     \brief tests equality by comparing program IDs
54 */
55 API_EXPORT inline bool operator==(const SamProgram& lhs, const SamProgram& rhs) {
56     return lhs.ID == rhs.ID;
57 }
58
59 } // namespace BamTools
60
61 #endif // SAM_PROGRAM_H