]> git.donarmstrong.com Git - bamtools.git/blob - src/api/internal/SamFormatPrinter_p.h
5e28e9717c7d6a030b1f82e1968c742a433a5643
[bamtools.git] / src / api / internal / SamFormatPrinter_p.h
1 // ***************************************************************************
2 // SamFormatPrinter.h (c) 2010 Derek Barnett
3 // Marth Lab, Department of Biology, Boston College
4 // All rights reserved.
5 // ---------------------------------------------------------------------------
6 // Last modified: 23 December 2010 (DB)
7 // ---------------------------------------------------------------------------
8 // Provides functionality for printing formatted SAM header to string
9 // ***************************************************************************
10
11 #ifndef SAM_FORMAT_PRINTER_H
12 #define SAM_FORMAT_PRINTER_H
13
14 //  -------------
15 //  W A R N I N G
16 //  -------------
17 //
18 // This file is not part of the BamTools API.  It exists purely as an
19 // implementation detail. This header file may change from version to version
20 // without notice, or even be removed.
21 //
22 // We mean it.
23
24 #include <sstream>
25 #include <string>
26
27 namespace BamTools {
28
29 class SamHeader;
30
31 namespace Internal {
32
33 class SamFormatPrinter {
34
35     // ctor & dtor
36     public:
37         SamFormatPrinter(const BamTools::SamHeader& header);
38         ~SamFormatPrinter(void);
39
40     // generates SAM-formatted string from header data
41     public:
42         const std::string ToString(void) const;
43
44     // internal methods
45     private:
46         const std::string FormatTag(const std::string& tag, const std::string& value) const;
47         void PrintHD(std::stringstream& out) const;
48         void PrintSQ(std::stringstream& out) const;
49         void PrintRG(std::stringstream& out) const;
50         void PrintPG(std::stringstream& out) const;
51         void PrintCO(std::stringstream& out) const;
52
53     // data members
54     private:
55         const SamHeader& m_header;
56 };
57
58 } // namespace Internal
59 } // namespace BamTools
60
61 #endif // SAM_FORMAT_PRINTER_H