57 bool accept(
const std::string& filename,
58 const std::string& head)
const
60 return (identify(filename,head).length() != 0);
68 virtual std::string identify(
const std::string& filename,
69 const std::string& head)
const = 0;
72 virtual void read(
const std::string& filename,
73 const std::string& head,
76 const Config& config = Config())
const = 0;
79 virtual void read(
const std::string& filename,
80 const std::string& head,
81 std::vector<MSDataPtr>& results,
82 const Config& config = Config())
const = 0;
85 virtual void readIds(
const std::string& filename,
86 const std::string& head,
87 std::vector<std::string>& dataIds,
88 const Config& config = Config())
const;
91 virtual const char* getType()
const = 0;
101 : std::runtime_error((
"[ReaderFail] " + error).c_str()),
105 virtual const std::string&
error()
const {
return error_;}
122 public std::vector<ReaderPtr>
127 virtual std::string identify(
const std::string& filename)
const;
130 virtual std::string identify(
const std::string& filename,
131 const std::string& head)
const;
134 virtual void read(
const std::string& filename,
140 virtual void read(
const std::string& filename,
141 const std::string& head,
148 virtual void read(
const std::string& filename,
149 std::vector<MSDataPtr>& results,
154 virtual void read(
const std::string& filename,
155 const std::string& head,
156 std::vector<MSDataPtr>& results,
161 virtual void readIds(
const std::string& filename,
162 std::vector<std::string>& results,
167 virtual void readIds(
const std::string& filename,
168 const std::string& head,
169 std::vector<std::string>& results,
185 template <
typename reader_type>
188 for (iterator it=begin(); it!=end(); ++it)
190 reader_type* p =
dynamic_cast<reader_type*
>(it->get());
198 template <
typename reader_type>
199 const reader_type*
get()
const
201 return const_cast<ReaderList*
>(
this)->get<reader_type>();
204 virtual const char*
getType()
const {
return "ReaderList";}
222 #endif // _READER_HPP_