11 #include <boost/tuple/tuple.hpp>
23 BuiltinVTKReader::BuiltinVTKReader(
const std::string &observationFileName) :
24 idx_(-1), n_(0), observationFileName_(observationFileName)
28 BuiltinVTKReader::~BuiltinVTKReader()
34 void BuiltinVTKReader::init_()
38 in_.open(observationFileName_.c_str(), std::ios::in);
40 throw ObservationIOError(std::string(
"Could not open file ") +
41 observationFileName_ +
" for reading.");
44 std::getline(in_, dump);
45 std::getline(in_, dump);
46 if ( !(in_ >> Match(
"ASCII") >> Match(
"DATASET") >> Match(
"POLYDATA") ) )
47 throw ObservationIOError(
"Non-OsuTxt format.");
48 if ( !(in_ >> Match(
"POINTS") >> n_ >> Match(
"float") ) )
49 throw ObservationIOError(
"Non-OsuTxt format.");
50 }
catch (std::exception &e) {
51 throw ObservationIOError(
"Non-OsuTxt format.");
58 void BuiltinVTKReader::reset()
69 NUKLEI_UNIQUE_PTR<Observation> BuiltinVTKReader::readObservation_()
72 if (idx_ < 0)
NUKLEI_THROW(
"Reader does not seem inited.");
75 return NUKLEI_UNIQUE_PTR<Observation>();
82 NUKLEI_UNIQUE_PTR<BuiltinVTKObservation> observation(
new BuiltinVTKObservation);
83 observation->setLoc(loc);
85 return NUKLEI_UNIQUE_PTR<Observation>(NUKLEI_MOVE(observation));