multovl  1.3
Multiple overlaps of genomic regions
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
fileio.hh
Go to the documentation of this file.
1 /* <LICENSE>
2 License for the MULTOVL multiple genomic overlap tools
3 
4 Copyright (c) 2007-2012, Dr Andras Aszodi,
5 Campus Science Support Facilities GmbH (CSF),
6 Dr-Bohr-Gasse 3, A-1030 Vienna, Austria, Europe.
7 All rights reserved.
8 
9 Redistribution and use in source and binary forms, with or without
10 modification, are permitted provided that the following conditions are
11 met:
12 
13  * Redistributions of source code must retain the above copyright notice,
14  this list of conditions and the following disclaimer.
15  * Redistributions in binary form must reproduce the above copyright notice,
16  this list of conditions and the following disclaimer in the documentation
17  and/or other materials provided with the distribution.
18  * Neither the name of the Campus Science Support Facilities GmbH
19  nor the names of its contributors may be used to endorse
20  or promote products derived from this software without specific prior
21  written permission.
22 
23 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
24 AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
25 INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
26 AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
27 THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
28 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
29 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
30 USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
31 ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
33 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 </LICENSE> */
35 #ifndef MULTOVL_FILEIO_HEADER
36 #define MULTOVL_FILEIO_HEADER
37 
38 // == HEADER fileio.hh ==
39 
46 // -- Standard headers --
47 
48 #include <fstream>
49 #include <string>
50 #include <vector>
51 #include <map>
52 
53 // -- Boost headers --
54 
55 #include "boost/noncopyable.hpp"
56 
57 // -- Own headers --
58 
59 #include "fileformat.hh"
60 #include "errors.hh"
61 
62 namespace multovl {
63 
64 class Region;
65 
66 namespace io {
67 
68 class TrackReader;
69 
70 // -- Input --
71 
76 class FileReader: private boost::noncopyable
77 {
78  public:
79 
85  explicit FileReader(
86  const std::string& infname,
87  Fileformat::Kind format = Fileformat::UNKNOWN);
88 
95  bool read_into(std::string& chrom, Region& reg);
96 
98  bool finished() const { return _finished; }
99 
101  const Errors& errors() const;
102 
103  ~FileReader();
104 
105  private:
106 
107  void add_error(const std::string& msg);
108 
109  TrackReader* _reader; // pimpl
110  bool _finished;
111  FileReader(); // no default ctor
112 
113 }; // END OF CLASS FileReader
114 
115 // -- Output --
116 
117 // NOTE: Implement a FileWriter if you want to let the user select an output format.
118 // Until then, just use the GFF2-based TextWriter.
119 
120 } // namespace io
121 } // namespace multovl
122 
123 #endif // MULTOVL_FILEIO_HEADER
Definition: trackio.hh:69
Definition: fileio.hh:76
bool finished() const
Definition: fileio.hh:98
Module to handle file format recognition.
Instances of the Region class represent regions on a sequence. They have first and last coordinates...
Definition: region.hh:65
Simple facility to keep track of errors and warnings.
Definition: errors.hh:49
bool read_into(std::string &chrom, Region &reg)
const Errors & errors() const