1 // ***************************************************************************
2 // SamProgram.h (c) 2011 Derek Barnett
3 // Marth Lab, Department of Biology, Boston College
4 // ---------------------------------------------------------------------------
5 // Last modified: 10 October 2011 (DB)
6 // ---------------------------------------------------------------------------
7 // Provides direct read/write access to the SAM header program records.
8 // ***************************************************************************
13 #include "api/api_global.h"
18 class SamProgramChain;
20 struct API_EXPORT SamProgram {
24 SamProgram(const std::string& id);
25 SamProgram(const SamProgram& other);
28 // query/modify entire program record
29 void Clear(void); // clears all data fields
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
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>
45 // internal (non-standard) methods & fields
47 bool HasNextProgramID(void) const;
48 std::string NextProgramID;
49 friend class BamTools::SamProgramChain;
52 /*! \fn bool operator==(const SamProgram& lhs, const SamProgram& rhs)
53 \brief tests equality by comparing program IDs
55 API_EXPORT inline bool operator==(const SamProgram& lhs, const SamProgram& rhs) {
56 return lhs.ID == rhs.ID;
59 } // namespace BamTools
61 #endif // SAM_PROGRAM_H