1 // ***************************************************************************
2 // SamProgram.h (c) 2011 Derek Barnett
3 // Marth Lab, Department of Biology, Boston College
4 // All rights reserved.
5 // ---------------------------------------------------------------------------
6 // Last modified: 19 April 2011 (DB)
7 // ---------------------------------------------------------------------------
8 // Provides direct read/write access to the SAM header program records.
9 // ***************************************************************************
14 #include "api/api_global.h"
19 class SamProgramChain;
21 struct API_EXPORT SamProgram {
25 SamProgram(const std::string& id);
26 SamProgram(const SamProgram& other);
29 // query/modify entire program record
30 void Clear(void); // clears all data fields
32 // convenience query methods
33 bool HasCommandLine(void) const; // returns true if program record has a command line entry
34 bool HasID(void) const; // returns true if program record has an ID
35 bool HasName(void) const; // returns true if program record has a name
36 bool HasPreviousProgramID(void) const; // returns true if program record has a 'previous program ID'
37 bool HasVersion(void) const; // returns true if program record has a version
40 std::string CommandLine; // CL:<CommandLine>
41 std::string ID; // ID:<ID> *Required for valid SAM header*
42 std::string Name; // PN:<Name>
43 std::string PreviousProgramID; // PP:<PreviousProgramID>
44 std::string Version; // VN:<Version>
46 // internal (non-standard) methods & fields
48 bool HasNextProgramID(void) const;
49 std::string NextProgramID;
50 friend class BamTools::SamProgramChain;
53 /*! \fn bool operator==(const SamProgram& lhs, const SamProgram& rhs)
54 \brief tests equality by comparing program IDs
56 API_EXPORT inline bool operator==(const SamProgram& lhs, const SamProgram& rhs) {
57 return lhs.ID == rhs.ID;
60 } // namespace BamTools
62 #endif // SAM_PROGRAM_H