| 1710 | } |
| 1711 | |
| 1712 | ExitCodes main_(int, const char **) override |
| 1713 | { |
| 1714 | String out = getStringOption_("out"); |
| 1715 | String out_tsv = getStringOption_("out_tsv"); |
| 1716 | |
| 1717 | ofstream os; |
| 1718 | ofstream os_tsv; |
| 1719 | boost::iostreams::filtering_ostream os_filt; |
| 1720 | boost::iostreams::filtering_ostream os_tsv_filt; |
| 1721 | |
| 1722 | |
| 1723 | if (out.empty()) |
| 1724 | { |
| 1725 | os_filt.push(OpenMS_Log_info); |
| 1726 | } |
| 1727 | else |
| 1728 | { |
| 1729 | os.open(out); |
| 1730 | if (!os) |
| 1731 | { |
| 1732 | throw Exception::FileNotWritable(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, out); |
| 1733 | } |
| 1734 | os_filt.push(os); |
| 1735 | } |
| 1736 | |
| 1737 | if (out_tsv.empty()) |
| 1738 | { |
| 1739 | os_tsv_filt.push(boost::iostreams::null_sink()); |
| 1740 | } |
| 1741 | else |
| 1742 | { |
| 1743 | os_tsv.open(out_tsv); |
| 1744 | if (!os_tsv) |
| 1745 | { |
| 1746 | throw Exception::FileNotWritable(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, out_tsv); |
| 1747 | } |
| 1748 | os_tsv_filt.push(os_tsv); |
| 1749 | } |
| 1750 | |
| 1751 | return outputTo_(os_filt, os_tsv_filt); |
| 1752 | } |
| 1753 | }; |
| 1754 | |
| 1755 | |