23 #ifndef _TRADATA_READER_HPP_
24 #define _TRADATA_READER_HPP_
44 bool accept(
const std::string& filename,
45 const std::string& head)
const
47 return (identify(filename,head).length() != 0);
55 virtual std::string identify(
const std::string& filename,
56 const std::string& head)
const = 0;
59 virtual void read(
const std::string& filename,
60 const std::string& head,
62 int runIndex = 0)
const = 0;
65 virtual void read(
const std::string& filename,
66 const std::string& head,
67 std::vector<TraDataPtr>& results)
const = 0;
74 virtual const char *getType()
const = 0;
84 : std::runtime_error((
"[ReaderFail] " + error).c_str()),
88 virtual const std::string&
error()
const {
return error_;}
105 public std::vector<ReaderPtr>
110 virtual std::string identify(
const std::string& filename)
const;
113 virtual std::string identify(
const std::string& filename,
114 const std::string& head)
const;
117 virtual void read(
const std::string& filename,
119 int runIndex = 0)
const;
122 virtual void read(
const std::string& filename,
123 const std::string& head,
125 int runIndex = 0)
const;
129 virtual void read(
const std::string& filename,
130 std::vector<TraDataPtr>& results)
const;
134 virtual void read(
const std::string& filename,
135 const std::string& head,
136 std::vector<TraDataPtr>& results)
const;
162 template <
typename reader_type>
165 for (iterator it=begin(); it!=end(); ++it)
167 reader_type* p =
dynamic_cast<reader_type*
>(it->get());
175 template <
typename reader_type>
176 const reader_type*
get()
const
178 return const_cast<ReaderList*
>(
this)->get<reader_type>();
181 virtual const char *
getType()
const {
return "ReaderList";}
194 #endif // _TRADATA_READER_HPP_