1 #ifndef _anal_WeatherStore_h_
2 #define _anal_WeatherStore_h_
14 template<
class Data,
class RawRow = Data>
16 template<
class Iterator>
25 std::ifstream
file(filename);
26 if (!file.is_open()) {
27 std::cerr <<
"file " << filename <<
" missing!" << std::endl;
30 typedef std::istream_iterator<LineStringTo<RawRow>> Iterator;
31 fSet.insert(Iterator(file), Iterator());
40 if (it ==
fSet.begin()) {
41 std::cerr <<
"Warning: GPS second " << gps <<
" is before the earliest available weather data!" << std::endl;
43 }
else if (it ==
fSet.end()) {
44 std::cerr <<
"Warning: GPS second " << gps <<
" is after the last available weather data!" << std::endl;
47 if (it->fGPSSecond == gps)
52 fFound.Interpolate(*pit, *it, gps);
62 operator<<(std::ostream& os, const WeatherStore<Data>&
s)
64 for (
const auto& w :
s.fSet)
74 throw std::logic_error(
"not enough weather data!");
WeatherStore(const std::string &filename)
WeatherStore(const Iterator &begin, const Iterator &end)
std::size_t GetNEntries() const
const Data & GetData(const unsigned long int gps)