IntaRNA 3.4.1
RNA-RNA interaction prediction | C++ API
Loading...
Searching...
No Matches
OutputStreamHandlerSortedCsv.h
Go to the documentation of this file.
1
2#ifndef OUTPUTSTREAMHANDLERSORTEDCSV_H_
3#define OUTPUTSTREAMHANDLERSORTEDCSV_H_
4
6
7#include <sstream>
8
9
10namespace IntaRNA
11{
12
22{
23public:
24
35 , const size_t colToSort
36 , const bool sortLexOrder
37 , const std::string colSep
38 , const bool csvWithHeader
39 , const std::string listSep = ""
40 );
41
50
55 virtual
56 std::ostream& getOutStream();
57
58
59protected:
60
63
65 std::stringstream outStreamUnsorted;
66
68 const size_t colToSort;
69
71 const bool sortLexOrder;
72
74 const std::string colSep;
75
77 const bool csvWithHeader;
78
80 std::string csvHeader;
81
83 const std::string listSep;
84};
85
87
88inline
91 , const size_t colToSort
92 , const bool sortLexOrder
93 , const std::string colSep
94 , const bool csvWithHeader
95 , const std::string listSep
96 )
97 : OutputStreamHandler( osh == NULL ? &std::cout : &(osh->getOutStream()) )
98 , outStreamHandler(osh)
99 , outStreamUnsorted()
100 , colToSort(colToSort)
101 , sortLexOrder(sortLexOrder)
102 , colSep(colSep)
103 , csvWithHeader(csvWithHeader)
104 , csvHeader()
105 , listSep(listSep)
106{
107 if (osh == NULL) {
108 throw std::runtime_error("OutputStreamHandlerSortedCsv() : outStreamHandler == NULL");
109 }
110 if (colSep.empty()) {
111 throw std::runtime_error("OutputStreamHandlerSortedCsv() : colSep is empty");
112 }
113}
114
116
117inline
118std::ostream&
124
126
127
128
129} /* namespace IntaRNA */
130
131#endif /* OUTPUTSTREAMHANDLERSORTEDCSV_H_ */
Definition OutputStreamHandlerSortedCsv.h:22
const std::string listSep
the separator used within a single column to represent multiple values
Definition OutputStreamHandlerSortedCsv.h:83
const bool csvWithHeader
whether or not the CSV output will contain a header line
Definition OutputStreamHandlerSortedCsv.h:77
virtual std::ostream & getOutStream()
Definition OutputStreamHandlerSortedCsv.h:120
std::stringstream outStreamUnsorted
the stream to write output to
Definition OutputStreamHandlerSortedCsv.h:65
const bool sortLexOrder
whether or not lexicographic (or numerical) sorting is to be done
Definition OutputStreamHandlerSortedCsv.h:71
const size_t colToSort
the CSV column to sort
Definition OutputStreamHandlerSortedCsv.h:68
std::string csvHeader
the parsed CSV header (empty if not parsed yet)
Definition OutputStreamHandlerSortedCsv.h:80
const std::string colSep
the column separator used within the output
Definition OutputStreamHandlerSortedCsv.h:74
OutputStreamHandlerSortedCsv(OutputStreamHandler *outStreamHandler, const size_t colToSort, const bool sortLexOrder, const std::string colSep, const bool csvWithHeader, const std::string listSep="")
Definition OutputStreamHandlerSortedCsv.h:90
OutputStreamHandler * outStreamHandler
the underlying OutputStreamHandler to which the final output is reported
Definition OutputStreamHandlerSortedCsv.h:62
Definition OutputStreamHandler.h:16
Definition Accessibility.h:13