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