ProteoWizard
TraDataFile.hpp
Go to the documentation of this file.
1 //
2 // $Id: TraDataFile.hpp 1195 2009-08-14 22:12:04Z chambm $
3 //
4 //
5 // Original author: Matt Chambers <matt.chambers .@. vanderbilt.edu>
6 //
7 // Copyright 2009 Vanderbilt University - Nashville, TN 37232
8 //
9 // Licensed under the Apache License, Version 2.0 (the "License");
10 // you may not use this file except in compliance with the License.
11 // You may obtain a copy of the License at
12 //
13 // http://www.apache.org/licenses/LICENSE-2.0
14 //
15 // Unless required by applicable law or agreed to in writing, software
16 // distributed under the License is distributed on an "AS IS" BASIS,
17 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 // See the License for the specific language governing permissions and
19 // limitations under the License.
20 //
21 
22 
23 #ifndef _TRADATAFILE_HPP_
24 #define _TRADATAFILE_HPP_
25 
26 
28 #include "TraData.hpp"
29 #include "Reader.hpp"
30 
31 
32 namespace pwiz {
33 namespace tradata {
34 
35 
36 /// TraData object plus file I/O
38 {
39  /// constructs TraData object backed by file;
40  /// reader==0 -> use DefaultReaderList
41  TraDataFile(const std::string& filename,
42  const Reader* reader = 0);
43 
44  /// data format for write()
45  enum PWIZ_API_DECL Format {Format_Text, Format_traML};
46 
47  /// configuration for write()
49  {
50  Format format;
51  bool gzipped; // if true, file is written as .gz
52 
53  WriteConfig(Format format = Format_traML, bool gzipped = false)
54  : format(format), gzipped(gzipped)
55  {}
56  };
57 
58  /// static write function for any TraData object;
59  static void write(const TraData& msd,
60  const std::string& filename,
61  const WriteConfig& config = WriteConfig());
62 
63  /// member write function
64  void write(const std::string& filename,
65  const WriteConfig& config = WriteConfig());
66 };
67 
68 
69 PWIZ_API_DECL std::ostream& operator<<(std::ostream& os, TraDataFile::Format format);
70 PWIZ_API_DECL std::ostream& operator<<(std::ostream& os, const TraDataFile::WriteConfig& config);
71 
72 
73 } // namespace tradata
74 } // namespace pwiz
75 
76 
77 #endif // _TRADATAFILE_HPP_